Skip to Content
avatar image
Former Member

Using L_TO_CREATE_MULTIPLE with special stock


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'.
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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 17, 2017 at 08:06 PM

    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?

    Add comment
    10|10000 characters needed characters exceeded

    • 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.