REPORT zinteractive_classic_get_curso NO STANDARD PAGE HEADING .
TYPES : BEGIN OF gty_ekko,
ebeln TYPE ekko-ebeln,
bukrs TYPE ekko-bukrs,
lifnr TYPE ekko-lifnr,
END OF gty_ekko,
BEGIN OF gty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
txz01 TYPE ekpo-txz01,
matnr TYPE ekpo-matnr,
END OF gty_ekpo,
BEGIN OF gty_lfa1,
lifnr TYPE lifnr,
name1 TYPE name1,
land1 TYPE land1,
ort01 TYPE ort01,
END OF gty_lfa1,
BEGIN OF gty_t001,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
land1 TYPE t001-land1,
ort01 TYPE t001-ort01,
END OF gty_t001,
BEGIN OF gty_makt,
matnr TYPE matnr,
maktx TYPE maktx,
END OF gty_makt.
DATA : gt_ekko TYPE TABLE OF gty_ekko,
gt_ekpo TYPE TABLE OF gty_ekpo,
gt_t001 TYPE TABLE OF gty_t001,
gt_lfa1 TYPE TABLE OF gty_lfa1,
gt_makt TYPE TABLE OF gty_makt,
gs_ekko TYPE gty_ekko,
gs_ekpo TYPE gty_ekpo,
gs_t001 TYPE gty_t001,
gs_lfa1 TYPE gty_lfa1,
gs_makt TYPE gty_makt.
DATA : fnam(20),
var(20).
*-- top of page
TOP-OF-PAGE.
PERFORM top_of_page.
*--start of selection
START-OF-SELECTION.
PERFORM fetch_data.
*--at line selection
AT LINE-SELECTION.
GET CURSOR FIELD fnam VALUE var.
CASE fnam.
WHEN 'GS_EKKO-BUKRS'.
SELECT bukrs
butxt
land1
ort01
FROM t001
INTO TABLE gt_t001
WHERE bukrs = var.
WRITE :/1 sy-vline,
4 'BUKRS' COLOR 5,
40 'LAND1' COLOR 5,
80 'ORT01' COLOR 5.
LOOP AT gt_t001 INTO gs_t001.
WRITE :/1 sy-vline,
4 gs_t001-bukrs,
40 gs_t001-land1,
80 gs_t001-ort01.
ENDLOOP.
WHEN 'GS_EKKO-EBELN'.
SELECT ebeln
ebelp
txz01
matnr
FROM ekpo INTO TABLE gt_ekpo WHERE ebeln = var.
WRITE :/1 sy-vline,
4 'EBELN' COLOR 5,
20 'EBELP' COLOR 5,
50 'TXZ01' COLOR 5,
80 'MATNR' COLOR 5.
LOOP AT gt_ekpo INTO gs_ekpo.
WRITE :/1 sy-vline,
4 gs_ekpo-ebeln,
20 gs_ekpo-ebelp,
50 gs_ekpo-txz01,
80 gs_ekpo-matnr.
ENDLOOP.
WHEN 'GS_EKKO-LIFNR'.
SELECT lifnr
land1
ort01 FROM lfa1
INTO TABLE gt_lfa1 WHERE lifnr = var.
LOOP AT gt_t001 INTO gs_t001.
WRITE :/1 sy-vline,
4 gs_lfa1-lifnr,
40 gs_lfa1-land1,
80 gs_lfa1-ort01.
ENDLOOP.
WHEN 'GS_EKPO-MATNR'.
DATA: lv_matnr LIKE makt-matnr.
MOVE var TO lv_matnr.
SELECT matnr maktx FROM makt INTO
TABLE gt_makt WHERE matnr EQ lv_matnr AND spras EQ 'E'.
LOOP AT gt_makt INTO gs_makt.
WINDOW STARTING AT 10 50.
WRITE :/ gs_makt-matnr,
gs_makt-maktx.
ENDLOOP.
ENDCASE.
*-----------------------------------------------------------------------
*text
*-----------------------------------------------------------------------
FORM fetch_data.
SELECT DISTINCT ebeln
bukrs
lifnr
FROM ekko
INTO TABLE gt_ekko UP TO 50 ROWS.
LOOP AT gt_ekko INTO gs_ekko." into wa_itab.
WRITE :/1 sy-vline,
4 gs_ekko-ebeln,
20 sy-vline,
40 gs_ekko-bukrs,
60 sy-vline,
80 gs_ekko-lifnr,
90 sy-vline.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form top_of_page
*----------------------------------------------------------------------*
FORM top_of_page.
WRITE : /1 sy-vline,
4 'EBELN' ,
20 sy-vline,
40 'BUKRS' ,
60 sy-vline,
80'LIFNR' ,
90 sy-vline.
ULINE .
* SKIP 2.
ENDFORM. "top_of_page