CK91N CK94 混合比例查询
作者:互联网
*&---------------------------------------------------------------------*
*& Report ZCO012
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zco012.
TABLES: mbew,mara .
SELECT-OPTIONS s_matnr FOR mara-matnr .
SELECT-OPTIONS s_bwkey FOR mbew-bwkey .
DATA: BEGIN OF gs_out,
matnr LIKE mbew-matnr,
maktx LIKE makt-maktx,
bwkey LIKE mbew-bwkey, "评估范围
bwtar LIKE mbew-bwtar, "评估类
vprsv LIKE mbew-vprsv, "价格控制 S V
bklas LIKE mbew-bklas, " 评估类
kaln1 LIKE mbew-kaln1, " 产品成本核算号
* kalnr LIKE ckmlmv001-kalnr , "备选采购号
* verid_nd LIKE ckmlmv001-verid_nd , "生产版本
* lifnr_nd LIKE ckmlmv001-lifnr_nd , "供应商代码
misch_verh LIKE ckmlmv003-misch_verh, "混合比例
icon(30) TYPE c,
END OF gs_out .
DATA : gt_out LIKE TABLE OF gs_out .
DATA: gt_fieldcat TYPE lvc_t_fcat .
DATA: gs_fieldcat TYPE lvc_s_fcat .
DATA: gs_layout TYPE lvc_s_layo .
START-OF-SELECTION .
SELECT
a~matnr " LIKE mbew-matnr,
maktx " LIKE makt-maktx,
a~bwkey " LIKE mbew-bwkey, "评估范围
a~bwtar " LIKE mbew-bwtar, "评估类
vprsv " LIKE mbew-vprsv, "价格控制 S V
bklas " LIKE mbew-bklas, " 评估类
KALN1 " 产品成本核算号
* c~kalnr " LIKE ckmlmv001-kalnr , "备选采购号
* c~verid_nd " LIKE ckmlmv001, "生产版本
* c~lifnr_nd " LIKE ckmlmv001-lifnr_nd , "供应商代码
** d~misch_verh "LIKE ckmlmv003-misch_verh, "混合比例
INTO TABLE gt_out
FROM mbew AS a
" LEFT JOIN ckmlmv001 AS c ON a~matnr = c~matnr AND a~bwkey = c~bwkey AND a~bwtar = c~bwtar AND c~otyp = 'BA' and C~SOBKZ ne 'T'
* JOIN ckmlmv003 AS d ON c~kalnr = d~kalnr_bal
JOIN makt AS b ON a~matnr = b~matnr
WHERE a~matnr IN s_matnr
AND a~bwkey IN s_bwkey .
LOOP AT gt_out INTO gs_out .
SELECT SINGLE misch_verh INTO gs_out-misch_verh
FROM ckmlmv003
* WHERE kalnr_bal = gs_out-kalnr
WHERE KALNR_OUT = gs_out-kaln1
AND bwkey = gs_out-bwkey .
IF gs_out-vprsv EQ 'S' .
IF gs_out-misch_verh IS NOT INITIAL .
gs_out-icon = icon_green_light .
ELSE .
gs_out-icon = icon_red_light .
ENDIF .
ENDIF .
MODIFY gt_out FROM gs_out .
CLEAR :gs_out .
ENDLOOP .
DEFINE append_field.
gs_fieldcat-fieldname = &1.
gs_fieldcat-coltext = &2.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR: gs_fieldcat.
END-OF-DEFINITION.
* matnr like mbew-matnr,
* maktx LIKE makt-maktx,
* bwkey LIKE mbew-bwkey, "评估范围
* bwtar LIKE mbew-bwtar, "评估类
* vprsv LIKE mbew-vprsv, "价格控制 S V
* bklas LIKE mbew-bklas, " 评估类
* kalnr LIKE ckmlmv001-kalnr , "备选采购号
* verid_nd LIKE ckmlmv001-verid_nd , "生产版本
* lifnr_nd LIKE ckmlmv001-lifnr_nd , "供应商代码
* misch_verh LIKE ckmlmv003-misch_verh, "混合比例
append_field: 'ICON' '状态' .
* append_field: 'MATNR' '物料代码' .
gs_fieldcat-fieldname = 'MATNR'.
gs_fieldcat-coltext = '物料编码'.
gs_fieldcat-ref_table = 'MARA'.
gs_fieldcat-ref_field = 'MATNR'.
* gs_fieldcat-EMPHASIZE = 'C710' . " 列颜色
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR: gs_fieldcat.
append_field: 'MAKTX' '物料描述' .
append_field: 'BWKEY' '评估范围' .
append_field: 'BWTAR' '分割评估' .
append_field: 'VPRSV' '价格控制' .
append_field: 'BKLAS' '评估类' .
* append_field: 'KALNR' '备选采购号' .
* append_field: 'VERID_ND' '生产版本' .
* append_field: 'LIFNR_ND' '供应商代码' .
append_field: 'MISCH_VERH' '混合比例' .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
* i_callback_pf_status_set = 'FRM_STATUS_SET'
* i_callback_user_command = 'FRM_USER_COMMAND'
*
* I_GRID_SETTINGS =
is_layout_lvc = gs_layout
it_fieldcat_lvc = gt_fieldcat
i_save = 'A'
* i_grid_settings = ls_grid_settings
* it_events = lt_events
* is_variant = ls_variant
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_out
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
标签:bwkey,gs,LIKE,fieldcat,mbew,CK94,查询,CK91N,out 来源: https://blog.csdn.net/ityangjia/article/details/111292148