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

Problem with BAPI_SALESORDER_CREATEFROMDAT2

Former Member
0 Likes
1,211

Hi !!!

I have a problem with the BAPI_SALESORDER_CREATEFROMDAT2

I execute this successfully, this generate a sales document. When i check the sales order, the DELEIVERY DATE does not appear.

I fill the corresponding fields DELIVERY DATE in both

structures:

ORDER_ITEMS_IN STRUCTURE BAPISDITM OPTIONAL

ORDER_ITEMS_INX STRUCTURE BAPISDITMX OPTIONAL

I am filling ....

structures ORDER_SCHEDULES_IN and ORDER_SCHEDULES_INX.

ORDER_SCHEDULES_IN-itm_number = 10.

ORDER_SCHEDULES_IN-dlv_date = 20051503.

APPEND ORDER_SCHEDULES_IN.

ORDER_SCHEDULES_INX-itm_number = 'X'.

ORDER_SCHEDULES_INX-dlv_date = 'X'.

APPEND ORDER_SCHEDULES_INX.

Regards,

Kunal

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
877

What is this date.......


20051503

shouldn't it be


20050315

I was under the impression that SAP stores all dates internally as YYYYMMDD

Try this line of code.



ORDER_SCHEDULES_IN-dlv_date = '20050315'.

Make sure the value is in quotes.

Regards,

Rich Heilman

Message was edited by: Rich Heilman

6 REPLIES 6
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
878

What is this date.......


20051503

shouldn't it be


20050315

I was under the impression that SAP stores all dates internally as YYYYMMDD

Try this line of code.



ORDER_SCHEDULES_IN-dlv_date = '20050315'.

Make sure the value is in quotes.

Regards,

Rich Heilman

Message was edited by: Rich Heilman

Read only

0 Likes
877

Hi,

That was a typo error ... the fields are

ORDER_SCHEDULES_IN-dlv_date = '20050516'.

But the Schedule date in the sales order doesn't get filled with this date it is getting filled with today's date ...

Kunal

Read only

0 Likes
877

Are you sure that you don't need the SCHED_LINE field filled in?

ORDER_SCHEDULES_IN = SCHED_LINE = '0001'.

Regards,

Rich Heilman

Read only

0 Likes
877

Hi,

I am posting the code which i have written ...

wa_sch_in-itm_number = lv_itemno.

wa_sch_in-SCHED_LINE = lv_itemno.

wa_sch_in-req_qty = wa_items_in-target_qty.

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

date_external = wa_vbak_temp-erdat

IMPORTING

date_internal = wa_sch_in-dlv_date

EXCEPTIONS

date_external_is_invalid = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

APPEND wa_sch_in TO i_sch_in.

CLEAR wa_sch_inx.

wa_sch_inx-itm_number = 'X'.

wa_sch_inx-sched_line = 'X'.

wa_sch_inx-req_qty = 'X'.

wa_sch_inx-dlv_date = 'X'.

APPEND wa_sch_inx TO i_sch_inx.

CLEAR wa_vbak_temp.

ENDLOOP."LOOP AT i_vbak INTO wa_vbak_temp

CLEAR w_sales_doc.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

  • SALESDOCUMENTIN =

order_header_in = wa_header_in

  • ORDER_HEADER_INX =

  • SENDER =

  • BINARY_RELATIONSHIPTYPE =

  • INT_NUMBER_ASSIGNMENT =

  • BEHAVE_WHEN_ERROR =

  • LOGIC_SWITCH =

  • TESTRUN =

  • CONVERT = ' '

IMPORTING

salesdocument = w_sales_doc

TABLES

return = i_return

order_items_in = i_items_in

ORDER_ITEMS_INX = i_items_inx

order_partners = i_partner

order_schedules_in = i_sch_in

order_schedules_inx = i_sch_inx

  • ORDER_CONDITIONS_IN =

  • ORDER_CONDITIONS_INX =

  • ORDER_CFGS_REF =

  • ORDER_CFGS_INST =

  • ORDER_CFGS_PART_OF =

  • ORDER_CFGS_VALUE =

  • ORDER_CFGS_BLOB =

  • ORDER_CFGS_VK =

  • ORDER_CFGS_REFINST =

  • ORDER_CCARD =

  • ORDER_TEXT =

  • ORDER_KEYS =

  • EXTENSIONIN =

  • PARTNERADDRESSES =

.

Hope u can help me now , as u see i am sending the sched_line,itm_number,req_qty,dlv_date and also the corresponding order_schedules_inx values but still not getting the correct delivery date value in the sales order.

Kunal

Read only

0 Likes
877

Just curious, Try filling the REQ_DATE field instead.

ORDER_SCHEDULES_IN-REQ_DATE = '20050516'.


ORDER_SCHEDULES_IN-REQ_DATE = 'X'.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
877

I have been using this BAPI for quite a while now with no problems.

I now require to put a different address on the order to the customer master data. However when I put the data in the partner function table of this BAPI it populates all the fields on SAP but not NAME3 field for some reason.

Anyone know of any problems like this ?