‎2007 May 11 8:04 PM
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
‎2007 May 11 8:16 PM
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
‎2007 May 11 8:16 PM
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
‎2007 May 11 8:43 PM
Please tell me, why did you make the changes this way?
Please explain the changes and what they signify.
‎2007 May 12 12:35 AM
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