在ABAP report中列出另一个report的内容

标签:ABAP

boss交给我的第一个练习…

因为是在非常慢的测试服务器上,就没去数据库取数据了,自己构造了个itab…

这个是显示数据的
REPORT  Z_A.
INITIALIZATION.
TYPES : BEGIN OF person,
  name(20) TYPE c,
  age TYPE i,
  sex TYPE c,
END OF person.
DATA : it_person TYPE STANDARD TABLE OF person,
      wa_person TYPE person,
      a_person TYPE person.

START-OF-SELECTION.
a_person-name = 'a'.
a_person-age = 20.
a_person-sex = 'M'.
APPEND a_person to it_person.
a_person-name = 'b'.
a_person-age = 22.
a_person-sex = 'M'.
APPEND a_person to it_person.
a_person-name = 'c'.
a_person-age = 10.
a_person-sex = 'F'.
APPEND a_person to it_person.

end-OF-SELECTION.
WRITE : / 'This is the list of report A.',
/ 'name',
25 'age',
30 'sex'.
LOOP at it_person INTO wa_person.
  WRITE : / wa_person-name,
  25 wa_person-age,
  30 wa_person-sex.
ENDLOOP.

这个是提交到内存,再显示内存数据的
REPORT  z_b.
INITIALIZATION.
  DATA : list_tab TYPE TABLE OF abaplist.

END-OF-SELECTION.
  SUBMIT z_a EXPORTING LIST TO MEMORY
                AND RETURN.
  CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
      listobject = list_tab
    EXCEPTIONS
      not_found  = 1
      OTHERS     = 2.
  IF sy-subrc = 0.
    CALL FUNCTION 'WRITE_LIST'
      TABLES
        listobject = list_tab.

    CALL FUNCTION 'DISPLAY_LIST'
* EXPORTING
*   FULLSCREEN                  =
*   CALLER_HANDLES_EVENTS       =
*   STARTING_X                  = 10
*   STARTING_Y                  = 10
*   ENDING_X                    = 60
*   ENDING_Y                    = 20
* IMPORTING
*   USER_COMMAND                =
      TABLES
        listobject                  = list_tab
* EXCEPTIONS
*   EMPTY_LIST                  = 1
*   OTHERS                      = 2
              .
    IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
  ENDIF.

0条评论 你不来一发么↓

    想说点什么呢?