‎2011 Jul 11 7:20 PM
Hi Experts,
Am using BAPI_SALEORDER_CHANGE to update the two Custom fields,
Below added components in BAPE_VBAP
1.ZZSERIALNO ZZSERIALNO CHAR 18
2.ZZKNO ZZKNO CHAR 30
Below added components in BAPE_VBAPX
1.ZZSERIALNO BAPIUPDATE CHAR 1
2.ZZKNO BAPIUPDATE CHAR 1
In Table VBAP, the two custom fields are appended with name ZAVBAP as structure.
Below is my existing code:
data:return type bapiret2 occurs 0 with header line,
order_item_in type bapisditm occurs 0 with header line,
order_item_inx type bapisditmx occurs 0 with header line,
conditions_in type bapicond occurs 0 with header line,
conditions_inx type bapicondx occurs 0 with header line,
i_extensionin type table of bapiparex.
data:k_extensionin type bapiparex,
k_bape_vbap type bape_vbap,
k_bape_vbapx type bape_vbapx.
constants: c_bape_vbap(9) value 'BAPE_VBAP',
c_bape_vbapx(10) value 'BAPE_VBAPX',
c_flag_x(1) value 'X'.
Code to append the structure and internal table I_extension
k_bape_vbap-vbeln = wa_vbap-vbeln.
k_bape_vbap-posnr = wa_vbap-posnr.
k_bape_vbap-zzserialno = wa_vbap-zzserialno.
k_bape_vbap-zzkno = wa_vbap-zzkno.
k_extensionin-structure = c_bape_vbap.
k_extensionin+30 = k_bape_vbap.
append k_extensionin to i_extensionin.
clear k_extensionin.
k_bape_vbapx-vbeln = wa_vbap-vbeln..
k_bape_vbapx-posnr = wa_vbap-posnr.
k_bape_vbapx-zzserialno = c_flag_x.
k_bape_vbapx-zzkno = c_flag_x.
k_extensionin-structure = c_bape_vbapx.
k_extensionin+30 = k_bape_vbapx.
append k_extensionin to i_extensionin.
clear k_extensionin.
BAPI FM called and value passed as below:
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = wa_vbap-vbeln
order_header_inx = order_header_inx
tables
return = return
order_item_in = order_item_in
order_item_inx = order_item_inx
conditions_in = conditions_in
conditions_inx = conditions_inx
extensionin = i_extensionin.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
My ISSUE:
1. The two custom field is not getting updated through extension
2. Please suggest if there needs to be any code change.
3. This is real time issue, I hope many faced the same prob and got it solved.
Thank you all in Advance!!!
Regards,
Vishwa
‎2011 Jul 11 9:04 PM
‎2011 Jul 12 4:38 AM
‎2011 Jul 12 9:22 AM
Thanks for your reply Madhu!
Can you please suggest me the right way to solve this issue since am handling the VBAP table alone and also I didnt appended the two custom fields to the structure VBAPKOZ and to structure VBAPKOZX. If i append the two ZZ fields to both these structure then how should i build the code.
Please help me out here!!!!!!!
Thanks!
Regards,
Vishwa
‎2011 Jul 12 9:27 AM
Hi Vishwa,
Please check this.
*
DATA: wa_extensionin TYPE bapiparex,
wa_bape_vbap TYPE bape_vbap,
wa_bape_vbapx TYPE bape_vbapx,
wa_bape_vbak TYPE bape_vbak,
wa_bape_vbakx TYPE bape_vbakx,
lv_posnr TYPE posnr.
header extension
CLEAR wa_bape_vbak.
wa_bape_vbak-ZZFIELD = 'HeaderDRTEST'.
wa_extensionin-structure = 'BAPE_VBAK'.
wa_extensionin+30(960) = wa_bape_vbak.
append wa_extensionin to lt_extensionin.
clear wa_extensionin.
Processing the line extension
LOOP AT line_items INTO wa_lineitems.
ADD 10 TO lv_posnr.
CLEAR wa_bape_vbap.
wa_bape_vbap-ZZFIELD = 'item'.
wa_extensionin-structure = 'BAPE_VBAP'.
wa_bape_vbap-posnr = lv_posnr.
wa_extensionin+30(960) = wa_bape_vbap.
append wa_extensionin to lt_extensionin.
clear wa_extensionin.
CLEAR wa_bape_vbapx.
wa_bape_vbapx-ZZFIELD = 'X'.
wa_extensionin-structure = 'BAPE_VBAPX'.
wa_bape_vbapx-posnr = lv_posnr.
wa_extensionin+30(960) = wa_bape_vbapx.
append wa_extensionin to lt_extensionin.
clear wa_extensionin.
ENDLOOP.
Regards,
Madhu.
Edited by: madhurao123 on Jul 12, 2011 1:58 PM
‎2011 Jul 12 10:11 AM
Hi Madhu,
Actually I dindt add any Z fields to structure BAPE_VBAK and BAPE_VBAKX, why because my requirement is to update the line item Z fileds under SO Additional data B.
Thanks!
Vishwa
‎2011 Jul 12 10:43 AM
Hi Vishwa,
Thant is fine.Here we are not adding any new fields. Here we added custom fields to vbap (Item ) table.We are updating those fields.Post if i am wrong.I think your requirement is to update custom fields using bapi.
In case only updation of those fields .
Add the custom field in VBAP through append structure
Modify the screen 8459 of SAPMV45A to add your custom fields
Write the logic in subroutine 'USEREXIT_MOVE_FIELD_TO_VBAP' of include MV45AFZZ to populate the value.
In both of subroutine global internal table and structures are available,where you can pass the values.
Regards,
Madhu.
Edited by: madhurao123 on Jul 12, 2011 3:15 PM