Google Search - Blog...........

ABAP - Simple Interactive Report Program.

REPORT z_sg_interactive_rep.

TYPES : BEGIN OF str_sflight,
carrid TYPE sflight-carrid,
carrname TYPE scarr-carrname,
url TYPE scarr-url,
END OF str_sflight.

DATA : it_sflight TYPE str_sflight OCCURS 0 with header line,
wa_sflight LIKE LINE OF it_sflight.

TYPES : BEGIN OF str_car,
carrid TYPE sflight-carrid,
END OF str_car.


DATA : itab TYPE str_car OCCURS 0 with header line,
wa_itab like line of itab.

DATA : fnam(20), var(20).
*-- top of page
TOP-OF-PAGE.

PERFORM top_of_page.

*--start of selection
START-OF-SELECTION.

PERFORM FETCH_CARRID.

*--at line selection
AT LINE-SELECTION.
case sy-lsind.
when 1.

if itab[] is not initial.
get cursor field fnam value var.

SELECT carrid
carrname
url
INTO TABLE it_sflight
FROM scarr
where carrid = var.
endif.
perform top_of_page.

LOOP AT it_sflight where carrid = var." INTO wa_sflight.
WRITE : 5 it_sflight-carrid,
15 it_sflight-carrname,
60 it_sflight-url.
ENDLOOP.
endcase.
*-----------------------------------------------------------------------
*text
*-----------------------------------------------------------------------
FORM FETCH_CARRID.
SELECT DISTINCT
carrid
FROM sflight
INTO TABLE itab.
LOOP AT itab." into wa_itab.
WRITE :/5 itab-carrid.
ENDLOOP.
ENdFORM.

*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM top_of_page.
WRITE : /1 sy-vline,
5 'AIRLINE CODE' COLOR COL_BACKGROUND,
20 sy-vline,
25 'AIRLINE NAME' COLOR COL_BACKGROUND,
40 sy-vline,
45 'FARE' COLOR COL_BACKGROUND,
60 sy-vline,
65 'URL' COLOR COL_BACKGROUND,
80 sy-vline.
ULINE.
SKIP 2.
ENDFORM. "top_of_page

No comments:

Post a Comment