Ansicht
Dokumentation

MWMTO004 - Own stock removal strategy

MWMTO004 - Own stock removal strategy

SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

With this user exit you can integrate your own stock removal strategy into the procedure for processing transfer orders.

This modification consists of four user exits in SAPLL03A. The respective function modules are EXIT_SAPLL03A_005 through EXIT_SAPLL03A_008. In addition to the activation in transaction SMOD, you have to select the stock removal strategy in the storage type control (stock removal strategy '1'). In order to explain the meaning of the individual function modules, the stock removal strategy FIFO is used as an example.
The function modules have the following meaning:

Function module EXIT_SAPLL03A_005 is called up in order to find appropriate stocks for a given storage type. In contrast to the stock placement strategy, this module does not find a storage bin, but sets up and sorts a table (T_QMAT) of the stocks of a material in a storage type. If the material is changed, Table T_QMAT is refreshed, but with regard to contents this table belongs to the user exit and must also be updated by the exit (see EXIT_SAPLL03A_007 and EXIT_SAPLL03A_008). This user exit can be combined with the stock removal strategies " " and "F". If the stock removal strategy is " ", the exit operates as described above. If the stock removal strategy is "F", SAPLL03A sets up the table T_QMAT so that the user exit only needs to execute the sort. This table is set up (directly before EXIT_SAPLL03A_005 is called up) whenever the storage type has not yet been imported into table T_QMAT, that is, if there is no entry KZTYP = 'X' in T_QMAT for this material and storage type. The structure of table T_QMAT is compared with respect to the database stock with the TO items that have already been generated internally. Items generated internally by other users are not taken into consideration.

Example FIFO:
The requested quantity is 30 pieces, available in stock are 60 pieces at 5 locations. The first call the function module creates table T_QMAT and sorts it according to GR date:

     12 pieces are in storage bin 01-02-03 from 2/1/1993

     12 pieces are in storage bin 03-05-06 from 5/2/1993

     12 pieces are in storage bin 06-01-02 from 7/3/1993

     12 pieces are in storage bin 03-02-01 from 1/4/1994

     12 pieces are in storage bin 04-01-03 from 9/1/1994

No storage bin needs to be blocked. All other actions are taken over by the source bin quant determination in the standard system. If, for example, storage bin 01-02-03 is currently blocked for physical inventory, storage bin 03-05-06 is used. Users that are simultaneously working with this material are considered by the standard system.
During the second call, the requested quantity is reduced to 18 pieces. Table T_QMAT still exists and does not need to be set up again, that is, the function module does not need to do anything.

Note: If you want to make a negative posting at one storage bin, it is important that the entry in question has a positive available quantity in table T_QMAT because entries without available quantity are not considered for reasons of performance.
Abend messages and system messages can be issued directly whereas warning messages and error messages must not be issued. If no stocks are found, an empty table T_QMAT should be returned to continue the search in the next storage type.

  • Function module EXIT_SAPLL03A_006 is called in order to check a stock that is generally given by the user. This function module is not called if function module EXIT_SAPLL03A_005 was performed directly before, that is, entries that originate directly from table T_QMAT are no longer checked. Because of the division in the TO creation described above, it is still possible that a stock is determined and proposed to the user. If some interaction is performed on the screen now, the items are created again. If you cancel the proposed storage bin, function module EXIT_SAPLL03A_005 is performed. If you confirm or overwrite the storage bin, this definite storage bin is checked with function module EXIT_SAPLL03A_006. Abend messages and system messages may be issued directly whereas warning messages and error messages must be issued via the interface (see below).
    This function module is not relevant for the FIFO example, that is, the respective Include could remain empty.
  • Function module EXIT_SAPLL03A_007 is called if the TO item in question is created internally, for example, to update your own internal tables. (Second part of the item creation). No error messages may be issued here.
    For the FIFO example, this would mean that during a withdrawal of 12 pieces from storage bin 03-05-06 the available quantity for this entry in table T_QMAT is set to 0. If this is not updated, the system would try again to make a withdrawal from this storage bin. The availability check for this storage bin (which requires positive stocks) would reject this withdrawal and may continue with storage bin 06-01-02. Thus, nothing 'wrong' would happen but consume performance.
  • Function module EXIT_SAPLL03A_008 is called if the TO item in question is deleted internally, for example, to update your own internal tables or cancel updates with function module EXIT_SAPLL03A_007. No error messages may be issued here.
    For the FIFO example, this would mean that the withdrawal of 12 pieces from storage bin 03-05-06 must be reversed by increasing the available quantity in table T_QMAT by 12.

In order to be able to use the function module, you must create Include ZXLTOU07.
The following parameters are available:

Import parameters

  1. I_LTAK The respective TO header that contains, for example, the reference documents such as the transfer requirement number or the like.
  2. I_LTAP The TO item that has been created so far
Please refer to the interface documentation of function module L_TO_PREPARE_ITEM_INT for more information on the filled fields I_LTAK and I_LTAP.
  1. I_MLVS Material master
  2. I_MGEF Hazardous material master
  3. I_T331 Control data of the storage type from which the withdrawal is to be made
  4. I_T333 Movement type with which the TO is created
  5. I_T340D Warehouse number control
  6. I_ANFML (Remaining) requested quantity in base unit of measure. This quantity is relevant if the active ingredient processing is not active (I_LTAP-WIRME is set to initial value).
  7. I_VORGA Transaction within the TO processing (see above)

Table parameters

  1. T_QMAT Table with bin stock to be filled with data and/or sorted
  2. T_BDBATCH Table of the batches found by the system via the search parameters
The following note applies only to batch determination via the batch search procedure (I_T340D-CHSWM or I_T333-CHSWM) for materials that are handled in batches (I_MLVS-XCHPF) and do not have a pre-specified batch in the TO item (I_LTAP-CHARG):
Table T_BDBATCH contains the batches found by the search procedure. Table T_QMAT contains (if already filled by the system) only stock for batches from T_BDBATCH. Entries for batches that are not included in T_BDBATCH are ignored in subsequent processing after the user exit.
Note
None of the changes in table T_BDBATCH affect subsequent processing after the user exit.

There are no export parameters.

In order to be able to use the function module, you must create Include ZXLTOU06.
The description of the parameters basically corresponds to the description of function module EXIT_SAPLL03A_005. Below, only the differences are described.

Import parameters

  1. I_LTAP The TO item that has been created so far, except that source storage bin, source storage unit and source quant are filled now (I_LTAP-VLPLA, I_LTAP-VLENR and I_LTAP-VLQNR)
  2. I_T331 Control data of the storage type of the storage bin that is checked
  3. I_MANPL Manual storage bin default. If I_MANPL = 'X', a given storage bin is to be checked manually, if I_MANPL = ' ', the stock was proposed within a strategy involving several storage types (strict FIFO principle).

Table parameters

  1. T_QMAT Table of the bin inventories (depending on the call sequence, it may be empty!)

Export parameters

  1. E_SUBRC Processing return code with the following values
    1. R_CUS_OK => Use checked storage bin
    2. R_CUS_EXIT => Do not use checked storage bin
    3. R_CUS_WARNING => Use checked storage bin and send a warning message
    4. R_CUS_ERROR => Do not use the checked storage bin and send an error message
  2. E_MSGID Message ID for the error message
  3. E_MSGNO Number of the error message
  4. E_MSGV1 First variable in the error message
  5. E_MSGV2 Second variable in the error message
  6. E_MSGV3 Third variable in the error message
  7. E_MSGV4 Fourth variable in the error message

If you enter the storage bin manually (I_MANPL = 'X'), an error message or warning message should be processed, if necessary. In the case of a stock removal involving several storage types (I_MANPL = ' '), the stock should be accepted or rejected without any message.

In order to be able to use the function module, you must create Include ZXLTOU09.
The following parameters are available:

Import parameters

  1. I_LTAK The respective TO header
  2. I_LTAP The complete TO item that is now included in the internal tables of SAPLL03A including all its characteristics
  3. I_VORGA Transaction within the TO processing

Table parameters

  1. T_QMAT Table of the bin inventories (depending on call sequence, empty!)

There are no export parameters.

If table TAP is read at this time, the item to be currently created is not yet contained.

In order to be able to use the function module, you must create Include ZXLTOU10.
The following parameters are available:

Import parameters

  1. I_LTAK The respective TO header
  2. I_LTAP The complete TO item that is deleted from the internal tables including all its characteristics
  3. I_VORGA Transaction within the TO processing

Table parameters

  1. T_QMAT Table of the bin inventories (depending on the call sequence, it may be empty!)

There are no export parameters

If table TAP is read at this time, the item to be currently deleted is no longer available.






Fill RESBD Structure from EBP Component Structure   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 11461 Date: 20240328 Time: 234342     sap01-206 ( 213 ms )