Pages

Wednesday, 13 April 2016

BADI Add Header Tab Custom Fields 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

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 .


16 comments:

  1. Thank you ! nice post. is this BADI is available in release 710 and EHP level is 3.0..

    Thnks
    sandeep

    ReplyDelete
  2. I've a question. How do you show your new tabstrip from main window in VA01/VA02 -> GoTo>Header>Other Functions?? Is it possible?

    ReplyDelete
  3. This badi is not available in my system, Can I add additional field use of customer exit in CMOD, means not additional tab will come but if i will enter sold to party then that custom screen field popup window should be come automitacaly, is this possible ? or any exits are there in SAP for that

    ReplyDelete
  4. sir how to create subscreen 9000? i cant able to navigate if i double click on th

    ReplyDelete
  5. Hi Raja,
    With this approach, incompletion log is not working as expected when the Z fields are configured in OVA2. Can you please suggest

    ReplyDelete
  6. Where we need to write the VBAK table update logic. (enahncement or module pool program or in custom badi)

    ReplyDelete
  7. Hi Raja,

    Is it possible for adding extra column/field for existing tab(Ex: VA01 Header's partners tab, add PAN number or Aadhar number).

    Please let me know, if its possible without access key or not.


    Thanks,
    Syed Abbas.

    ReplyDelete
  8. sir kindly explain how to create sub screen 9000.

    ReplyDelete
  9. i have done same steps for header tab and item tab as well. all works absolutely fine in manual creation from VA01/02/03. thanks for this .
    but when i use bapi BAPI_SALESORDER_CREATEFROMDAT2 exception is raised.
    CX_SY_RANGE_OUT_OF_BOUNDS occurred.

    Any thing i need to do for BAPI ?

    ReplyDelete
  10. i have done same steps for header tab and item tab as well. all works absolutely fine in manual creation from VA01/02/03. thanks for this .
    but when i use bapi BAPI_SALESORDER_CREATEFROMDAT2 exception is raised.
    CX_SY_RANGE_OUT_OF_BOUNDS occurred.

    Any thing i need to do for BAPI ?

    ReplyDelete
  11. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts Call Paging System | Customer Call Paging Systems | Customer Order Display

    ReplyDelete
  12. This is the best article for SAP which I have seen and it's absolutely great stuff on SAP. Thanks for such a cool article about SAP topics. Very good explanation on SAP concepts we do SAP Training in Chennai for all SAP Modules.
    Regards,
    SAP Training Institutes in Chennai | Best SAP Training in Chennai

    ReplyDelete