In continuation with Inventory management through SnapShot- steps and procedures- Part I
The routines required for SnapShot scenario are the following;
Most of the routines given here are used for 3.x flow.
For Calmonth in DSO;
move COMM_STRUCTURE-PSTNG_DATE(6) to RESULT.
move sy-datum(6) to l_month.
if l_month >= RESULT. " movement in the past
RESULT = '999912'.
endif.
From 2LIS_03_BF Datasource to DSO (ZODSSNP2) and Infocube (ICSNAP2):
For ZTOTALST- Snapshot: Quantity Total Stock;
IF COMM_STRUCTURE-cpquabu <> 0.
* INFLOW
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ).
"Issues from Stock Transfers
*The following statement is commented out since the valuation type for
*material with
*valuation category "S" (Split) does not populate the BWGEO field in
*R/3. Hence 0CPPVLC is 0.00
* AND COMM_STRUCTURE-cppvlc <> 0.
RESULT = COMM_STRUCTURE-CPQUABU * -1.
* OUTFLOW
elseif ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001'
"Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004'
"Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005'
"Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '006'
"Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '010' ).
"Receipt from Stock Transfer
*The following statement is commented out since the valuation type for
*material with
*valuation category "S" (Split) does not populate the BWGEO field in
*R/3. Hence 0CPPVLC is 0.00
* AND COMM_STRUCTURE-cppvlc <> 0.
RESULT = COMM_STRUCTURE-CPQUABU.
ENDIF.
ENDIF.
For ZVALSTCKV- Snapshot: Value of valuated stock;
IF COMM_STRUCTURE-stockcat IS INITIAL OR
( COMM_STRUCTURE-stockcat CA 'EQ' AND
COMM_STRUCTURE-indspecstk CA 'AM' ).
* INFLOW
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' )."Issues from Stock Transfers
*The following statement is commented out since the valuation type for
*material with
*valuation category "S" (Split) does not populate the BWGEO field in
*R/3. Hence 0CPPVLC is 0.00
* AND COMM_STRUCTURE-cppvlc <> 0.
RESULT = COMM_STRUCTURE-CPPVLC * -1.
* OUTFLOW
elseif ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001' "Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004'
"Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '006' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '010' ).
"Receipt from Stock Transfer
*The following statement is commented out since the valuation type for
*material with
*valuation category "S" (Split) does not populate the BWGEO field in
*R/3. Hence 0CPPVLC is 0.00
* AND COMM_STRUCTURE-cppvlc <> 0.
RESULT = COMM_STRUCTURE-CPPVLC.
ENDIF.
ENDIF.
For ZVALSTCKQ- Snapshot: Quantity of valuated stock;
IF COMM_STRUCTURE-stockcat IS INITIAL OR
( COMM_STRUCTURE-stockcat CA 'EQ' AND
COMM_STRUCTURE-indspecstk CA 'AM' ).
IF COMM_STRUCTURE-cpquabu <> 0.
* INFLOW
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ).
"Issues from Stock Transfers
*The following statement is commented out since the valuation type for
*material with
*valuation category "S" (Split) does not populate the BWGEO field in
*R/3. Hence 0CPPVLC is 0.00
* AND COMM_STRUCTURE-cppvlc <> 0.
RESULT = COMM_STRUCTURE-CPQUABU * -1.
* OUTFLOW
elseif ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001'
"Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004'
"Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '006'
"Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '010' ).
"Receipt from Stock Transfer
*The following statement is commented out since the valuation type for
*material with
*valuation category "S" (Split) does not populate the BWGEO field in
*R/3. Hence 0CPPVLC is 0.00
* AND COMM_STRUCTURE-cppvlc <> 0.
RESULT = COMM_STRUCTURE-CPQUABU.
ENDIF.
ENDIF.
ENDIF.
For ZTOTSTCKV - Value Total Stock;
IF COMM_STRUCTURE-CPPVLC <> 0.
* INFLOW
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ).
"Issues from Stock Transfers
*The following statement is commented out since the valuation type for
*material with
RESULT = COMM_STRUCTURE-CPPVLC * -1.
* OUTFLOW
elseif ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001'
"Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004'
"Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005'
"Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '006'
"Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '010' ).
"Receipt from Stock Transfer
*The following statement is commented out since the valuation type for
*material with
RESULT = COMM_STRUCTURE-CPPVLC.
ENDIF.
ENDIF.
For ZTRSTCKQ- Quantity Stock in Transit;
IF ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001' "Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004' "Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD +
OR COMM_STRUCTURE-processkey EQ '006' "Stock Adjustment Other +
OR COMM_STRUCTURE-processkey EQ '010' ) "Receipt from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only stock in transit is considered
AND COMM_STRUCTURE-stocktype CA 'FH'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu .
*only goods issue is considered
ELSEIF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ) "Issues from Stock Transfers
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only stock in transit is considered
AND COMM_STRUCTURE-stocktype CA 'FH'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu * -1.
ENDIF .
For ZTRSTCKV- Value Stock in Transit;
IF ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001' "Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004' "Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD +
OR COMM_STRUCTURE-processkey EQ '006' "Stock Adjustment Other +
OR COMM_STRUCTURE-processkey EQ '010' ) "Receipt from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only stock in transit is considered
AND COMM_STRUCTURE-stocktype CA 'FH'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-CPPVLC <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-CPPVLC .
*only goods issue is considered
ELSEIF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ) "Issues from Stock Transfers
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only stock in transit is considered
AND COMM_STRUCTURE-stocktype CA 'FH'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-CPPVLC <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-CPPVLC * -1.
ENDIF .
Infopackage routine for DSO (ZODSSNP2) to Infocube (ICSNAP2) daily load:
This routine is on the Document date for daily load of stock data (current and previous months).
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'DOC_DATE'.
data: h_datum like sy-datum, l_datum like sy-datum,w_datum like
sy-datum.
data: l_mtyr(6) type n, l_dt(2) type n ,
l_mt(2) type n , l_yr(4) type n.
read table l_t_range with key
fieldname = 'DOC_DATE'.
clear : l_datum, w_datum, h_datum.
l_datum = sy-datum.
w_datum = sy-datum.
h_datum = w_datum - 1."sy-datum - 1 .
l_mt = h_datum+4(2).
l_yr = h_datum+0(4).
l_idx = sy-tabix.
if l_mt = '01'.
if l_mt = '01'.
l_mt = '12'.
l_yr = l_yr - 1.
endif.
l_dt = '01'.
concatenate l_yr l_mt l_dt into l_datum.
else.
h_datum = w_datum - 1.
l_mtyr = h_datum+0(6) - 1.
concatenate l_mtyr '01' into l_datum.
endif.
l_t_range-LOW = l_datum.
l_t_range-high = h_datum.
l_t_range-option = 'BT'.
modify l_t_range index l_idx.
For complete details also refer;
Inventory management through SnapShot- steps and procedures- Part I
The specified item was not found.
Kindly reply if there is any queries regarding the routines.