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 updating LGORT

Former Member
0 Likes
2,356

Hi,

I am using BAPI_SALESORDERCHANGE to update the material of a sales order.

When I change the material, the storage location has to change also.

So I call my bapi with these lines :

  s_order_item_in-itm_number   = [posnr].  

  s_order_item_inx-itm_number = [posnr]. 

  s_order_item_in-material    = [matnr]
  s_order_item_inx-material   = 'X'. 

  s_order_item_in-plant       = [werks]. 

  s_order_item_inx-plant      = 'X'.  

  s_order_item_in-ship_point  = [vstel]. 

  s_order_item_inx-ship_point = 'X'. 

  s_order_item_in-store_loc   = [lgort]. 

  s_order_item_inx-store_loc  = 'X'. 

The material and the ship point are changed successfully.

But sometimes, according to the material, the storage location is set to blank.

If I call the BAPI another time it works. LGORT is changed to the value I want.

    -  s_order_item_in-store_loc was NEVER blank

    -  MARC-LGPRO is not blank for this matnr / werks

I noticed that on VA33, when I put this particular material, the storage location is not copied from MARC-LGPRO but is also set to blank.

(Then I can change it before saving va33 - and it works)

Using the BAPI : when I change the material to this particular material,

the blank value seems to be more important to SAP that the value I put in s_order_item-store_loc.

Does anybody know / guess what is happening ?

And could anybody give me a better solution that calling the BAPI_SALESORDERCHANGE twice ?

Thanks a lot !

JC

Message was edited by: JC MARTIN

Hi,

I am using BAPI_SALESORDERCHANGE to update the material of a sales order.

When I change the material, the storage location has to change also.

So I call my bapi with these lines :

  s_order_item_in-itm_number   = [posnr].  

  s_order_item_inx-itm_number = [posnr]. 

  s_order_item_in-material    = [matnr]
  s_order_item_inx-material   = 'X'. 

  s_order_item_in-plant       = [werks]. 

  s_order_item_inx-plant      = 'X'.  

  s_order_item_in-ship_point  = [vstel]. 

  s_order_item_inx-ship_point = 'X'. 

  s_order_item_in-store_loc   = [lgort]. 

  s_order_item_inx-store_loc  = 'X'. 

The material and the ship point are changed successfully.

But sometimes, according to the material, the storage location is set to blank.

If I call the BAPI another time it works. LGORT is changed to the value I want.

    -  s_order_item_in-store_loc was NEVER blank

    -  MARC-LGPRO is not blank for this matnr / werks

I noticed that on VA33, when I put this particular material, the storage location is not copied from MARC-LGPRO but is also set to blank.

(Then I can change it before saving va33 - and it works)

Using the BAPI : when I change the material to this particular material,

the blank value seems to be more important to SAP that the value I put in s_order_item-store_loc.

Does anybody know / guess what is happening ?

And could anybody give me a better solution that calling the BAPI_SALESORDERCHANGE twice ?

Thanks a lot !

JC

Message was edited by: JC MARTIN

7 REPLIES 7
Read only

Former Member
0 Likes
1,383

Hi Martin,

I hope you are using  "BAPI_SALESORDER_CHANGE" BAPI not this BAPI "BAPI_SALESORDERCHANGE" ?

Are you change multiple sales documents within a loop using the BAPI_SALESORDER_CHANGE ?

if 'Yes' then Check this "Note 1024902 - BAPI call of BAPI_SALESORDER_CHANGE in a loop"

also Pass "s_order_item_inx-UPDATEFLAG" = 'U' .

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

Regard's

Smruti


Read only

0 Likes
1,383

Hi,

You're right, BAPI_SALESORDERCHANGE doesnt exist

I didnt forget to put s_order_item_inx-updateflag = 'U',

and that's why my BAPI usually works

It's only this particular material that leads to something strange when I save (SAP not considering the value I put in LGORT)

Read only

Former Member
0 Likes
1,383

Hi Martin,

Are you passing a 'U' in the ORDER_ITEM_INX-Update Flag?

Make sure you are passing Space to 'Simulation Mode' as well.

Read only

Former Member
0 Likes
1,383

Hi Martin,

I think you have to pass the Schedule lines information to BAPI .........try to pass and check whether its updating or not...........

--

regards

Jack

Read only

0 Likes
1,383

Hi,

I didnt forget to pass the schedule lines.

I said my BAPI usually works...

it's only when I change the material to this particular material and when I change the storage location at the same time that I find a problem.

Read only

Former Member
0 Likes
1,383

Hi,
Thanks for your replies.

=> BAPI_SALESORDERCHANGE doesnt exists... so yes, I am using BAPI_SALESORDER_CHANGE.
=> I'm not using it in a loop.
=> I didnt forget to set the updateflag to 'U'

=> I am not in simulation mode

=> I correctly passed the schedule lines to the BAPI 


  I only get a problem when I change the material AND the storage location.

When I do this, SAP doesnt consider the value I've put for the storage location
I noticed that I face the same problem with every material that doesnt have a WM view. I dont know if it helps...


Thanks for your help !
JC

Read only

0 Likes
1,383

no idea ?