Stock overview and cost assignment - 5

mmccking發表於2012-10-16
* Get Gross Sales data
* Get Cost of Goods Sold data
* Get the Material data
* Get WIP data
* Get Inventory data
[@more@]

*&---------------------------------------------------------------------*
*& Form ARRANGE_NORMAL_STOCK
*&---------------------------------------------------------------------*
* Arrange the normal stock
*----------------------------------------------------------------------*
FORM ARRANGE_NORMAL_STOCK .

* Extract normal stock (From MBEW/MBEWH)
PERFORM FRM_GET_NORMAL_STOCK.

* Extract Batch Stocks (From MCHB/MCHBH)
PERFORM FRM_GET_MCHB_STOCK.

* Extract Special Stocks with Customer stock(From MSKU/MSKUH)
PERFORM FRM_GET_CUST_STOCK.

* Assign amount to batch stock
PERFORM FRM_ASSIGN_TO_BATCH.

ENDFORM. " ARRANGE_NORMAL_STOCK
*&---------------------------------------------------------------------*
*& Form FRM_ASSIGN_TO_BATCH
*&---------------------------------------------------------------------*
* Assign amount to batch stock
*----------------------------------------------------------------------*
FORM FRM_ASSIGN_TO_BATCH .

DATA:
LTH_MBEW LIKE LINE OF TD_MBEW,
LTH_MCHB LIKE LINE OF TD_MCHB,
LTH_MSKU LIKE LINE OF TD_MSKU,
LTH_CT000401 LIKE LINE OF TD_CT000401.

DATA:
LW_AMOUNT TYPE MSLB-LBLAB,
LW_SALK3 TYPE MBEW-SALK3.

LOOP AT TD_MBEW INTO LTH_MBEW.

LOOP AT TD_MCHB INTO LTH_MCHB WHERE MATNR = LTH_MBEW-MATNR
AND WERKS = LTH_MBEW-BWKEY.

LTH_CT000401-MATNR = LTH_MCHB-MATNR.
LTH_CT000401-WERKS = LTH_MCHB-WERKS.
LTH_CT000401-LGORT = LTH_MCHB-LGORT.
LTH_CT000401-CHARG = LTH_MCHB-CHARG.
LTH_CT000401-SOBKZ = C_NORMAL_STOCK. "Stock Indicator
LTH_CT000401-BUKRS = P_BUKRS.
LTH_CT000401-GJAHR = P_GJAHR.
LTH_CT000401-MONAT = P_PERID. "Perid
LTH_CT000401-BKLAS = LTH_MBEW-BKLAS. "Valuetion class
LTH_CT000401-QUANT = LTH_MCHB-CLABS + LTH_MCHB-CUMLM + LTH_MCHB-CINSM
+ LTH_MCHB-CEINM + LTH_MCHB-CSPEM + LTH_MCHB-CRETM.

LTH_CT000401-MEINS = LTH_MBEW-MEINS. "

IF LTH_MBEW-VPRSV = C_S.
LTH_CT000401-AMOUNT = LTH_CT000401-QUANT * LTH_MBEW-STPRS / LTH_MBEW-PEINH.
ELSE.
LTH_CT000401-AMOUNT = LTH_CT000401-QUANT * LTH_MBEW-VERPR / LTH_MBEW-PEINH.
ENDIF.

* Get Account
IF LTH_MBEW-BKLAS = C_2110.
LTH_CT000401-HKONT = W_FACCOUNT.
ELSE.
LTH_CT000401-HKONT = W_SACCOUNT.
ENDIF.

* Get the routing data
PERFORM GET_ROUTING_DATA USING '
LTH_CT000401-WERKS "LTH_MWEW-WERKS Changed by zhang mei on 2011.09.29
LTH_CT000401-LGORT "LTH_MBEW-LGORT Changed by zhang mei on 2011.09.29
LTH_CT000401-MATNR "LTH_MBEW-MATNR Changed by zhang mei on 2011.09.29
LTH_CT000401-CHARG "LTH_MBEW-CHARG Changed by zhang mei on 2011.09.29
CHANGING LTH_CT000401-RTGRP1
LTH_CT000401-RTGRP2
LTH_CT000401-RTGRP3
LTH_CT000401-RTGRP4
LTH_CT000401-RTGRP5
LTH_CT000401-RTGRP6
LTH_CT000401-RTGRP7
LTH_CT000401-RTGRP8.
* Get profit center
SELECT SINGLE PRCTR
FROM MARC
INTO LTH_CT000401-PRCTR
WHERE MATNR = LTH_CT000401-MATNR
AND WERKS = LTH_CT000401-WERKS.

APPEND LTH_CT000401 TO TD_CT000401.

LW_AMOUNT = LW_AMOUNT + LTH_CT000401-QUANT.
LW_SALK3 = LW_SALK3 + LTH_CT000401-AMOUNT.

CLEAR LTH_CT000401.
ENDLOOP.

LOOP AT TD_MSKU INTO LTH_MSKU WHERE MATNR = LTH_MBEW-MATNR
AND WERKS = LTH_MBEW-BWKEY..

LTH_CT000401-MATNR = LTH_MSKU-MATNR.
LTH_CT000401-WERKS = LTH_MSKU-WERKS.
LTH_CT000401-LGORT = SPACE.
LTH_CT000401-CHARG = LTH_MCHB-CHARG.
LTH_CT000401-SOBKZ = C_NORMAL_STOCK. "Stock Indicator
LTH_CT000401-BUKRS = P_BUKRS.
LTH_CT000401-GJAHR = P_GJAHR.
LTH_CT000401-MONAT = P_PERID. "Perid
LTH_CT000401-BKLAS = LTH_MBEW-BKLAS. "Valuetion class

* Total Stock Qty
LTH_CT000401-QUANT = LTH_MSKU-KULAB + LTH_MSKU-KUINS
+ LTH_MSKU-KUEIN + LTH_MSKU-KUUML.

LTH_CT000401-MEINS = LTH_MBEW-MEINS. "

IF LTH_MBEW-VPRSV = C_S.
LTH_CT000401-AMOUNT = LTH_CT000401-QUANT * LTH_MBEW-STPRS / LTH_MBEW-PEINH.
ELSE.
LTH_CT000401-AMOUNT = LTH_CT000401-QUANT * LTH_MBEW-VERPR / LTH_MBEW-PEINH.
ENDIF.

* Get Account
IF LTH_MBEW-BKLAS = C_2110.
LTH_CT000401-HKONT = W_FACCOUNT.
ELSE.
LTH_CT000401-HKONT = W_SACCOUNT.
ENDIF.

* Get the routing data
PERFORM GET_ROUTING_DATA USING '
LTH_CT000401-WERKS "LTH_MWEW-WERKS Changed by zhang mei on 2011.09.29
LTH_CT000401-LGORT "LTH_MBEW-LGORT Changed by zhang mei on 2011.09.29
LTH_CT000401-MATNR "LTH_MBEW-MATNR Changed by zhang mei on 2011.09.29
LTH_CT000401-CHARG "LTH_MBEW-CHARG Changed by zhang mei on 2011.09.29
CHANGING LTH_CT000401-RTGRP1
LTH_CT000401-RTGRP2
LTH_CT000401-RTGRP3
LTH_CT000401-RTGRP4
LTH_CT000401-RTGRP5
LTH_CT000401-RTGRP6
LTH_CT000401-RTGRP7
LTH_CT000401-RTGRP8.
* Get profit center
SELECT SINGLE PRCTR
FROM MARC
INTO LTH_CT000401-PRCTR
WHERE MATNR = LTH_CT000401-MATNR
AND WERKS = LTH_CT000401-WERKS.

APPEND LTH_CT000401 TO TD_CT000401.

LW_AMOUNT = LW_AMOUNT + LTH_CT000401-QUANT.
LW_SALK3 = LW_SALK3 + LTH_CT000401-AMOUNT.

CLEAR LTH_CT000401.
ENDLOOP.

* Qty without batch
IF LW_AMOUNT < LTH_MBEW-LBKUM.

LW_AMOUNT = LTH_MBEW-LBKUM - LW_AMOUNT.

IF LTH_MBEW-VPRSV = C_S.
LTH_CT000401-AMOUNT = LW_AMOUNT * LTH_MBEW-STPRS / LTH_MBEW-PEINH.
ELSE.
LTH_CT000401-AMOUNT = LW_AMOUNT * LTH_MBEW-VERPR / LTH_MBEW-PEINH.
ENDIF.

LTH_CT000401-MATNR = LTH_MBEW-MATNR.
LTH_CT000401-WERKS = LTH_MBEW-BWKEY.
LTH_CT000401-LGORT = SPACE.
LTH_CT000401-CHARG = SPACE.
LTH_CT000401-SOBKZ = C_NORMAL_STOCK. "Stock Indicator
LTH_CT000401-BUKRS = P_BUKRS.
LTH_CT000401-GJAHR = P_GJAHR.
LTH_CT000401-MONAT = P_PERID. "Perid
LTH_CT000401-BKLAS = LTH_MBEW-BKLAS. "Valuetion class
LTH_CT000401-QUANT = LW_AMOUNT. "Total stock qty
LTH_CT000401-MEINS = LTH_MBEW-MEINS. "Price Unit
* Get Account
IF LTH_MBEW-BKLAS = C_2110.
LTH_CT000401-HKONT = W_FACCOUNT.
ELSE.
LTH_CT000401-HKONT = W_SACCOUNT.
ENDIF.

* Get the routing data
PERFORM GET_ROUTING_DATA USING '
LTH_CT000401-WERKS "LTH_MWEW-WERKS Changed by zhang mei on 2011.09.29
LTH_CT000401-LGORT "LTH_MBEW-LGORT Changed by zhang mei on 2011.09.29
LTH_CT000401-MATNR "LTH_MBEW-MATNR Changed by zhang mei on 2011.09.29
LTH_CT000401-CHARG "LTH_MBEW-CHARG Changed by zhang mei on 2011.09.29
CHANGING LTH_CT000401-RTGRP1
LTH_CT000401-RTGRP2
LTH_CT000401-RTGRP3
LTH_CT000401-RTGRP4
LTH_CT000401-RTGRP5
LTH_CT000401-RTGRP6
LTH_CT000401-RTGRP7
LTH_CT000401-RTGRP8.
* Get profit center
SELECT SINGLE PRCTR
FROM MARC
INTO LTH_CT000401-PRCTR
WHERE MATNR = LTH_CT000401-MATNR
AND WERKS = LTH_CT000401-WERKS.

APPEND LTH_CT000401 TO TD_TEMP401.

LW_SALK3 = LW_SALK3 + LTH_CT000401-AMOUNT.

CLEAR LTH_CT000401.

ENDIF.

* Balance the total amount
IF LW_SALK3 <> LTH_MBEW-SALK3.

LTH_CT000401-AMOUNT = LTH_MBEW-SALK3 - LW_SALK3.

LTH_CT000401-MATNR = LTH_MBEW-MATNR.
LTH_CT000401-WERKS = LTH_MBEW-BWKEY.
LTH_CT000401-LGORT = SPACE.
LTH_CT000401-CHARG = SPACE.
LTH_CT000401-SOBKZ = C_NORMAL_STOCK. "Stock Indicator
LTH_CT000401-BUKRS = P_BUKRS.
LTH_CT000401-GJAHR = P_GJAHR.
LTH_CT000401-MONAT = P_PERID. "Perid
LTH_CT000401-BKLAS = LTH_MBEW-BKLAS. "Valuetion class
* LTH_CT000401-QUANT = LW_AMOUNT. "Total stock qty
LTH_CT000401-MEINS = LTH_MBEW-MEINS. "Price Unit
* Get Account
IF LTH_MBEW-BKLAS = C_2110.
LTH_CT000401-HKONT = W_FACCOUNT.
ELSE.
LTH_CT000401-HKONT = W_SACCOUNT.
ENDIF.

* Get the routing data
PERFORM GET_ROUTING_DATA USING '
LTH_CT000401-WERKS "LTH_MWEW-WERKS Changed by zhang mei on 2011.09.29
LTH_CT000401-LGORT "LTH_MBEW-LGORT Changed by zhang mei on 2011.09.29
LTH_CT000401-MATNR "LTH_MBEW-MATNR Changed by zhang mei on 2011.09.29
LTH_CT000401-CHARG "LTH_MBEW-CHARG Changed by zhang mei on 2011.09.29
CHANGING LTH_CT000401-RTGRP1
LTH_CT000401-RTGRP2
LTH_CT000401-RTGRP3
LTH_CT000401-RTGRP4
LTH_CT000401-RTGRP5
LTH_CT000401-RTGRP6
LTH_CT000401-RTGRP7
LTH_CT000401-RTGRP8.
* Get profit center
SELECT SINGLE PRCTR
FROM MARC
INTO LTH_CT000401-PRCTR
WHERE MATNR = LTH_CT000401-MATNR
AND WERKS = LTH_CT000401-WERKS.

APPEND LTH_CT000401 TO TD_CT000401.
CLEAR LTH_CT000401.

ENDIF.

CLEAR: LW_SALK3,
LW_AMOUNT.

ENDLOOP.

ENDFORM. " FRM_ASSIGN_TO_BATCH
*&---------------------------------------------------------------------*
*& Form ARRAGER_SO_STOCK
*&---------------------------------------------------------------------*
* Arrange the sales order stock
*----------------------------------------------------------------------*
FORM ARRANGE_SO_STOCK .

* Extract Sales Order Stock (From EBEW/EBEWH)
PERFORM FRM_GET_SO_STOCK.

* Extract Sales Order Batch(From MSKA/MSKAH)
PERFORM FRM_GET_SO_BATCH.

* Assign amount to batch SO stock
PERFORM FRM_ASSIGN_TO_SO_BATCH.

ENDFORM. " ARRANGE_SO_STOCK
*&---------------------------------------------------------------------*
*& Form FRM_GET_SO_BATCH
*&---------------------------------------------------------------------*
* Extract Sales Order Batch(From MSKA/MSKAH)
*----------------------------------------------------------------------*
FORM FRM_GET_SO_BATCH .

DATA:
LTH_MSKA LIKE LINE OF TD_MSKA,
LTD_MSKAH TYPE TABLE OF TYP_MSKA,
LTH_MSKAH LIKE LINE OF LTD_MSKAH.

DATA:
LW_INDEX TYPE SY-TABIX.

SELECT MATNR " Material Number
WERKS " Plant
LGORT " Storage Location
CHARG " Batch Number
VBELN " Sales and Distribution Document Number
POSNR " Item number of the SD document
LFGJA " Fiscal Year of Current Period
LFMON " Current period (posting period)
KALAB " Valuated Unrestricted-Use Stock
KAINS " Stock in Quality Inspection
KASPE " Blocked Stock
INTO CORRESPONDING FIELDS OF TABLE TD_MSKA
FROM MSKA
FOR ALL ENTRIES IN TD_EBEW
WHERE WERKS = P_WERKS "Valuation Area
AND MATNR = TD_EBEW-MATNR. " Material Number

LOOP AT TD_MSKA INTO LTH_MSKA.

LW_INDEX = SY-TABIX.

IF LTH_MSKA-LFGJA > P_GJAHR
OR ( LTH_MSKA-LFGJA = P_GJAHR
AND LTH_MSKA-LFMON > P_PERID ).

* Extract Current stock(Batch Stocks) history.
SELECT MATNR "Material Number
WERKS "Plant
CHARG "Batch Number
LFGJA "Fiscal Year of Current Period
LFMON "Current period (posting period)
KALAB "Valuated Unrestricted-Use Stock
KAINS "Stock in Quality Inspection
KASPE "Blocked Stock
INTO CORRESPONDING FIELDS OF TABLE LTD_MSKAH
UP TO 1 ROWS
FROM MSKAH
WHERE WERKS = P_WERKS "Plant
AND MATNR = LTH_MSKA-MATNR "Material Number
AND CHARG = LTH_MSKA-CHARG
AND ( LFGJA < P_GJAHR
OR ( LFGJA = P_GJAHR
AND LFMON <= P_PERID ) )
ORDER BY LFGJA DESCENDING
LFMON DESCENDING.

IF SY-SUBRC = 0.
READ TABLE LTD_MSKAH INTO LTH_MSKAH INDEX 1.
IF SY-SUBRC = 0.
** Update Qty by history data
* LTH_MSKAH-KALAB = LTH_MSKAH-KALAB +
* LTH_MSKAH-KAINS +
* LTH_MSKAH-KASPE.

MODIFY TD_MSKA FROM LTH_MSKAH INDEX LW_INDEX.
ENDIF.

* ELSE.
* Update Qty by currence data
* LTH_MSKA-KALAB = LTH_MSKA-KALAB +
* LTH_MSKA-KAINS +
* LTH_MSKA-KASPE.

* MODIFY TD_MSKA FROM LTH_MSKA INDEX LW_INDEX.
ENDIF.

ENDIF.

REFRESH LTD_MSKAH.
CLEAR LTH_MSKAH.
CLEAR LTH_MSKA.

ENDLOOP.

ENDFORM. " FRM_GET_SO_BATCH
*&---------------------------------------------------------------------*
*& Form FRM_ASSIGN_TO_SO_BATCH
*&---------------------------------------------------------------------*
* Assign amount to batch SO stock
*----------------------------------------------------------------------*
FORM FRM_ASSIGN_TO_SO_BATCH .

DATA:
LTH_EBEW LIKE LINE OF TD_EBEW,
LTH_MSKA LIKE LINE OF TD_MSKA,
LTH_CT000401 LIKE LINE OF TD_CT000401.

DATA:
LW_AMOUNT TYPE MSKA-KALAB,
LW_SALK3 TYPE MBEW-SALK3.

LOOP AT TD_EBEW INTO LTH_EBEW.

LOOP AT TD_MSKA INTO LTH_MSKA WHERE MATNR = LTH_EBEW-MATNR
AND WERKS = LTH_EBEW-BWKEY
AND VBELN = LTH_EBEW-VBELN
AND POSNR = LTH_EBEW-POSNR.

LTH_CT000401-MATNR = LTH_MSKA-MATNR.
LTH_CT000401-WERKS = LTH_MSKA-WERKS.
LTH_CT000401-LGORT = LTH_MSKA-LGORT.
LTH_CT000401-CHARG = LTH_MSKA-CHARG.
LTH_CT000401-SOBKZ = C_SO_STOCK. "Stock Indicator
LTH_CT000401-BUKRS = P_BUKRS.
LTH_CT000401-GJAHR = P_GJAHR.
LTH_CT000401-MONAT = P_PERID. "Perid
LTH_CT000401-BKLAS = LTH_EBEW-BKLAS. "Valuetion class
* Total Stock Qty
LTH_CT000401-QUANT = LTH_MSKA-KALAB + LTH_MSKA-KAINS + LTH_MSKA-KASPE.

LTH_CT000401-MEINS = LTH_EBEW-PEINH. "Price Unit

IF LTH_EBEW-VPRSV = C_S.
LTH_CT000401-AMOUNT = LTH_CT000401-QUANT * LTH_EBEW-STPRS / LTH_EBEW-PEINH.
ELSE.
LTH_CT000401-AMOUNT = LTH_CT000401-QUANT * LTH_EBEW-VERPR / LTH_EBEW-PEINH.
ENDIF.

* Get Account
IF LTH_EBEW-BKLAS = C_2110.
LTH_CT000401-HKONT = W_FACCOUNT.
ELSE.
LTH_CT000401-HKONT = W_SACCOUNT.
ENDIF.

* Get the routing data
PERFORM GET_ROUTING_DATA USING '
LTH_CT000401-WERKS "LTH_MWEW-WERKS Changed by zhang mei on 2011.09.29
LTH_CT000401-LGORT "LTH_MBEW-LGORT Changed by zhang mei on 2011.09.29
LTH_CT000401-MATNR "LTH_MBEW-MATNR Changed by zhang mei on 2011.09.29
LTH_CT000401-CHARG "LTH_MBEW-CHARG Changed by zhang mei on 2011.09.29
CHANGING LTH_CT000401-RTGRP1
LTH_CT000401-RTGRP2
LTH_CT000401-RTGRP3
LTH_CT000401-RTGRP4
LTH_CT000401-RTGRP5
LTH_CT000401-RTGRP6
LTH_CT000401-RTGRP7
LTH_CT000401-RTGRP8.
* Get profit center
SELECT SINGLE PRCTR
FROM MARC
INTO LTH_CT000401-PRCTR
WHERE MATNR = LTH_CT000401-MATNR
AND WERKS = LTH_CT000401-WERKS.

APPEND LTH_CT000401 TO TD_CT000401.

LW_AMOUNT = LW_AMOUNT + LTH_CT000401-QUANT.
LW_SALK3 = LW_SALK3 + LTH_CT000401-AMOUNT.

CLEAR LTH_CT000401.
ENDLOOP.

* Qty without batch
IF LW_AMOUNT < LTH_EBEW-LBKUM.

LW_AMOUNT = LTH_EBEW-LBKUM - LW_AMOUNT.

IF LTH_EBEW-VPRSV = C_S.
LTH_CT000401-AMOUNT = LW_AMOUNT * LTH_EBEW-STPRS / LTH_EBEW-PEINH.
ELSE.
LTH_CT000401-AMOUNT = LW_AMOUNT * LTH_EBEW-VERPR / LTH_EBEW-PEINH.
ENDIF.

LTH_CT000401-MATNR = LTH_EBEW-MATNR.
LTH_CT000401-WERKS = LTH_EBEW-BWKEY.
LTH_CT000401-LGORT = SPACE.
LTH_CT000401-CHARG = SPACE.
LTH_CT000401-SOBKZ = C_SO_STOCK. "Stock Indicator
LTH_CT000401-BUKRS = P_BUKRS.
LTH_CT000401-GJAHR = P_GJAHR.
LTH_CT000401-MONAT = P_PERID. "Perid
LTH_CT000401-BKLAS = LTH_EBEW-BKLAS. "Valuetion class
LTH_CT000401-QUANT = LW_AMOUNT. "Total stock qty
LTH_CT000401-MEINS = LTH_EBEW-PEINH. "Price Unit
* Get Account
IF LTH_EBEW-BKLAS = C_2110.
LTH_CT000401-HKONT = W_FACCOUNT.
ELSE.
LTH_CT000401-HKONT = W_SACCOUNT.
ENDIF.

* Get the routing data
PERFORM GET_ROUTING_DATA USING '
LTH_CT000401-WERKS "LTH_MWEW-WERKS Changed by zhang mei on 2011.09.29
LTH_CT000401-LGORT "LTH_MBEW-LGORT Changed by zhang mei on 2011.09.29
LTH_CT000401-MATNR "LTH_MBEW-MATNR Changed by zhang mei on 2011.09.29
LTH_CT000401-CHARG "LTH_MBEW-CHARG Changed by zhang mei on 2011.09.29
CHANGING LTH_CT000401-RTGRP1
LTH_CT000401-RTGRP2
LTH_CT000401-RTGRP3
LTH_CT000401-RTGRP4
LTH_CT000401-RTGRP5
LTH_CT000401-RTGRP6
LTH_CT000401-RTGRP7
LTH_CT000401-RTGRP8.
* Get profit center
SELECT SINGLE PRCTR
FROM MARC
INTO LTH_CT000401-PRCTR
WHERE MATNR = LTH_CT000401-MATNR
AND WERKS = LTH_CT000401-WERKS.

APPEND LTH_CT000401 TO TD_TEMP401.

LW_SALK3 = LW_SALK3 + LTH_CT000401-AMOUNT.

CLEAR LTH_CT000401.

ENDIF.

* Balance the total amount
IF LW_SALK3 <> LTH_EBEW-SALK3.

LTH_CT000401-AMOUNT = LTH_EBEW-SALK3 - LW_SALK3.

LTH_CT000401-MATNR = LTH_EBEW-MATNR.
LTH_CT000401-WERKS = LTH_EBEW-BWKEY.
LTH_CT000401-LGORT = SPACE.
LTH_CT000401-CHARG = SPACE.
LTH_CT000401-SOBKZ = C_SO_STOCK. "Stock Indicator
LTH_CT000401-BUKRS = P_BUKRS.
LTH_CT000401-GJAHR = P_GJAHR.
LTH_CT000401-MONAT = P_PERID. "Perid
LTH_CT000401-BKLAS = LTH_EBEW-BKLAS. "Valuetion class
* LTH_CT000401-QUANT = LW_AMOUNT. "Total stock qty
LTH_CT000401-MEINS = LTH_EBEW-PEINH. "Price Unit
* Get Account
IF LTH_EBEW-BKLAS = C_2110.
LTH_CT000401-HKONT = W_FACCOUNT.
ELSE.
LTH_CT000401-HKONT = W_SACCOUNT.
ENDIF.

* Get the routing data
PERFORM GET_ROUTING_DATA USING '
LTH_CT000401-WERKS "LTH_MWEW-WERKS Changed by zhang mei on 2011.09.29
LTH_CT000401-LGORT "LTH_MBEW-LGORT Changed by zhang mei on 2011.09.29
LTH_CT000401-MATNR "LTH_MBEW-MATNR Changed by zhang mei on 2011.09.29
LTH_CT000401-CHARG "LTH_MBEW-CHARG Changed by zhang mei on 2011.09.29
CHANGING LTH_CT000401-RTGRP1
LTH_CT000401-RTGRP2
LTH_CT000401-RTGRP3
LTH_CT000401-RTGRP4
LTH_CT000401-RTGRP5
LTH_CT000401-RTGRP6
LTH_CT000401-RTGRP7
LTH_CT000401-RTGRP8.
* Get profit center
SELECT SINGLE PRCTR
FROM MARC
INTO LTH_CT000401-PRCTR
WHERE MATNR = LTH_CT000401-MATNR
AND WERKS = LTH_CT000401-WERKS.

APPEND LTH_CT000401 TO TD_CT000401.
CLEAR LTH_CT000401.

ENDIF.

CLEAR: LW_SALK3,
LW_AMOUNT.

ENDLOOP.

ENDFORM. " FRM_ASSIGN_TO_SO_BATCH

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8356764/viewspace-1059576/,如需轉載,請註明出處,否則將追究法律責任。

相關文章