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: 

Issue with BAPI_SALESORDER_CHANGE

shishupalreddy
Active Contributor
0 Kudos

hI ,

I am trying to add line items to the exising sales orders based on some conditions using

BAPI_SALESORDER_CHANGE

but it is populating

"ENter the Sales Document Number " as error message into RETURN table .

Please let me know the reason for this message

Urgent !!!!!

Thanks

19 REPLIES 19

Former Member
0 Kudos

Can you show your code? You may not be passing sales order number correctly.

Regards,

Atish

0 Kudos

Hi ,

Please see the code below .

order_number = l_t_final-vbeln.

flag-UPDATEFLAG = 'U'.

  • Item-ITM_NUMBER =

orderheader-SALES_ORG = xvbak-vkorg.

orderheader-DISTR_CHAN = xvbak-vtweg.

orderheader-DIVISION = xvbap-spart .

append orderheader .

item-HG_LV_ITEM = l_t_final-uepos.

item-MATERIAL = l_t_final-matnr.

item-PLANT = l_t_final-werks.

item-SHIP_POINT = l_t_final-vstel.

append item.

check_fld-UPDATEFLAG = 'X'.

CHECK_FLD-HG_LV_ITEM = 'X'.

check_fld-MATERIAL = 'X'.

CHECK_FLd-PLANT = 'X'.

CHECK_FLD-STORE_LOC = 'X'.

CHECK_FLD-SHIP_POINt = 'X'.

append check_fld.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = order_number

ORDER_HEADER_IN = orderheader

order_header_inx = flag

  • SIMULATION =

  • BEHAVE_WHEN_ERROR = ' '

  • INT_NUMBER_ASSIGNMENT = ' '

  • LOGIC_SWITCH =

tables

return = return

ORDER_ITEM_IN = item

ORDER_ITEM_INX = check_fld

  • PARTNERS =

  • PARTNERCHANGES =

  • PARTNERADDRESSES =

  • ORDER_CFGS_REF =

  • ORDER_CFGS_INST =

  • ORDER_CFGS_PART_OF =

  • ORDER_CFGS_VALUE =

  • ORDER_CFGS_BLOB =

  • ORDER_CFGS_VK =

  • ORDER_CFGS_REFINST =

  • SCHEDULE_LINES =

  • SCHEDULE_LINESX =

  • ORDER_TEXT =

  • ORDER_KEYS =

  • CONDITIONS_IN =

  • CONDITIONS_INX =

  • EXTENSIONIN =

.

Please give me some input on this

thanks

0 Kudos

refer below thread. You will get sample coding for this BAPI

Regards,

Atish

0 Kudos

I did the same thing even it is giving 'Enter Sales Order Number ' ....into BAPIRETURN table

Earliest help is appreciated .

Urgent !!!!

Thanks

0 Kudos

Hi,

Change the update flag as 'I' in item flag structure to add new items in sales order and check the result. Also note that you have to specify the quantity when adding new items.

Regards

Eswar

0 Kudos

Hi,

I provided all the detials but still it is giving the same error

" enter the sales order number "

get me appropriate solution

thanks

Former Member
0 Kudos

Hi

Put a break point before calling the BAPi and check whether the value of the document is avaialable during the period

Regards

Shiva

former_member186099
Contributor
0 Kudos

Hi ,

Before Calling the BAPI_SALESORDER_CHANGE bapi please check whether there are lagging zeros for your sales order number if not appned the lagging zeros.

Thanks ,

J.Prasanna

0 Kudos

hi ,

document number has all the zeros , but still it is giving the same error

please provide me the solution.....

thanks,

former_member186099
Contributor
0 Kudos

Hi,

field check_fld-updateflag should have the value 'I' if you are inserting the new item to the sales order. But u r using 'X' in ur code so please change it to 'I' and check it once.

NOTE:

Controls processing functions with the value in the UPDATEFLAG field (change indicator).

The following entries are available:

' ': Create a new sales document item

I: Create a new sales document item

U: Change an existing sales document item

😧 Delete an existing sales document item

check_fld-UPDATEFLAG = 'X'. (Instead use check_fld-UPDATEFLAG = 'I')

CHECK_FLD-HG_LV_ITEM = 'X'.

check_fld-MATERIAL = 'X'.

CHECK_FLd-PLANT = 'X'.

CHECK_FLD-STORE_LOC = 'X'.

CHECK_FLD-SHIP_POINt = 'X'.

append check_fld.

Reward points if the sol;ution is helpfull

Thanks,

J.Prasanna

Former Member
0 Kudos

Hi,

Please find some points below:

You can use this method to change or delete sales orders.

You can change header, item, schedule line and configuration data.

In general, note that you should:

Only specify fields that should be changed

Select these fields by entering an X in the checkboxes

Enter a U in the UPDATEFLAG field

Always specify key fields when changing the data, including in the checkboxes

The configuration is an exception here. If this needs to be changed, you need to complete it again fully.

Maintain quantities and dates in the schedule line data

Possible UPDATEFLAGS:

U = change

D = delete

I = add

Example

Delete the whole order

Delete order items

Change the order

Change the configuration

Notes

Minimum entry:

You must enter the order number in the SALESDOCUMENT structure.

You must always enter key fields for changes.

You must always specify the update indicator in the ORDER_HEADER_INX.

Commit control:

The BAPI does not run a database Commit, which means that the application must trigger the Commit so that the changes are read to the database. To do this, use the BAPI_TRANSACTION_COMMIT BAPI.

Since you are adding the line items, your update flag must be set to 'I' in both the places.

Change the update flag to 'I' and try again. Plz let me know if u still have issues.

Regards,

Asif Ali Khan

0 Kudos

Hi ,

I changes the updateflag to 'I' but still it is giving the below message

Field header_inx-updateflagI is not an input field

any help is appreciated

former_member186099
Contributor
0 Kudos

Hi,

keep the header level update flag as 'U' and item level header flag as 'I'. and also enter all the key fields at the header level and also at item level.

Let me know if there are any new errors.

Thanks,

Prasanna

Former Member
0 Kudos

Hi Reddy,

Actually you are not passing the fields for Updation in ORDER_HEADER_INX structure.

Please find the code below:

FLAG- UPDATEFLAG = 'U'.

FLAG - SALES_ORG = 'X'.

FLAG - DISTR_CHAN = 'X'.

FLAG - DIVISION = 'X'.

APPEND FLAG.

In Item details also follow the same logic.

Since you are adding the line items you should keep the flag as 'I'.

CHECK_FLD-UPDATEFLAG = 'I'.

CHECK_FLD-HG_LV_ITEM = 'X'.

check_fld-MATERIAL = 'X'.

CHECK_FLd-PLANT = 'X'.

CHECK_FLD-STORE_LOC = 'X'.

CHECK_FLD-SHIP_POINt = 'X'.

append check_fld.

Hope this answers your question.

Regards,

Asif

0 Kudos

Hi ,

Thanks for the quick replies ...

I am passing as u said . but it is triggering *Enter Sales Order Number * once BAPI gets into

call function 'SD_SALES_DOCUMENT_READ' function module .

Thanks and greatfull to the solutions

Former Member
0 Kudos

Hi reddy,

You may also use this FM.

CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'

EXPORTING

SALESDOCUMENT = SALESDOCUMENT

ORDER_HEADER_IN = DA_ORDER_HEADER_IN

ORDER_HEADER_INX =

TABLES

RETURN = RETURN

ITEM_IN = DA_ORDER_ITEM_IN

ITEM_INX = DA_ORDER_ITEM_INX

SCHEDULE_IN = SCHEDULE_LINES

SCHEDULE_INX = SCHEDULE_LINESX

partners = partners

partnerchanges = partnerchanges

partneraddresses = partneraddresses

CONDITIONS_IN = CONDITIONS_IN

CONDITIONS_INX = CONDITIONS_INX

SALES_CFGS_REF = ORDER_CFGS_REF

SALES_CFGS_INST = ORDER_CFGS_INST

SALES_CFGS_PART_OF = ORDER_CFGS_PART_OF

SALES_CFGS_VALUE = ORDER_CFGS_VALUE

SALES_CFGS_BLOB = ORDER_CFGS_BLOB

sales_cfgs_vk = order_cfgs_vk

sales_cfgs_refinst = order_cfgs_refinst

SALES_TEXT = ORDER_TEXT

SALES_KEYS = ORDER_KEYS

EXTENSIONIN = EXTENSIONIN.

0 Kudos

thanks for the reply ..

still i am gettig the same error , ENTER THE SALES DOCUMENT NUMBER .

pLEASE Provide me the solution very urgent

0 Kudos

Hi reddy,

Plz check:

1. whether the order number u r passing exists.

2. In Debugging mode whether order number that is passed to BAPI is initial or not.

0 Kudos

Hi,

I am passing the order number which is existing one and anyhow i am also checking that order is initial or not .

I am using BAPI_SALESORDER_CHANGE fm to add additional line to the existing sales order based on some conditions with in user exit , but it is always giving

ENTER THE DOCUMENT NUMBER error populatin into RETURN table .

*Once SD_SLESDOCUMENT_CHANGE executed within the BAPI , it is populating the error message

ENTER THE document number .*

Can anybody throw some light on this Thread and provide me the solution .

Helpfull answeres will be given Reward Points without fail .

Edited by: shishupalreddy ramreddy on Feb 20, 2008 6:16 PM

Edited by: shishupalreddy ramreddy on Feb 20, 2008 6:34 PM