Write ztable content into screen

AIM:   Write a ztable content in screen with colume header.


REPORT  ztable_pro1.

TYPES: BEGIN OF temp_zcust_details1,
        kunnr TYPE zkunnr,
        country TYPE zcountry,
END OF temp_zcust_details1.

TYPES:BEGIN OF tp_zcust_details2,
      kunnr TYPE zkunnr,
      pur_ord_no TYPE zpur_ord_no,
      END OF tp_zcust_details2.

DATA: temp_zcust_details1 TYPE STANDARD TABLE OF temp_zcust_details1,
      wa_temp_zcust_details1 TYPE temp_zcust_details1,
      t_zcust_details2 TYPE TABLE OF tp_zcust_details2,
      wa_zcust_details2 TYPE tp_zcust_details2.

SELECT kunnr
       country
  FROM zcust_details1
  INTO TABLE temp_zcust_details1.

IF sy-subrc = 0.
  SELECT kunnr
         pur_ord_no
    FROM zcust_details2
    INTO TABLE  t_zcust_details2
    FOR ALL ENTRIES IN temp_zcust_details1
    WHERE kunnr = temp_zcust_details1-kunnr.

  IF sy-subrc = 0.
    WRITE: 'Customer Number' ,20 'Purch. Number'.      "colume header with position
    LOOP AT t_zcust_details2 INTO wa_zcust_details2.
      WRITE: / wa_zcust_details2-kunnr.
      WRITE: 20 wa_zcust_details2-pur_ord_no.
    ENDLOOP.
  ENDIF.
ENDIF.

________________________________________________________________________________

AIM: Using uline.

REPORT  zuline_pro1.

types: begin of tp_str,
          kunnr TYPE zkunnr,
          join_date TYPE zjoin_date,
          country TYPE zcountry,
          end of tp_str.

data: int_tab_zcust_details1 type standard table of tp_str,
        wa_zcust_details1 type tp_str.

select kunnr
         join_date
        country
from zcust_details1
into table int_tab_zcust_details1.

if sy-subrc = 0.
write: 'zcust_details'.                                 "report header
uline.                                                        "uline is used for underline
    LOOP AT int_tab_zcust_details1 into wa_zcust_details1.
      write: / wa_zcust_details1-kunnr,
                 wa_zcust_details1-join_date,
                25 wa_zcust_details1-country.  "25 is the colume position
    ENDLOOP.
endif.

Share this

Related Posts