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

SD_SALESDOCUMENT_CREATE problem

Former Member
0 Likes
2,017

Hi Experts,

we are calling SD_SALESDOCUMENT_CREATE to create Sales order in back ground and it is working, but some times this function module returning SY-SUBRC 0 with out Creating Sales Order Document( ibapivbeln retuns has empty value) and also retun table does not contain any error message ( Type 'E' ).

call function 'SD_SALESDOCUMENT_CREATE'

sales_header_in = sohdr

sales_header_inx = sohdrx

importing

salesdocument_ex = so_vbeln

tables

return = itret2

sales_items_in = itsoitm

sales_items_inx = itsoitmx

sales_partners = itparnr

sales_schedules_in = itschdl

sales_schedules_inx = itschdlx

sales_conditions_in = itcond

sales_conditions_inx = itcondx

sales_text = isotext

partneraddresses = itparadr.

if sy-subrc eq 0 and not so_vbeln is initial.

else.

loop at itret2.

lv_text = itret2-message

perform bulid_ret_msg using lv_text.

endloop.

delete itret2 where type ne 'E'.

lv_text = 'Creating Sales Doc Failed.

perform bulid_ret_msg using lv_text.

endif.

some times it executes ELSE statements and returns 'Creating Ssales Doc Failed'.

Please help.

Thanks

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,378

Read and implement OSS [Note 1012581 - Document is not saved|https://service.sap.com/sap/support/notes/1012581]

Information messages are regarded as errors in function module SD_SALES_DOCU_MAINTAIN.

Also when reading return table select error 'E' and abort 'A' message types.

Regards,

Raymond

3 REPLIES 3
Read only

Former Member
0 Likes
1,378

Hi,

Instead of checking sy-subrc, do the below checking.

read table return with key type = 'E'.
      if sy-subrc = 0.
        "Sales order not Created"
      else.
        "Sales Order Created"
      endif.

Regards

Vinod

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,379

Read and implement OSS [Note 1012581 - Document is not saved|https://service.sap.com/sap/support/notes/1012581]

Information messages are regarded as errors in function module SD_SALES_DOCU_MAINTAIN.

Also when reading return table select error 'E' and abort 'A' message types.

Regards,

Raymond

Read only

0 Likes
1,378

Thanks All