TABLES: ZRFC_STATUS_BACK,EKPO.
DATA: v_pos TYPE i.
DATA: wa_fieldcat TYPE lvc_s_fcat ,
i_fieldcat TYPE lvc_t_fcat ,
i_layout TYPE lvc_s_layo .
DATA:GT_FIELDCAT TYPE LVC_T_FCAT WITH HEADER LINE.
TYPES: BEGIN OF TY_ITAB,
DATANUM TYPE ZRFC_STATUS_BACK-DATANUM,
EBELN TYPE ZRFC_STATUS_BACK-EBELN,
EBELP TYPE ZRFC_STATUS_BACK-EBELP,
MATNR TYPE ZRFC_STATUS_BACK-MATNR,
TXZ01 TYPE ZRFC_STATUS_BACK-TXZ01,
LIFNR TYPE ZRFC_STATUS_BACK-LIFNR,
PRDORDER TYPE ZRFC_STATUS_BACK-PRDORDER,
MENGE TYPE ZRFC_STATUS_BACK-MENGE,
SHNGE TYPE ZRFC_STATUS_BACK-MENGE,
MEINS TYPE ZRFC_STATUS_BACK-MEINS,
BEDAT1 TYPE ZRFC_STATUS_BACK-BEDAT1,
BEDAT2 TYPE ZRFC_STATUS_BACK-BEDAT2,
TYPE TYPE ZRFC_STATUS_BACK- TYPE,
TYPEM TYPE ZRFC_STATUS_BACK-TYPEM,
BEDAT3 TYPE ZRFC_STATUS_BACK-BEDAT3,
RDATUM TYPE ZRFC_STATUS_BACK-RDATUM,
RCTIME TYPE ZRFC_STATUS_BACK-RCTIME,
END OF TY_ITAB.
DATA:ITAB TYPE TABLE OF TY_ITAB WITH HEADER LINE.
""选择屏幕
SELECTION- SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT- 001.
SELECT-OPTIONS:S_LIFNR FOR ZRFC_STATUS_BACK-LIFNR OBLIGATORY .
SELECTION- SCREEN END OF BLOCK MAIN.
**主程序
START- OF-SELECTION.
PERFORM F_SELECT_DATA.
PERFORM F_DISPLAY.
*&---------------------------------------------------------------------*
*& Form F_SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM F_SELECT_DATA.
"SELECT *
" INTO CORRESPONDING FIELDS OF TABLE ITAB
"FROM ZRFC_STATUS_BACK INNER JOIN EKPO
" ON ZRFC_STATUS_BACK-EBELN = EKPO-EBELN.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM ZRFC_STATUS_BACK
WHERE LIFNR IN S_LIFNR.
LOOP AT ITAB.
SELECT SINGLE
MATNR
MENGE
MEINS
INTO (ITAB-MATNR,ITAB-MENGE,ITAB-MEINS)
FROM EKPO
WHERE EBELN = ITAB-EBELN
AND EBELP = ITAB-EBELP.
MODIFY ITAB.
CLEAR ITAB..
ENDLOOP.
DELETE ITAB WHERE LIFNR NOT IN S_LIFNR.
ENDFORM. "F_SELECT_DATA
*&---------------------------------------------------------------------*
*& Form F_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM F_DISPLAY.
PERFORM F_FIELDS .
PERFORM F_LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
is_layout_LVC = i_layout
it_fieldcat_LVC = i_fieldcat[]
i_save = 'X'
TABLES
t_outtab = ITAB
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. "F_DISPLAY
*&---------------------------------------------------------------------*
*& Form F_FIELDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM F_FIELDS .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = 'LIFNR' .
wa_fieldcat-scrtext_l = '供应商'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = 'DATANUM' .
wa_fieldcat-scrtext_l = '数据顺序号'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = 'EBELN' .
wa_fieldcat-scrtext_l = '采购订单'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = 'EBELN' .
wa_fieldcat-scrtext_l = '订单行项目'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = 'MNTNR' .
wa_fieldcat-scrtext_l = '板卡物料'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = ' MATNR' .
wa_fieldcat-scrtext_l = '物料号'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
CLEAR wa_fieldcat .
ENDFORM. "F_FIELDS
*&---------------------------------------------------------------------*
*& Form F_LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM F_LAYOUT .
i_layout-zebra = 'X' .
i_layout-sel_mode = 'A' .
i_layout-cwidth_opt = 'X' .
ENDFORM. "F_LAYOUT
DATA: v_pos TYPE i.
DATA: wa_fieldcat TYPE lvc_s_fcat ,
i_fieldcat TYPE lvc_t_fcat ,
i_layout TYPE lvc_s_layo .
DATA:GT_FIELDCAT TYPE LVC_T_FCAT WITH HEADER LINE.
TYPES: BEGIN OF TY_ITAB,
DATANUM TYPE ZRFC_STATUS_BACK-DATANUM,
EBELN TYPE ZRFC_STATUS_BACK-EBELN,
EBELP TYPE ZRFC_STATUS_BACK-EBELP,
MATNR TYPE ZRFC_STATUS_BACK-MATNR,
TXZ01 TYPE ZRFC_STATUS_BACK-TXZ01,
LIFNR TYPE ZRFC_STATUS_BACK-LIFNR,
PRDORDER TYPE ZRFC_STATUS_BACK-PRDORDER,
MENGE TYPE ZRFC_STATUS_BACK-MENGE,
SHNGE TYPE ZRFC_STATUS_BACK-MENGE,
MEINS TYPE ZRFC_STATUS_BACK-MEINS,
BEDAT1 TYPE ZRFC_STATUS_BACK-BEDAT1,
BEDAT2 TYPE ZRFC_STATUS_BACK-BEDAT2,
TYPE TYPE ZRFC_STATUS_BACK- TYPE,
TYPEM TYPE ZRFC_STATUS_BACK-TYPEM,
BEDAT3 TYPE ZRFC_STATUS_BACK-BEDAT3,
RDATUM TYPE ZRFC_STATUS_BACK-RDATUM,
RCTIME TYPE ZRFC_STATUS_BACK-RCTIME,
END OF TY_ITAB.
DATA:ITAB TYPE TABLE OF TY_ITAB WITH HEADER LINE.
""选择屏幕
SELECTION- SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT- 001.
SELECT-OPTIONS:S_LIFNR FOR ZRFC_STATUS_BACK-LIFNR OBLIGATORY .
SELECTION- SCREEN END OF BLOCK MAIN.
**主程序
START- OF-SELECTION.
PERFORM F_SELECT_DATA.
PERFORM F_DISPLAY.
*&---------------------------------------------------------------------*
*& Form F_SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM F_SELECT_DATA.
"SELECT *
" INTO CORRESPONDING FIELDS OF TABLE ITAB
"FROM ZRFC_STATUS_BACK INNER JOIN EKPO
" ON ZRFC_STATUS_BACK-EBELN = EKPO-EBELN.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM ZRFC_STATUS_BACK
WHERE LIFNR IN S_LIFNR.
LOOP AT ITAB.
SELECT SINGLE
MATNR
MENGE
MEINS
INTO (ITAB-MATNR,ITAB-MENGE,ITAB-MEINS)
FROM EKPO
WHERE EBELN = ITAB-EBELN
AND EBELP = ITAB-EBELP.
MODIFY ITAB.
CLEAR ITAB..
ENDLOOP.
DELETE ITAB WHERE LIFNR NOT IN S_LIFNR.
ENDFORM. "F_SELECT_DATA
*&---------------------------------------------------------------------*
*& Form F_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM F_DISPLAY.
PERFORM F_FIELDS .
PERFORM F_LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
is_layout_LVC = i_layout
it_fieldcat_LVC = i_fieldcat[]
i_save = 'X'
TABLES
t_outtab = ITAB
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. "F_DISPLAY
*&---------------------------------------------------------------------*
*& Form F_FIELDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM F_FIELDS .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = 'LIFNR' .
wa_fieldcat-scrtext_l = '供应商'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = 'DATANUM' .
wa_fieldcat-scrtext_l = '数据顺序号'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = 'EBELN' .
wa_fieldcat-scrtext_l = '采购订单'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = 'EBELN' .
wa_fieldcat-scrtext_l = '订单行项目'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = 'MNTNR' .
wa_fieldcat-scrtext_l = '板卡物料'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
v_pos = v_pos + 1 .
wa_fieldcat-col_pos = v_pos .
wa_fieldcat-fieldname = ' MATNR' .
wa_fieldcat-scrtext_l = '物料号'.
wa_fieldcat-fix_column = 'X' .
APPEND wa_fieldcat TO i_fieldcat .
CLEAR wa_fieldcat .
ENDFORM. "F_FIELDS
*&---------------------------------------------------------------------*
*& Form F_LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM F_LAYOUT .
i_layout-zebra = 'X' .
i_layout-sel_mode = 'A' .
i_layout-cwidth_opt = 'X' .
ENDFORM. "F_LAYOUT