06-18-2008 12:31 PM
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?
06-18-2008 12:35 PM
Hi,
with the BAPI we can't load the Texts. Use the FMs SAVE_TEXT or CREATE_TEXT to load the texts.
Thanks,
Rajinikanth
06-18-2008 12:39 PM
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
06-18-2008 12:41 PM
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.