MPP for vbak and vbap tables in two screens
Refer: MPP introduction
Step 1: Goto SE80.
Step 2: Select program and give program name and click on display (If we click on display button it is asking to create).
Step 3: Select create with top include check box and press enter. Give top include name.
Step 4: Save the program.
Step 5: Right click on program name and choose to create and click on screen. Give screen number and press enter.
Step 6: Give short description and choose Dynpro type (Normal screen). Save the screen and activate.
Step 7: Right click on program name and choose to create and click on screen. Give screen number and press enter.
Step 8: Give short description and choose Dynpro type (Normal screen). Save the screen and activate.
Step 9: Double click on top include and write code related to structure, work area, internal tables.
Step 10: Screen 1000 has 5 fields that is displayed in same screen as single data. Screen 2000 has 4 fields that is displayed in tabular format.
PROGRAM zab_mpp_vbak_vbap.
TABLES: vbak.
TYPES: BEGIN OF ls_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
erzet TYPE vbak-erzet,
ernam TYPE vbak-ernam,
auart TYPE vbak-auart,
END OF ls_vbak.
TYPES: BEGIN OF ls_vbap,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
matkl TYPE vbap-matkl,
END OF ls_vbap.
DATA: lr_vbak TYPE ls_vbak,
lt_vbak TYPE TABLE OF ls_vbak,
lr_vbap TYPE ls_vbap,
lt_vbap TYPE TABLE OF ls_vbap,
p_vbeln TYPE vbak-vbeln.
Step 11: Double click on 1000 screen number, click on layout design screen.
* Click on text field and drag give name (VBELN_LA) and text.
* Click on input/output field and drag and give name(P_VBELN).
* Click on 'dictionary/program fields' and give table name VBAK and click on 'get from dictionary'.
* Choose fields and select ok.
* Click on push button and drag give name, text, fctcode(FSUBMIT).
* Click on save.
* Uncomment the module status under flow logic tab. and double click on it, to Create object.
* Uncomment the pf status and title bar and give names.
* Double click on title bar name and create object. Give title bar.
* Double click on pf status name and create object. Give short description.
* Expand application toolbar and give name(&ITEM).
* Double click on name give function text, icon name, information text. Give function code.
* Save and activate the screen.
Step 12: Double click on 2000 screen number, click on layout design screen.
* Click on table control wizard. click on continue.
* Give the name (VBAP) of table control. click on continue.
* Select internal table (lt_vbap) and work area (lr_vbap) (If we get error pls activate the program).
* Select all fields and click on continue. click on continue and complete
* Save and activate the screen.
* Uncomment the module status under flow logic tab. and double click on it, to Create object.
* Uncomment the pf status and title bar and give names.
* Double click on title bar name and create object. Give title bar.
* Double click on pf status name and create object. Give short description.
* Expand application toolbar and give name(&HEAD).
* Double click on name give function text, icon name, information text. Give function code.
* Save and activate the screen.
Step 13: Double click on 1000 screen number and uncomment the module user command.
* Double click on module user command and create object.
* Write code.
MODULE user_command_1000 INPUT.
CASE sy-ucomm.WHEN 'FSUBMIT'.
SELECT single vbeln erdat erzet ernam auart
FROM vbak
INTO lr_vbak
WHERE vbeln = p_vbeln.
WHEN '&ITEM'.
SELECT vbeln posnr matnr matkl
FROM vbap
INTO TABLE lt_vbap
WHERE vbeln = p_vbeln.
IF sy-subrc = 0.
call SCREEN 2000.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDMODULE.
Step 14: Double click on 2000 screen number and uncomment the module user command.
* Double click on module user command and create object.
* Write code.
MODULE user_command_2000 INPUT.
CASE sy-ucomm.
WHEN '&HEAD'.
SELECT single vbeln erdat erzet ernam auart
FROM vbak
INTO lr_vbak
WHERE vbeln = p_vbeln.
IF sy-subrc = 0.
call SCREEN 1000.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDMODULE.
Step 15: Right click on program and create transaction code.
* Give t code name and short text. and start object dialog transaction. Press enters.
* Give program name and screen number and click on save.
Total code
INCLUDE zab_mpp_vbak_vbap_top . " Global Data
* INCLUDE ZAB_MPP_VBAK_VBAP_O01 . " PBO-Modules
* INCLUDE ZAB_MPP_VBAK_VBAP_I01 . " PAI-Modules
* INCLUDE ZAB_MPP_VBAK_VBAP_F01 . " FORM-Routines
MODULE status_1000 OUTPUT.
SET PF-STATUS 'ZPF_HEAD'.
SET TITLEBAR 'ZTB_HEAD'.
ENDMODULE.
*&SPWIZARD: DECLARATION OF TABLECONTROL 'VBAP' ITSELF
CONTROLS: vbap TYPE TABLEVIEW USING SCREEN 2000.
*&SPWIZARD: OUTPUT MODULE FOR TC 'VBAP'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
MODULE vbap_change_tc_attr OUTPUT.
DESCRIBE TABLE lt_vbap LINES vbap-lines.
ENDMODULE.
MODULE status_2000 OUTPUT.
SET PF-STATUS 'ZPF_ITEM'.
SET TITLEBAR 'ZTB_ITEM'.
ENDMODULE.
MODULE user_command_1000 INPUT.
CASE sy-ucomm.
WHEN 'FSUBMIT'.
SELECT single vbeln erdat erzet ernam auart
FROM vbak
INTO lr_vbak
WHERE vbeln = p_vbeln.
WHEN '&ITEM'.
SELECT vbeln posnr matnr matkl
FROM vbap
INTO TABLE lt_vbap
WHERE vbeln = p_vbeln.
IF sy-subrc = 0.
call SCREEN 2000.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDMODULE.
MODULE user_command_2000 INPUT.
CASE sy-ucomm.
WHEN '&HEAD'.
SELECT single vbeln erdat erzet ernam auart
FROM vbak
INTO lr_vbak
WHERE vbeln = p_vbeln.
IF sy-subrc = 0.
call SCREEN 1000.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDMODULE.
*******************************Top*********************************
PROGRAM zab_mpp_vbak_vbap.
TABLES: vbak.
TYPES: BEGIN OF ls_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
erzet TYPE vbak-erzet,
ernam TYPE vbak-ernam,
auart TYPE vbak-auart,
END OF ls_vbak.
TYPES: BEGIN OF ls_vbap,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
matkl TYPE vbap-matkl,
END OF ls_vbap.
DATA: lr_vbak TYPE ls_vbak,
lt_vbak TYPE TABLE OF ls_vbak,
lr_vbap TYPE ls_vbap,
lt_vbap TYPE TABLE OF ls_vbap,
p_vbeln TYPE vbak-vbeln.
******************************End of top*********************************
Input1
Output1
Input2
Output2
******************************Thank You***************************
Comments
Post a Comment