How to update VBAK or VBAP after creating custom fields?



I assume that you already appended structure to your vbak structure.

The solution below already exists for VBAP cases.

I will works if you will replace all ‘VBAK’ with ‘VBAP’.

Firstly, you have to append our fields on BAPE_VBAK and BAPE_VBAKX.

Then, you should check that VBAKKOZ and VBAPKOZX structures

have the custom field that you have added.

If all these requirements are met, you should write the code before calling BAPI.

data ls_extensionin like bapiparex,

       lt_extensionin like bapiparex occurs 0.

       

 

data bape_vbak  like bape_vbak,

       bape_vbakx like bape_vbakx.

 

bape_vbakvbeln            contract_no.

bape_vbak(custom field)  (value) .

ls_extensioninstructure ‘BAPE_VBAK’.

move bape_vbak  to   ls_extensioninvaluepart1.

append ls_extensionin to lt_extensionin.

 

bape_vbakxvbeln          ‘X’.

bape_vbakx(custom_field) ‘X’.

 

ls_extensioninstructure  ‘BAPE_VBAKX’.

move bape_vbakx  to   ls_extensioninvaluepart1.

append ls_extensionin to lt_extensionin.

 

call function ‘BAPI_CONTRACT_CREATEFROMDATA’

    exporting

      salesdocumentin         contract_no

      contract_header_in      ls_order_header_in

      contract_header_inx     ls_order_header_inx

      logic_switch            gw_so_logic_switch

   importing

      salesdocument           contract_no

    tables

      return                  lt_return

      contract_items_in       lt_order_items_in

      contract_items_inx      lt_order_items_inx

      contract_partners       lt_order_partners

      contract_conditions_in  lt_order_conditions_in

      contract_conditions_inx lt_order_conditions_inx

      contract_data_in        lt_contract_data_in

      contract_data_inx       lt_contract_data_inx

      extensionin             lt_extensionin.

  call function ‘BAPI_TRANSACTION_COMMIT’

    exporting

      wait .

Leave a comment

Your email address will not be published. Required fields are marked *