BADI : BADI_SLS_ITEM_SCR_CUS
Add field in following Table : VBAP
Add field in following structures : (used for extension and Communication structure)
BAPE_VBAP, BAPE_VBAPX, VBAPKOZ, VBAPKOZX
Append Structure Demo:
VBAP:
BADI Implementation:
T-Code : SE18
Enter the BADI name and click display
Sub Screen Details:
BAPE_VBAP:
VBAPKOZ:
VBAPKOZX:
Expand BADI_SLS_ITEM_SCR_CUS
Right
Click implementation
Below popup will be appeared and click create button.
Enter the enhancement
name, description and press enter .
Enter the package
name and create the Transport request.
Double click on your
enhancement name, below screen will be appeared. Enter the implementation name
, description and class name, then press enter or click tick mark.
Below Screen will be
appeared
Expand BADI
implementation and double click on implementation class which one highlighted
on below screen short.
Double click on
methods and start writing on code like below.
method if_ex_sls_item_scr_cus~activate_tab_page.
data:ls_item_tab like line of ct_cus_item_tab.
ls_item_tab-item_caption = 'Planing Details'. "Tab Description
ls_item_tab-item_program = 'ZDPL_CUS_TAB_SALES_ITEM'. "Program name
ls_item_tab-item_dynpro = '9100'. "Subscreen No
append ls_item_tab to ct_cus_item_tab.
endmethod.
data:ls_item_tab like line of ct_cus_item_tab.
ls_item_tab-item_caption = 'Planing Details'. "Tab Description
ls_item_tab-item_program = 'ZDPL_CUS_TAB_SALES_ITEM'. "Program name
ls_item_tab-item_dynpro = '9100'. "Subscreen No
append ls_item_tab to ct_cus_item_tab.
endmethod.
Note: 1. No need to write any code for data
transfer.
2. Screen should be sub screen.
Result:
Using BAPI
to Update the filed:
BAPE_VBAPX:
Note: Use data element as CHAR1 , don’t use BAPIUPDATE .
Note: Use data element as CHAR1 , don’t use BAPIUPDATE .
Extension Structure
Code:
While updating custom fields through BAPI, need to use below code.
data: bape_vbap type bape_vbap ,
bape_vbapx type bape_vbapx .
bape_vbapx type bape_vbapx .
data: extensionin type table of bapiparex
with header line.
bape_vbap-vbeln = vbeln.
“For creation make it blank (vbeln)
bape_vbap-posnr = posnr.
bape_vbap-zzrunno = runno .
bape_vbap-zzryear = ryear .
bape_vbapx-vbeln = vbeln. “For creation make it blank (vbeln)
bape_vbapx-posnr = posnr.
bape_vbapx-zzrunno = 'X' .
bape_vbapx-zzryear = 'X' .
move 'BAPE_VBAP' to extensionin-structure.
call method cl_abap_container_utilities=>fill_container_c
exporting
im_value = i_bape_vbap
importing
ex_container = extensionin-valuepart1.
append extensionin to extensionin.
move 'BAPE_VBAPX' to extensionin-structure.
move bape_vbapx to extensionin-valuepart1.
append extensionin to extensionin .
bape_vbap-posnr = posnr.
bape_vbap-zzrunno = runno .
bape_vbap-zzryear = ryear .
bape_vbapx-vbeln = vbeln. “For creation make it blank (vbeln)
bape_vbapx-posnr = posnr.
bape_vbapx-zzrunno = 'X' .
bape_vbapx-zzryear = 'X' .
move 'BAPE_VBAP' to extensionin-structure.
call method cl_abap_container_utilities=>fill_container_c
exporting
im_value = i_bape_vbap
importing
ex_container = extensionin-valuepart1.
append extensionin to extensionin.
move 'BAPE_VBAPX' to extensionin-structure.
move bape_vbapx to extensionin-valuepart1.
append extensionin to extensionin .
is this possible to add in the table control? TCTRL_U_ERF_AUFTRAG
ReplyDeleteThank you very much for very interesting tutorial
ReplyDeletePlease describe in detail "Extension Structure Code". Where must it be implemented? How to read the order number and the data of additional fields to pass to the structures bape_vbap and bape_vbapx?
Best regards
Yuriy
(ABAP beginners)
Dear Vaigunda raja,
ReplyDeleteGood Tutorial with clear explanation, it helped a lot.
Thanks
Karthe
Is it possible to add one more tab by using above activity.
ReplyDeleteThanks for share!!!
ReplyDelete