Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_PO_CHANGE Extensionin problem

Former Member
0 Likes
2,557

Hi Experts,

i'm tryng to assign the structure bapi_te_mepoheader at extensionin in this way:

MOVE-CORRESPONDING pt_ifile TO s_bapi_te_mepoheader.

pt_extensionin-valuepart1 = s_bapi_te_mepoheader.

pt_extensionin-structure = 'BAPI_TE_MEPOHEADER'.

but it return error: "pt_extensionin-valuepart1 and s_bapi_te_mepoheader are not mutually convertible in a Unicode program" so i tried with a concatenate:

CONCATENATE pt_ifile-ebeln wa_field-zzsaiso wa_field-zzsaisj ..[etc]...INTO valuepart RESPECTING BLANKS.

but the QUAN and CURR data field types give me problems of irregular shifting of fields.

How can i solve this problem?

thanks in advance,

Cosimo.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,803

The structures for both are not same... check once..

The structures for both are not same... check once..

3 REPLIES 3
Read only

madhu_vadlamani
Active Contributor
0 Likes
1,803

Hi Cosimo,

Check like this and do for that bapi.

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.

  • Processing the header extension

CLEAR wa_bape_vbak.

wa_bape_vbak-ZZFIELD = 'TEST'.

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 = 'TET'.

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.

  • Then the call to the BAPI

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

order_header_in = ls_order_header_in

order_header_inx = ls_order_header_inx

IMPORTING

salesdocument = lv_salesdocument

TABLES

return = lt_ret2

order_items_in = lt_order_items_in

order_items_inx = lt_order_items_inx

order_partners = lt_order_partners

order_keys = lt_order_keys

extensionin = lt_extensionin.

Note: If you have a need to force a different Business Object type or wish to see the extension return fields then use the function SD_SALESDOCUMENT_CREATE instead.

CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'

EXPORTING

sales_header_in = ls_order_header_in

sales_header_inx = ls_order_header_inx

business_object = 'BUS2032'

IMPORTING

salesdocument_ex = lv_salesdocument

sales_header_out = lv_sales_header_out

sales_header_status = lv_sales_header_status

TABLES

return = lt_ret2

sales_items_in = lt_order_items_in

sales_items_inx = lt_order_items_inx

sales_partners = lt_order_partners

sales_keys = lt_order_keys

extensionin = lt_extensionin

incomplete_log = lt_incomplete_log

extensionex = lt_extensionex.

Check this i did for sales order.

Regards,

Madhu.

Moderator message: copy/pasted from previous discussions, please do not repeat, or your user ID might get deleted!

Edited by: Thomas Zloch on Sep 14, 2011 1:07 PM

Hi Thomas,

Hi,

Actually this code i got from erpgenie.com and i implemented that in my system.If there is any issue related to extension i am giving this code.This is not just copy and paste.I already answered related to extension three to four times.If it wrong giving code then it wont repeat.

Edited by: madhurao123 on Sep 14, 2011 5:03 PM

Read only

Former Member
0 Likes
1,804

The structures for both are not same... check once..

Read only

Former Member
0 Likes
1,803

Now it work,

thanks so much for your answers.

Cosimo.

Edited by: Kosimo on Sep 13, 2011 9:15 AM