Skip to Content
0

Using L_TO_CREATE_MULTIPLE with special stock

May 17, 2017 at 04:50 PM

130

avatar image

Hello!

I'm using FM L_TO_CREATE_MULTIPLE to create TO using the next structure:

IF gw_alv-lgtyp(1) EQ 'K'.
lw_ltak-bwlvs = '999'.
ELSEIF gw_alv-lgtyp(1) EQ 'M'.
lw_ltak-bwlvs = '997'.
ENDIF.
lw_ltak-lgnum = 'ME1'.
lw_ltak-trart = 'X'.
lw_ltak-bdatu = sy-datum.
lw_ltak-bname = sy-uname.
lw_ltak-cntps = '0001'.
lw_ltap-matnr = gw_alv-matnr.
lw_ltap-werks = '1000'.
lw_ltap-lgort = gw_alv-lgort.
lw_ltap-charg = gw_alv-charg.
lw_ltap-anfme = gw_alv-einme.
lw_ltap-altme = gw_alv-meins.
lw_ltap-nidru = abap_true.
lw_ltap-vltyp = gw_alv-lgtyp.
lw_ltap-vlber = '001'.
lw_ltap-vlpla = gw_alv-lgpla.
lw_ltap-nltyp = gw_alv-nltyp.
lw_ltap-vlber = '001'.
lw_ltap-nlpla = gw_alv-nlpla.
* lw_ltap-sobkz = ''.
* lw_ltap-sonum = ''.
APPEND lw_ltak TO lt_ltak.
APPEND lw_ltap TO lt_ltap.

When I use both fields sobkz (special stock indicator) and (sonum). I get "Storage type XXX does not allow negative stock figures" but if I don't use it, the program is running correctly. I mean, i can not process TO with special stock.

The problem, I think, is that the program don't get the correct quant from the stock and try to make a newone with negative stock. This only happend with special stock.

I have tryed using SONUM with the conversión and without.

Anyone has idea about it? How to use L_TO_CREATE_MULTIPLE with special stocks.

thanks a lot

wm | to
10 |10000 characters needed characters left characters exceeded

Please change your tag to LE (Logistics Execution) for WM questions

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Raghu Govindarajan May 17, 2017 at 08:06 PM
0

Looks like your source stock is not special stock. Check the LQUA entry that is equivalent to your source stock - in your case gw_alv-lgtyp, gw_alv-lgpla, gw_alv-matnr and gw_alv-charg. Does that entry in LQUA have SOBKZ and SONUM set?

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi.

Yes It has an entry in LQUA. A little doubt could be if I have to fill SONUM with WBS element or the LQUA value (after conversion from FM), anyway I tried both.

Is so weird because if I don't fill up SOBKZ and SONUM the FM gets the correct Quant, but when I do it, FM make a new quant with negative quantity instead of use the source quant.

Sorry about that, I'm not an ABAP especialist.

Thanks

0

SOBKZ and SONUM should have the same number as in the source LQUA entry. I just noticed that the your code also is attempting to populate some fields in the LTAK structure. Do not do that, the LTAK is a return table for what has been created. Only populate the EXPORTING parameters and the T_LTAP_CREAT table.

0