Interactive Report – 4

*Interactive Report using  SY-LISEL  technique*

REPORT  YSP_0123 NO STANDARD PAGE HEADING.

DATA : IT_VBAK TYPE TABLE OF VBAK,

            WA_VBAK TYPE VBAK,

            IT_VBAP TYPE TABLE OF VBAP,

            WA_VBAP TYPE VBAP.

SELECT-OPTIONS : S_VBELN FOR WA_VBAK-VBELN.

DATA : D_VBELN TYPE VBELN.

START-OF-SELECTION.

SELECT * FROM VBAK INTO TABLE IT_VBAK WHERE VBELN IN S_VBELN.

SORT IT_VBAK BY VBELN.

END-OF-SELECTION.

LOOP AT IT_VBAK INTO WA_VBAK.

WRITE : /1 WA_VBAK-VBELN,

         10 WA_VBAK-ERDAT,

         20 WA_VBAK-ERNAM,

         30 WA_VBAK-NETWR,

         40 WA_VBAK-ANGDT.

ENDLOOP.

AT LINE-SELECTION.

IF SY-LSIND = 1.

WRITE : / ‘INTERACTIVE LIST’, SY-LISEL. ” sy-lisel – holds the “content of the line on which the user double clicked on the “basic list

D_VBELN = SY-LISEL+0(4).

SELECT * FROM VBAP INTO TABLE IT_VBAP WHERE VBELN =                                                                                               D_VBELN.

IF SY-SUBRC = 0.

LOOP AT IT_VBAP INTO WA_VBAP.

WRITE : /1 WA_VBAP-VBELN,

               10 WA_VBAP-POSNR,

               20 WA_VBAP-MATNR,

               30 WA_VBAP-MATKL.

ENDLOOP.

ENDIF.

ENDIF.

Output-

c30

c31

c32


 

*Interactive report using SY-LISEL Technique with HOT-SPOT ON *

REPORT  ZREP_0015  NO STANDARD PAGE HEADING LINE-COUNT 30(2).

DATA : VAL TYPE C LENGTH 2.

data : it_spfli type table of spfli,

       wa_spfli type spfli.

data : it_sFLIGHT type table of sFLIGHT,

       wa_SFLIGHT type SFLIGHT.

data : it_sBOOK type table of sBOOK,

         wa_SBOOK type SBOOK.

SELECT-OPTIONS : S_CARRID FOR WA_SPFLI-CARRID

                 DEFAULT ‘AA’ TO ‘ZZ’.

start-of-selection.

  select * from spfli into table it_spfli

  WHERE CARRID IN S_CARRID..

end-of-selection.

  loop at it_spfli into wa_spfli.

    write : /1 wa_spfli-carrid HOTSPOT ON,

             6 wa_spfli-connid,

             12 wa_spfli-COUNTRYFR,

             22 wa_spfli-COUNTRYTO,

             32 wa_spfli-AIRPFROM,

             42 wa_spfli-AIRPTO,

             52 wa_spfli-CITYFROM,

             62 wa_spfli-cityto.

  endloop.

top-of-page.

  write : /1 ‘CARRID’,

           10 ‘CONNID’,

           20 ‘COUNTRY FROM’,

           30 ‘COUNTRY TO’,

           40 ‘AIR FROM’,

           50 ‘AIRP TO’,

           60 ‘CITY FROM’,

           70 ‘CITY TO’.

  ULINE /1(75).

end-of-page.

  WRITE : / ‘FLIGHT DETAILS ‘.

  ULINE /1(75).

AT LINE-SELECTION.

  CASE SY-LSIND.

    WHEN 1.

      VAL = SY-LISEL+0(2).

      SELECT * FROM SFLIGHT INTO TABLE IT_SFLIGHT

      WHERE CARRID = VAL.

      IF SY-SUBRC = 0.

        LOOP AT IT_SFLIGHT INTO WA_SFLIGHT.

          WRITE : /1 WA_SFLIGHT-CARRID,

                   10 WA_SFLIGHT-CONNID,

                   20 WA_SFLIGHT-FLDATE,

                   30 WA_SFLIGHT-PRICE LEFT-JUSTIFIED,

                   45 WA_SFLIGHT-SEATSMAX,

                   55 WA_SFLIGHT-SEATSOCC.

        ENDLOOP.

      ELSE.

        WRITE : / ‘NO RECORDS FOUND’.

      ENDIF.

  ENDCASE.


 

 *Interactive Report using SY_LISEL Technique *

report  zinteractive_rep4 no standard page heading line-count 15(2).

data : carr type char3.

data : it_spfli type table of spfli,

           wa_spfli type spfli.

 

data : it_sflight type table of sflight,

       wa_sflight type sflight.

 

data : it_sbook type table of sbook,

          wa_sbook type sbook.

 

select-options : p_carrid for wa_spfli-carrid.

 

start-of-selection.

  select * from spfli into table it_spfli

  where carrid in p_carrid.

 

end-of-selection.

  loop at it_spfli into wa_spfli.

    write :/ wa_spfli-carrid,

             wa_spfli-connid,

             wa_spfli-countryfr,

             wa_spfli-countryto,

             wa_spfli-cityfrom,

             wa_spfli-cityto,

             wa_spfli-airpfrom,

             wa_spfli-airpto.

 

  clear  wa_spfli.

  endloop.

 

top-of-page.

  write :/ ‘details from spfli table’.

  uline.

 

end-of-page.

  write :/ ‘thanks visit again’.

  uline.

 

at line-selection.

  case sy-lsind.

    when ‘1’.

carr = sy-lisel+0(2).

  select * from sflight into table it_sflight

  where carrid = carr.

    clear carr.

   if it_sflight is not initial.

     loop at it_sflight into wa_sflight.

       write :/ wa_sflight-carrid,

                wa_sflight-connid,

                wa_sflight-fldate,

                wa_sflight-price,

                wa_sflight-seatsmax,

                wa_sflight-seatsocc.

 clear wa_sflight.

       endloop.

     endif.

 

when ‘2’.

  carr = sy-lisel+0(2).

  select * from sbook into table it_sbook

  where carrid = carr.

    if it_sbook is not initial.

      loop at it_sbook into wa_sbook.

        write :/ wa_sbook-carrid,

                 wa_sbook-connid,

                 wa_sbook-fldate,

                 wa_sbook-bookid,

                 wa_sbook-customid,

                 wa_sbook-custtype.

 

        clear wa_sbook.

        endloop.

      endif.

  endcase.

 

top-of-page during line-selection.

  case sy-lsind.

    when ‘1’.

      write :/ ‘details from sflight table’.

when ‘2’.

      write :/ ‘details from sbook table’.

  endcase.

  uline. 

Output-

c40

c41

c42

c43


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s