Added additional header TAB with Custom Fields in Sale Order using BADI in VA01,VA02,VA03 ( Sales Order ) with BAPI Extension

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
Append Structure Demo:

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 screenshot.

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.

Remaining methods need to be activated like below



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 field:

BAPE_VBAK:

VBAKKOZ:

BAPE_VBAKX:

Note:  Use data element as CHAR1 , don’t use BAPIUPDATE .

VBAKKOZX:

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.

Share this

Related Posts

2 comments

comments
9 March 2019 at 21:59 delete

do we have to create implementing class in se24

Reply
avatar
6 April 2020 at 14:51 delete

How does the data from our custom tab or custom screen 9000 would pass to standard vbak structure ??

Reply
avatar