BADI : BADI_SLS_HEAD_SCR_CUS
Add field in
following Table : VBAK
Add field in
following structures : (used
for extension and Communication structure)
BAPE_VBAK, BAPE_VBAKX, VBAKKOZ, VBAKKOZX
VBAK:
BADI Implementation:
T-Code : SE18
Enter the BADI name
and click display
Expand BADI_SLS_HEAD_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_head_scr_cus~activate_tab_page.
data:ls_head_tab like line of ct_cus_head_tab.
ls_head_tab-head_caption = 'DPL Custom Fields'. “Tab Description
ls_head_tab-head_program = 'ZDPL_CUS_TAB_SALES_ORDER'. “Program name
ls_head_tab-head_dynpro = '9000'. “Sub Screen Name
append ls_head_tab to ct_cus_head_tab.
endmethod.
Note: 1. No need to write any code for data transfer.
2. Screen should be sub screen.
Sub Screen Details:
Result:
Using BAPI to Update the filed:
BAPE_VBAK:
VBAKKOZ:
BAPE_VBAKX:
Note: Use data element as CHAR1 , don’t use BAPIUPDATE .
VBAKKOZX:
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_vbak type bape_vbak ,
bape_vbakx type bape_vbakx .
data: extensionin type table of bapiparex
with header line.
bape_vbak-vbeln = vbeln. “For creation make
it blank (vbeln)
bape_vbak-posnr = posnr .
bape_vbak-zzpo_number = ponum .
bape_vbak-zzgrpid = grpid .
bape_vbakx-vbeln = vbeln. “For creation make
it blank (vbeln)
bape_vbakx-posnr = posnr.
bape_vbakx-zzpo_number = 'X' .
bape_vbakx-zzgrpid = 'X' .
move 'BAPE_VBAK' to extensionin-structure.
call method cl_abap_container_utilities=>fill_container_c
exporting
im_value = i_bape_vbak
importing
ex_container = extensionin-valuepart1.
append extensionin to extensionin.
move 'BAPE_VBAKX' to extensionin-structure.
move bape_vbakx to extensionin-valuepart1.
append extensionin to extensionin .