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

LSMW - Problem

Former Member
0 Likes
580

Hi,

In the following code:

<br><br>

<img src="http://img527.imageshack.us/img527/7114/lsmwrl6.jpg" border="0"/></a>

<br><br>

vkorg is sales org<br>

vwerks is delivery plant<br><br>

The lsmw reads the vkorg and vwerk. However, say the 1st vkorg is zpmb, with vwerk 1010. It will read all of those entries and when it gets to the next vkorg (say zprm) it will continue to use the same vwerk, instead of the real one.

<br><br>

How do i fix this?

<br><br>

Thanks,<br>

John

Message was edited by:

John Damion

Message was edited by:

John Damion

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
558

HI John,

Try with the following changes:

select single werks from tvkwz into wa-werks where vkorg = main_cust_file-vkorg.

if wa_werks is initial.

import wa_werks from memory id wa-mid2.

endif.

bknvv-vwerk = wa_werks.

export wa-werks to wa_mid2.

Regards,

ravi

3 REPLIES 3
Read only

Former Member
0 Likes
559

HI John,

Try with the following changes:

select single werks from tvkwz into wa-werks where vkorg = main_cust_file-vkorg.

if wa_werks is initial.

import wa_werks from memory id wa-mid2.

endif.

bknvv-vwerk = wa_werks.

export wa-werks to wa_mid2.

Regards,

ravi

Read only

0 Likes
558

Please tell me, why did you make the changes this way?

Please explain the changes and what they signify.

Read only

0 Likes
558

1) get the plant from the table for the VKORG in the fiel.

select single werks from tvkwz into wa-werks where vkorg = main_cust_file-vkorg.

2) If there is no Plant in the table for the VKORG in the file,

get the previous plant(The plant that was exported to memory last record).

3) Export the current plant number to make it available for next record if needed.

Regards,

Ravi