/SAPAPO/OM_STOCK_CHANGE - Create/Change/Delete Stock Objects in liveCache

PERFORM Short Reference   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Functionality

Stock objects are either receipts that in terms of time are close to the origin of the time axis (moreprecisely: shortly after 01.01.1970, 00:00:00) and represent opening stocks, or are batch stocks thatcan be at any time (though not in the reserved start area of the time axis to 01.01.1970, 00:00:30).Provided that they belong to a peggable stock type, opening stocks are depicted logically at today'stime when they are pegged. If batch stocks belong to a peggable stock type, they take part in pegging with their normal time according to the same rules as any other receipt.

A stock object can consist of several stock items, each of which describes individual stocks for differentsublocations and ATP categories. All items of a stock object have the same pegging area and the sameversion (batch). Within a stock object, you cannot create multiple stock items with the same combination of sublocation and ATP category.

If a stock item has a negative quantity, it is not a receipt (output node) but a requirement (inputnode). Whereas a stock with positive quantity can have characteristic values, a stock with negativequantity can have characteristic requirements. However, these consist of sharp value requirements, asthey must correspond 1:1 to the corresponding characteristic value assignments in the case of positive stock quantities.

This function creates, deletes, or changes the stock items specified in the table IT_STOCK. The operation to be performed depends on the data in the METHOD field in IT_STOCK:

  • If METHOD = GC_NEW:
The stock item with sublocation SUBLOC and category CATEGORY is created for the stock object specifiedunder STOCK. This can only be done if the stock item does not yet exist. If the object with the keySTOCK does not yet exist, it is created. If the STOCK_TIME field contains a time outside the start areain the time axis, a batch stock items is created for this time. If the STOCK_TIME field is initial, or contains a value that lies in the start area in the time axis, an initial stock item is created.
  • If METHOD = GC_DELETE:
The stock item with sublocation SUBLOC and category CATEGORY is deleted. If it is the only item in the stock object in question, the stock object itself is also deleted.
  • If METHOD = GC_CHANGE:
The stock item with sublocation SUBLOC and category CATEGORY is created, provided that it does not already exist. Otherwise, only the quantity and the specified value are changed.
  • If METHOD = GC_ADD:
The stock item with sublocation SUBLOC and category CATEGORY is enlarged by the amount REAL_QUANTITY (if REAL_QUANTITY > 0) or reduced (if REAL_QUANTITY < 0).
  • If METHOD = GC_DELETE_ORDER:
The complete stock object with key STOCK is deleted, together with all its items.

If characteristic valuations are to be set for stock items, these can be specified in table IT_CHARACT_VAL_OUTNODE.Note that ORDERID corresponds to STOCK, POSITION_NO corresponds to SUBLOC and LINE_NO corresponds toCATEGORY. For stock items with negative quantity, the characteristics specified in IT_CHARACT_VAL_OUTNODE are interpreted as sharp characteristic requirements.

The IV_ANCHOR_FIELDS parameter can be used to define whether the anchor table-relevant fields ADDLOCID and MATID can be evaluated from the IT_STOCK, that is, whether they contains meaningful entries:

  • If IV_ANCHOR_FIELDS has the value GC_DO_NOT_USE_ANCHOR (default), these fields are not evaluated.If a top order has to be created for the stock item (together with a corresponding anchor table entryin table /SAPAPO/STOCKANC), there is an error code om_no_stock_anc_entry, and creation of the stock item (as well as the top order) will fail.
  • If IV_ANCHOR_FIELDS has the value GC_USE_ANCHOR, these fields can be evaluated when the top order is created (that is, for the creation of the corresponding anchor table entry).

ET_RC contains return codes for item with processing errors.

If required, fixed pegging relationships are deleted when stock items or stock objects are deleted orchanged. These deleted relationships are returned in the table ET_DELETED_FIX_PEGGING. If you want to recover them, this is the responsibility of the calling program.

If a stock order has been changed, it is marked in the export table ET_CHANGED_STOCKS. If the changes have lead to the deletion of a stock order, an entry will be made in export table ET_DELETED_STOCKS instead.

If a stock change leads to a stock quantity of 0, the stock item can be implicitly deleted. (In thecase of stocks with characteristics, no implicit deletion takes place). If a stock has been implicitlydeleted, a key is returned in table ET_IMPLIC_DELETED_STOCK_POS. If this implicit deletion has alsocaused the deletion of the entire stock order (because the implicitly deleted stock item was the last remaining stock item in the stock order), this deletion is documented as usual in export table ET_DELETED_STOCKS.

Example

Notes

Return codes (see table ET_RC):

  • om_duplicate_sched_key:
A stock item with this key already exists in the liveCache (if METHOD = GC_NEW).
  • om_invalid_sched_key:
There is no stock item with this key in the liveCache (if METHOD = GC_CHANGE or METHOD = GC_DELETE).
  • om_invalid_order:
There is no stock object with this key in the liveCache (if METHOD = GC_DELETE_ORDER).
  • om_no_stock_anc_entry :
,,There is no entry in table /SAPAPO/STOCKANC for a stock order. It was therefore not possible to create an entry, as the required data were not specified ,,(IV_ANCHOR_FIELDS was on GC_DO_NOT_USE_ANCHOR).

Further information


Parameters

ET_CHANGED_STOCKS
ET_DELETED_FIX_PEGGING
ET_DELETED_STOCKS
ET_IMPLIC_DELETED_STOCK_POS
ET_RC
IS_ATP_INFO
IS_EXCLUDE_EXPORTS
IS_GEN_PARAMS
IT_CHARACT_VAL_OUTNODE
IT_STOCK
IV_ANCHOR_FIELDS
IV_SIMSESSION
IV_SUBTRANS_MODE

Exceptions

LC_APPL_ERROR
LC_COM_ERROR
LC_CONNECT_FAILED

Function Group

APO/SAPLOM_STOCK

ABAP Short Reference   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.


Length: 7730 Date: 20120525 Time: 091054     triton ( 288 ms )