Professional Documents
Culture Documents
Write the name of PF-STATUS in “Status” and the name of the program where you will enter the status in
“Program”. Click on Create or click on the “Copy Status” button above. In this case, I am using the “Copy Status” button.
Step 2: A pop-up will open, asking from which status we want to copy and to which status.
Provide the program name and Status name as follows and click on the copy button.
Ad Worten PT Go !
Step 3: Another pop-up will open, just click the copy button.
Step 4: An “Maintain Status” Interface will open will all the System generated menu icons copied. Now click on Application Toolbar
expand button and enter the name of the icon as shown below.
Step 5: Double click on it, and a pop-up will open click on the Static Text radio button and click on the tick button.
Step 6: Another pop-up will appear, Provide the Icon name of your choice, choose an icon from the Icon Name field, and provide some
info in the Info text field about the icon. Now provide info as shown below.
Step 7: Now Provide a shortcut key to access that icon on your report.
Step 8: Click the save button and activate it.
Step 9: Now Go to SE38 Tcode. Type the program name and choose Source Code from Subjects and Click on Create button.
Step 10: Enter Title & select ‘Executable Program’ type in Attributes and then click on save.
Step 11: Now enter the Package name in the ‘Package’ Attribute and click on the button.
Now ABAP Editor will open, here write the code given below for the report.
REPORT zalvexample9.
*Table Declaration.
TABLES : vbak, vbap.
*Type-Pools
TYPE-POOLS: slis.
*Type Declaration
END OF ty_vbak,
BEGIN OF ty_vbap,
SELECT vbeln
erdat
ernam
auart
vkorg
vtweg
spart
vkgrp
kunnr
FROM vbak INTO TABLE gt_vbak
WHERE vbeln IN so_vbeln.
SELECT vbeln
posnr
matnr
matkl
arktx
netwr
waerk
klmeng
vrkme
FROM vbap INTO TABLE gt_vbap FOR ALL ENTRIES IN gt_vbak
WHERE vbeln = gt_vbak-vbeln.
wa_all-vbeln = wa_vbap-vbeln.
wa_all-posnr = wa_vbap-posnr.
wa_all-matnr = wa_vbap-matnr.
wa_all-matkl = wa_vbap-matkl.
wa_all-arktx = wa_vbap-arktx.
wa_all-netwr = wa_vbap-netwr.
wa_all-waerk = wa_vbap-waerk.
wa_all-klmeng = wa_vbap-klmeng.
wa_all-vrkme = wa_vbap-vrkme.
IF sy-subrc = 0.
wa_all-erdat = wa_vbak-erdat.
wa_all-ernam = wa_vbak-ernam.
wa_all-auart = wa_vbak-auart.
wa_all-vkorg = wa_vbak-vkorg.
wa_all-vtweg = wa_vbak-vtweg.
wa_all-spart = wa_vbak-spart.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 15.
wa_fcat-fieldname = ‘WAERK’.
wa_fcat-seltext_m = ‘CURRENCY’.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 16.
wa_fcat-fieldname = ‘KLMENG’.
wa_fcat-seltext_m = ‘QUANTITY’.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 17.
wa_fcat-fieldname = ‘VRKME’.
wa_fcat-seltext_m = ‘SALES UNIT’.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.
*LAYOUT
gt_layout-colwidth_optimize = ‘X’.
gt_layout-edit = ‘X’.
i_callback_program = sy-repid
i_callback_pf_status_set = ‘PF_STATUS’
i_callback_user_command = ‘USER_COMMAND’
is_layout = gt_layout
it_fieldcat = gt_fcat
TABLES
t_outtab = gt_all
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
*Creating PF-STATUS
IF sy-subrc = 0.
DATA : lv_rqdest TYPE tsp01-rqdest VALUE ‘LP01’,
lv_linsz TYPE sylinsz VALUE ‘9999999’.
IF sy-subrc <> 0.
RAISE job_cannot_be_closed. ” Raise exception
ENDIF.
ELSE.
RAISE job_cannot_be_submitted.
ENDIF.
IF sy-subrc <> 0.
* Implement suitable error handling here
lv_string = sy-repid.
ENDIF.
ls_param-selname = ‘P_FILE’.
ls_param-sign = ‘I’.
ls_param-option = ‘EQ’.
ls_param-low = lv_string.
ls_param-high = ‘ ‘.
APPEND ls_param TO lt_param.
Step 1: Press F8
Step 2: Again press F8 to execute the Report & Click on the below-marked Icon.