Merging Multiple Adobe Forms in One PDF Document…

Requirement : I have three Copy of invoice againt the Same billing Document No those have to be merger together as one PDf form.

Driver program : Sourse program to generate the PDF copies by looping the FM three times for each copies with different header texts like “ORIGINAL” “DUPLICATE” “TRIPLICATE” respectively.

How it can be acheived..? by simple method.

Before Calling the FM FP_JOB_OPEN we have to maintain certain parameters in the job_output_parameter structure..

below parameter has to be passed to structure sfpoutputparams .

    lw_out_paramnodialog  abap_true.
    lw_out_paramgetpdf    ‘M’.
    lw_out_paramassemble  abap_true.
    lw_out_parampreview   abap_false.
    lw_out_parambumode   ‘M’.

Call the FM :  CALL FUNCTION ‘FP_JOB_OPEN’

Call Your FM : XXXXX —-Which will print the form (looping the function module 3 times for my scenario to generate the copies)

NOTE : icase if you want to merge two adobe forms together call the FM sequentially in between the ‘FP_JOB_OPEN’ and ‘FP_JOB_CLOSE’ .

Call the FM : CALL FUNCTION ‘FP_JOB_CLOSE’

At the end Call the FM below to merge the pdf all in one.

    CALL FUNCTION ‘FP_GET_PDF_TABLE’
      IMPORTING
        e_pdf_table lt_pdf_table.  “Table which has the FPCONTENT .

 

 

 

 

 

 

AT EXIT COMMAND in Module Pool..

Usage Of AT EXIT COMMAND in module pool.

Purpose:

At exit Command is mainly used to quit the program.

Scenario:

Let me explain with the scenario ” I have five input fields in my screen ,all the five fields are mandatory i have to go back to the program (LEAVE PROGRAM).

Normally if there is any one mandatory fields in screen if am triggering any event that time the system automatically throws an error like “Please fill in the mandatory fields”. that case the AT EXIT COMMAND will be used.

step 1 : create module pool program name say ZXXX.

Create a screen number 2001 like below.

12

 Give the function code as ‘Exit’ and function type as ‘E’.

Activate the screen and create the module under PAI using an addition  AT EXIT COMMAND like below.

123

Write the logic in program as below.

1234

If you wanted to do the same thing with the standard function code like EXIT or CANCEL in the standard toolbar in the screen means we can do it like below pic..

12345

Double click on the particular function code eg: EXIT and specify the function type E as fallows.

OUTPUT:

If any one of the action CANCEL EXIT in toolbar or CANCEL button in Screen triggers it will go back to the program.

1234567

12389

Thankyou……………

Topics on Basic Abap:

Set parameter and Get parameter (SPA?GPA) In abap.

Ale Idoc Introduction and Steps.

Fetching Cliet dependant values and update the table in different clients.

Creating Parameters , selectoptions , Radiobuttons, etc…

List box in selection Screen.

Screen modification using Loop at screen in

Control level statements in abap.

Basic classical reports in abap

Commonly using function modules in abap

Call By value and Call by reference.

Number generation using ONCHANGE-OF statement.

SAP architecture .

SAP Abbreviation.

doc

Dictionary 1

SET/GET parameter ID in ABAP..

What is meant by SET/GET parameter ID in abap..?

SET/GET parameter ID in SAP otherwise called as SPA/GPA parameters in abap.

Defenition:

SET parameter ID:

It is to Set the values OR Apply the values to the paticular parameters .

GET parameter ID:

It is to read the values OR get the values from the Paticular Parameter ID that we had already SET using ‘SET PARAMETER ID’.

How it works:

The program will copies the values of SAP memory into abap Memory (internal session’s ) at the time of program loads in the memory once it is executed .

Eg: You have created REPORT program name (ZXXXX)

setID

Now it will save the value ‘HAI ‘ in SAP memory for the particular parameter ID TPS( locally created in se38 ).

How to get the above value from another program using memory ID.

Memory ID is used to access the values of locally created parameter ID.

In case there is no parameter ID is created then if use GET method it will return the SY-SUBRC = 4 or else return SY-SUBRC = 0 if it has the value.

Create another one report program name(YXXXX)

setID_memoryid

Execute the program you will get the below output it will take the default value in the memory ID.

OUTPUT:

output_id

GET Parameter ID

Eg:  GET parameter id will be used to retain the values of ID which is created in R3 repository(SE11), those ID will be available in the table TPARA.

getid

Execute the program the output will be. it will return the program name.

getid123

Finally came to know that we can retain the values using SET/ GET parameter ID untill the user quit the GUI because that will be stored in SAP memory.

ALE IDOC Introduction.

sap-sap

What is meant by ALE ?

ALE means Application Link Enabling is a method  which is used to transfer data  between SAP – Non SAP and Vice Versa.

Here your have question that we have EDI why we are going for ALE.

Reason:

Because ALE is mainly used to transfer the information between SAP systems only.

  If  you want to communicate between SAP – NON SAP means then you can go for EDI . we will discuss what is EDI in later Posts breifly.

What is meant by IDOC?

IDOC means Intermediate Document which is used to send data from SAP – NON SAP and vice versa using ALE or EDI.

In other words we can say that IDOC is a Data container.Why?

Reason:

Because SAP R/3 will Accept only IDOC format whether it an Inbound or   Outbound. we will discuss on Inbound / Outbound idocs on later Posts breifly.

If you want to send the data using IDOC we have to use IDOC structure.

IDOC structure:

1.Control Records. (which has the type of idoc,message type, the current status, the sender, receiver etc.)

2.Data Records.( Which contains application data ,These are called the data records/segments.)

3.Status Records( Status Information of various stages that idoc has passed through).

Scenario:

I have to transfer the data from Client 800(sender) to client 900(receiver).

Steps Involved in creating ALE IDOC:

The first five step will be common on both the clients.

1.Go to t code [SALE].

2.Define logical system.

3.Assign Logical system to client.

4.Creating RFC destination t code [SM59]

5.Creating port destinations [WE21]

IDOC configuration.

From steps 6 – 12 done only on the source client (i.e) sender.

6.Segment Creating [WE31]

7.Basic IDOC type [WE30]

8.Message type Creation [WE81]

9.Assigning message type to basic type [WE82]

10.Maintaining Distribution Model [BD64]

11. Creating Report Program to generate the IDOC number.

12.Partner Profile [WE20]

13. To check the IDOC Status [WE02 , WE05]

From steps 14 – 18 done only on the target client (i.e) Receiver.

14.Create a function module to receive the data which is sent by the sender system. Purpose : It will assign the data in to IDOC structure [SE37].

15.Assigning Function module to Logical Message[WE57].

16.Define input method for the inbound function module [BD51].

17. Creating the process Code [WE42] Purpose: It will convet the Application data into idoc format.

18.Generate Partner Profile [BD64].

The below Link gives you an example to create ALE IDOC.

http://www.saptechnical.com/Tutorials/ALE/Guide/Index.htm.

Reading values from Different clients…?

My Scenario:

I have to read the values of client 900 from the client 800.

here the coding very simple.

create a table(Zsap_tb_mytable) in client 900 .

create a report program (Zsap_ss_demo).

Before that you should know the difference between client dependent and client independant.

*The tables are client independant but the values are client dependant.

here you can see the tables and values in client 900 table.

mytable_900_1

 

 

mytable_900

 

 Program to populate values to the database table

*********************************************

REPORT  ztps_ss_demo.

DATA : lt_itab TYPE SORTED TABLE OF zsap_tb_mytable WITH UNIQUE KEY zid,
ls_itab LIKE LINE OF lt_itab.

*apending values.

ls_itab-zid = ‘1’.
ls_itab-zname = ‘sri’.
APPEND ls_itab to lt_itab.

ls_itab-zid = ‘2’.
ls_itab-zname = ‘srikumaran’.
APPEND ls_itab to lt_itab.

LOOP AT lt_itab INTO ls_itab.
INSERT zsap_tb_mytable FROM ls_itab.
ENDLOOP.

**********************************************

In client 800 you can able to see the table but value are not there because the values are client dependent.

see the image below.

mytable_800

 

 

Create a sample Program in client 800 name( Zsap_demo_read).

************************************************

REPORT Zsap_demo_read.

DATA : lt_itab TYPE SORTED TABLE OF zsap_tb_mytable WITH UNIQUE KEY zid,
ls_itab LIKE LINE OF lt_itab.

*put the the select query to get the values of 900 client from 800 client
SELECT * FROM zsap_tb_mytable
  CLIENT SPECIFIED     “use the addition to read the client specified values
  INTO TABLE lt_itab
  WHERE mandt = ‘900’.

*populate the values in client 800 table.
LOOP AT lt_itab INTO ls_itab.
INSERT zsap_tb_mytable FROM ls_itab.
ENDLOOP.

**************************************************

Now open the table in client 800 and you can now see the values.

mytable_800_1

 

 

*************************************************

Creating Parameters , Select Options, Radio Buttons,listbox, in selection screen

REPORT ztps_demo_selection_screen.

TABLES :ekko,eban.

DATA:lv_name TYPE vrm_id, “paramete name
lt_listbox TYPE vrm_values, “*– Table of Values
ls_listbox LIKE LINE OF lt_listbox. “*– line type for the table

*Selection screen declaration

SELECTION-SCREEN BEGIN OF SCREEN 9000 TITLE t1.

SELECTION-SCREEN BEGIN OF BLOCK box1 WITH FRAME TITLE bt1.

SELECT-OPTIONS : pur_dno FOR ekko-ebeln, “purchase document number
ven_num FOR ekko-lifnr, “vendor number
mat_num FOR eban-matnr. “matrial number
SELECTION-SCREEN ULINE .
PARAMETERS: pur_org TYPE ekko-ekorg, “purchase organisation
com_cd TYPE ekko-bukrs AS LISTBOX VISIBLE LENGTH 10 DEFAULT ‘1000’,
pur_gp TYPE ekko-ekgrp. “purchasing group
SELECTION-SCREEN ULINE .
SELECTION-SCREEN:BEGIN OF LINE.
PARAMETERS :rb1 RADIOBUTTON GROUP g1.
SELECTION-SCREEN :COMMENT 5(25) FOR FIELD rb1.
PARAMETERS :rb2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN COMMENT 40(25) FOR FIELD rb2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN: SKIP 1.
SELECTION-SCREEN :BEGIN OF LINE,
PUSHBUTTON 10(10) b1 USER-COMMAND ck1,
PUSHBUTTON 40(10) b2 USER-COMMAND ck2.
SELECTION-SCREEN END OF LINE .
SELECTION-SCREEN END OF BLOCK box1.
SELECTION-SCREEN END OF SCREEN 9000.

CALL SELECTION-SCREEN 9000. “Calling the selection screen

AT SELECTION-SCREEN OUTPUT.
*populating the values to the LISTBOX.
lv_name =
‘P_BUKRS’.
ls_listbox-
key = ‘1000’.
ls_listbox-
text = ‘1000’.
APPEND ls_listbox TO lt_listbox.
CLEAR ls_listbox.

ls_listbox-key = ‘2000’.
ls_listbox-
text = ‘2000’.
APPEND ls_listbox TO lt_listbox.
CLEAR ls_listbox.

ls_listbox-key = ‘3000’.
ls_listbox-
text = ‘3000’.
APPEND ls_listbox TO lt_listbox.
CLEAR ls_listbox.

ls_listbox-key = ‘5000’.
ls_listbox-
text = ‘5000’.
APPEND ls_listbox TO lt_listbox.
CLEAR ls_listbox.

*Calling function module to generate the list box.
CALLFUNCTION‘VRM_SET_VALUES’
EXPORTING
id = lv_name “Name of the parameter to set as a listbox
values = lt_listbox
“list box table to populate the values
EXCEPTIONS
id_illegal_name =
1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGEID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

 Output:

input

Listbox in Selection screen …

REPORT ztps_ss_demo_listbox.

TYPE-POOLS:vrm.“type pools declaration

DATA:lv_name TYPE vrm_id, “paramete name
lt_listbox TYPE vrm_values, “*– Table of Values
ls_listbox LIKE LINE OF lt_listbox.“*– line type for table

SELECTION-SCREEN BEGIN OF SCREEN 9001.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE tit1.
PARAMETERS p_matnr TYPE matnr MODIF ID m1.
SELECTION-SCREEN SKIP.
PARAMETERS p_bukrs TYPE bukrs AS LISTBOX VISIBLE LENGTH 10 DEFAULT ‘1000’. “initialize default values for the list box
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN PUSHBUTTON 10(10) but1 USER-COMMAND ck1.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN END OF SCREEN 9001.

INITIALIZATION .

but1 = ‘CLICK’.
tit1 = ‘Input’.

CALL SELECTION-SCREEN 9001. “Calling the selection screen


AT SELECTION-SCREEN OUTPUT.
*populating the values to the LISTBOX.
lv_name = ‘P_BUKRS’.
ls_listbox-key = ‘1000’.
ls_listbox-text = ‘1000’.
APPEND ls_listbox TO lt_listbox.
CLEAR ls_listbox.

ls_listbox-key = ‘2000’.
ls_listbox-text = ‘2000’.
APPEND ls_listbox TO lt_listbox.
CLEAR ls_listbox.

ls_listbox-key = ‘3000’.
ls_listbox-text = ‘3000’.
APPEND ls_listbox TO lt_listbox.
CLEAR ls_listbox.

ls_listbox-key = ‘5000’.
ls_listbox-text = ‘5000’.
APPEND ls_listbox TO lt_listbox.
CLEAR ls_listbox.

*Calling function module to generate the list box.
CALL FUNCTION ‘VRM_SET_VALUES’
EXPORTING
  id     = lv_name “Name of the parameter to set as a listbox
values = lt_listbox “list box table to populate the values
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

 

Output:

listbox

 

 

Loop at screen in abap…?

My Scenario Is: If i am clicking on the button i should hide the parameter using modifying the screen . lets see the example given below.

REPORT ztps_ss_demo.

TABLES vbak. “

DATA lv_flag TYPE i.

SELECTION-SCREEN BEGIN OF SCREEN 9001.

PARAMETERS p_matnr TYPE matnr MODIF ID m1. “Modify ID (M1)

SELECT-OPTIONS s_vbeln FOR vbak-vbeln.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN PUSHBUTTON 10(10) but1 USER-COMMAND ck1.

SELECTION-SCREEN END OF SCREEN 9001.

INITIALIZATION .
but1 = ‘CLICK’.

CALL SELECTION-SCREEN 9001. “calling selection screen

AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN ‘CK1’.                “when click on the CLICK button
IF lv_flag IS INITIAL.
lv_flag = 1.               “setting flag
ELSE.
lv_flag = 2.
ENDIF.
ENDCASE.

AT SELECTION-SCREEN OUTPUT.

“looping the screen to modify the screen elements
IF lv_flag = 1.
LOOP AT SCREEN .
IF screen-group1 = ‘M1’.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.


“looping the screen again to modify the screen elements
IF lv_flag = 2.
LOOP AT SCREEN .
IF screen-group1 = ‘M1’.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
CLEAR lv_flag.
ENDLOOP.
ENDIF.

Output:

At first the screen displays like below screen shot.

loop

When am clicking on the ‘CLICK’ Button the P_matnr parameter goes hiding.

loop1

Again i am clik on the button the p_matnr will be in active state (i e) you will get the initial screen.