我想在alv网格中显示内部表IT_FINAL(下面):
**** DATA Declaration
TABLES: mara.
TYPES: BEGIN OF ty_mara,
matnr TYPE matnr,
ersda TYPE ersda,
END OF ty_mara.
TYPES: BEGIN OF ty_makt,
matnr TYPE matnr,
maktx TYPE maktx,
END OF ty_makt.
TYPES: BEGIN OF ty_final,
matnr TYPE matnr,
ersda TYPE ersda,
maktx TYPE maktx,
END OF ty_final.
DATA: it_mara TYPE STANDARD TABLE OF ty_mara,
it_makt TYPE STANDARD TABLE OF ty_makt,
it_final TYPE STANDARD TABLE OF ty_final.
DATA: ls_mara LIKE LINE OF it_mara,
ls_makt LIKE LINE OF it_makt,
ls_final LIKE LINE OF it_final.
**** Selection Screen
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
PARAMETERS: p_matnr TYPE matnr.
SELECT-OPTIONS: s_ersda FOR mara-ersda. " no-extension.
SELECTION-SCREEN : END OF BLOCK b1 .
START-OF-SELECTION.
SELECT matnr
ersda
FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_mara
WHERE matnr EQ p_matnr
AND ersda IN s_ersda.
IF sy-subrc EQ 0.
SELECT matnr
maktx
FROM makt
INTO CORRESPONDING FIELDS OF TABLE it_makt
FOR ALL ENTRIES IN it_mara
WHERE matnr = it_mara-matnr
AND spras EQ sy-langu.
IF sy-subrc eq 0.
LOOP AT it_mara INTO ls_mara.
MOVE ls_mara-matnr to ls_final-matnr.
MOVE ls_mara-ersda to ls_final-ersda.
READ TABLE it_makt INTO ls_makt with KEY matnr = ls_mara-matnr.
IF sy-subrc eq 0.
MOVE ls_makt-maktx to ls_final-maktx.
ENDIF.
APPEND ls_final to it_final.
CLEAR: ls_mara,
ls_makt,
ls_final.
ENDLOOP.
ENDIF.
break 9subhr3.
ENDIF.
答案 0 :(得分:6)
最简单的方法可能是使用班级CL_SALV_TABLE
。
查看报告SALV_DEMO_TABLE_SIMPLE
以获取示例。
有关更全面的示例,请查看以SALV_DEMO_TABLE_*
开头的所有报告。
另请参阅课程CL_SALV_TABLE
上的文档(转到SE24,显示课程并单击“课程文档”)。它非常详细和有用。