Application Development 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: 

item text element in BAPI_SALESORDER_CREATEFROMDAT2

tanuja_wa
Explorer
0 Kudos

Hi all,

I have created a ABAP-Program to create sales-orders with the function module:

BAPI_SALESORDER_CREATEFROMDAT2

I am not able to create text-elements (from the item) with this bapi.

Can anybody help me?

3 REPLIES 3

Former Member
0 Kudos

Hi,

with the BAPI we can't load the Texts. Use the FMs SAVE_TEXT or CREATE_TEXT to load the texts.

Thanks,

Rajinikanth

Former Member
0 Kudos

Are your Customization in place ? Try to create TEXT via VA01.If you are able to then can u copy paste the code. Also you can try SD_SALESDOCUMENT_CREATE.

Regards

Saket Sharma

Former Member
0 Kudos

Say for example you have all details in an internal table t_sales_text and t_sales_header.

For doing this you should know the Text ID.

LOOP AT t_sales_text WHERE ind = t_sales_header-ind.

IF t_sales_text-itm_number not initial.

MOVE t_sales_text-itm_number TO wa_bapi_text-itm_number.

ENDIF.

IF t_sales_text-text_id not initial.

MOVE t_sales_text-text_id TO wa_bapi_text-text_id.

ENDIF.

MOVE sy-langu TO wa_bapi_text-langu.

IF t_sales_text-text_line not initial.

MOVE t_sales_text-text_line TO wa_bapi_text-text_line.

ENDIF.

APPEND wa_bapi_text TO t_bapi_text.

CLEAR wa_bapi_text.

ENDLOOP.

after appending the records to t_bapi_text, pass this table to the BAPI.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

order_header_in = wa_bapi_header

order_header_inx = wa_bapi_header_inx

IMPORTING

salesdocument = w_vbeln

TABLES

return = t_return

order_items_in = t_bapi_items

order_items_inx = t_bapi_item_inx

order_partners = t_bapi_partner

order_schedules_in = t_bapi_schedule

order_schedules_inx = t_bapi_schedule_inx

order_text = t_bapi_text.