物料价格分析取未分摊和未分配价格差异
?
*&---------------------------------------------------------------------*
*&?Report??ZTEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT??ZTEST.
TYPE-POOLS:?SLIS.
DATA:?I_FIELDCAT_ALV?TYPE?SLIS_T_FIELDCAT_ALV?WITH?HEADER?LINE,
??????????I_LAYOUT???TYPE?SLIS_LAYOUT_ALV,???"alv的格式
??????????I_FIELDCAT?TYPE?SLIS_FIELDCAT_ALV,
??????????TMP_TITLE(70),
??????????W_REPID???LIKE?SY-REPID.
**---------------------------------------------------------------------*
***?Types
**---------------------------------------------------------------------*
DATA?:??POS?TYPE?I,
????????LW_TITLE(150)?TYPE?C,
????????S_mat?TYPE?CKMLHD-MATNR.
*選擇屏幕
data:BEGIN?OF?itab?OCCURS?0,
??????matnr?like?mara-matnr,
??????KALNR?like?CKMLHD-kalnr,
??????BDATJ?like?ckmlcr-bdatj,
??????POPER?like?ckmlcr-poper,
??????VNPRD_EA?like?ckmlcr-VNPRD_EA,
??????vnprd_ma?like?ckmlcr-vnprd_ma,
???ABPRD_O??LIKE?CKMLCR-ABPRD_O,
???ZUPRD_O??LIKE?CKMLCR-ZUPRD_O,
???EBPRD_EA??LIKE?CKMLCR-EBPRD_EA,
?????ABPRD_mO??LIKE?CKMLCR-ABPRD_mO,
???ZUPRD_mO??LIKE?CKMLCR-ZUPRD_mO,
???EBPRD_mA??LIKE?CKMLCR-EBPRD_mA,
??????ESTPRD?like?mlcd-ESTPRD,
??????mstprd?like?mlcd-mstprd,
??????testprd?like?mlcd-estprd,
??????WFPCY??LIKE?CKMLCR-ABPRD_O,
end?of?itab.
SELECTION-SCREEN?BEGIN?OF?BLOCK?BLK1?WITH?FRAME?TITLE?TEXT-001.
SELECTION-SCREEN?SKIP.
PARAMETERS?P_BDATJ??LIKE?CKMLCR-BDATJ?OBLIGATORY?DEFAULT?'2011'.
SELECTION-SCREEN?SKIP.
PARAMETERS:?P_POPER?LIKE?CKMLCR-POPER?OBLIGATORY?DEFAULT?'12'.
SELECTION-SCREEN?SKIP.
PARAMETERS?P_WERKS?LIKE?CKMLHD-BWKEY?OBLIGATORY?DEFAULT?'PS01'.
SELECTION-SCREEN?SKIP.
SELECT-OPTIONS:?S_MATNR?FOR?S_mat.
SELECTION-SCREEN?SKIP.
SELECTION-SCREEN?END?OF?BLOCK?BLK1.
CONCATENATE??'??????????????????????????????????????'??P_BDATJ?'年'?P_POPER
'月'
'未分配差異表'?INTO?LW_TITLE.
START-OF-SELECTION.
??PERFORM?GETDATA.??????"
??PERFORM?LAYOUT_BUILD.??"
??PERFORM?FIELDS.?"
??PERFORM?DISPLAY_DATA.?"
*&---------------------------------------------------------------------*
*&??????Form??getdata
*&---------------------------------------------------------------------*
*???????text
*----------------------------------------------------------------------*
FORM?GETDATA.
??select?CKMLHD~matnr
??????CKMLHD~KALNR
??????ckmlcr~BDATJ
??????ckmlcr~POPER
??????ckmlcr~VNPRD_EA
??????ckmlcr~vnprd_ma
???????ckmlcr~ABPRD_O
???????ckmlcr~ZUPRD_O
???????ckmlcr~EBPRD_EA
???????ckmlcr~ABPRD_mO
???????ckmlcr~ZUPRD_mO
???????ckmlcr~EBPRD_mA
??INTO?CORRESPONDING?FIELDS?OF?TABLE?itab
??from?ckmlhd
??join?ckmlcr?on?ckmlhd~kalnr?=?ckmlcr~kalnr
??where?ckmlhd~matnr?in?s_matnr
????and?ckmlhd~bwkey?=?p_werks
????and?ckmlcr~BDATJ?=?p_BDATJ
????and?ckmlcr~POPER?=?p_poper.
??loop?at?itab.
????select?sum(?ESTPRD?)?sum(?mstprd?)?into?(itab-tESTPRD,itab-mstprd)
????from?mlcd
????where?kalnr?=?itab-kalnr
??????and?bdatj?=?itab-bdatj
??????and?poper?=?itab-poper
??????and?CATEG?=?'VN'.
????itab-estprd?=?itab-vnprd_ea?+?itab-vnprd_ma?-?(?itab-testprd?+?itab-mstprd?).
????itab-WFPCY?=?itab-EBPRD_EA?+?+?itab-VNPRD_EA?-?itab-ZUPRD_O?-?itab-ABPRD_O
???????????????????+?itab-EBPRD_mA?+?+?itab-VNPRD_mA?-?itab-ZUPRD_mO?-?itab-ABPRD_mO.
????modify?itab.
??endloop.
ENDFORM.????????????????????"GETDATA
*&---------------------------------------------------------------------*
*&??????Form??layout_build
*&---------------------------------------------------------------------*
*???????text
*----------------------------------------------------------------------*
FORM?LAYOUT_BUILD.
??I_LAYOUT-ZEBRA?=?'X'.
??I_LAYOUT-DETAIL_POPUP?=?'X'.?"
??W_REPID?=?SY-REPID.????"
??I_LAYOUT-F2CODE?=?'&ETA'."
??I_LAYOUT-NO_VLINE?????????????=?'X'."
??I_LAYOUT-COLWIDTH_OPTIMIZE????=?'X'.?"
??I_LAYOUT-DETAIL_INITIAL_LINES?=?'X'.
??I_LAYOUT-DETAIL_TITLEBAR??????=?'詳細(xì)內(nèi)容'."
ENDFORM.????????????????????"layout_build
*&---------------------------------------------------------------------*
*&??????Form??fields
*&---------------------------------------------------------------------*
*???????text
*----------------------------------------------------------------------*
FORM?FIELDS.
??REFRESH?I_FIELDCAT_ALV.
??POS?=?0.
??CLEAR?I_FIELDCAT.
??TMP_TITLE?=?LW_TITLE."
??I_FIELDCAT-COL_POS?=?POS.??????"
??I_FIELDCAT-FIELDNAME?=?'MATNR'.
??I_FIELDCAT-SELTEXT_L?=?'物料號(hào)'.?"
??APPEND?I_FIELDCAT?TO?I_FIELDCAT_ALV.
??POS?=?POS?+?1.
??I_FIELDCAT-COL_POS???????=??POS.
??I_FIELDCAT-FIELDNAME?????=?'WFPCY'.
??I_FIELDCAT-SELTEXT_L?????=?'沒(méi)有被分?jǐn)?#39;.
??APPEND?I_FIELDCAT?TO??I_FIELDCAT_ALV.
??POS?=?POS?+?1.
??I_FIELDCAT-COL_POS???????=??POS.
??I_FIELDCAT-FIELDNAME?????=?'ESTPRD'.
??I_FIELDCAT-SELTEXT_L?????=?'未分配價(jià)格差異'.
??APPEND?I_FIELDCAT?TO??I_FIELDCAT_ALV.
??CLEAR?I_FIELDCAT.
ENDFORM.????????????????????"fields
*&---------------------------------------------------------------------*
*&??????Form??display_data
*&---------------------------------------------------------------------*
*???????text
*----------------------------------------------------------------------*
FORM?DISPLAY_DATA.
??CALL?FUNCTION?'REUSE_ALV_GRID_DISPLAY'
????EXPORTING
??????I_CALLBACK_PROGRAM?=?W_REPID???"
??????I_SAVE?????????????=?''
??????IS_LAYOUT??????????=?I_LAYOUT??"
??????IT_FIELDCAT????????=?I_FIELDCAT_ALV[]?"
??????I_GRID_TITLE???????=?TMP_TITLE
????TABLES
??????T_OUTTAB???????????=?itab.??"
ENDFORM.????????????????????"display_data
總結(jié)
以上是生活随笔為你收集整理的物料价格分析取未分摊和未分配价格差异的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: MR21批量修改物料价格-BDC
- 下一篇: 利润表和资产负债表开发小结