Interactive Report – 5

*INTERACTIVE REPORTING(1) USING GET CURSOR TECHNIQUE *

REPORT  ZREP_0014 NO STANDARD PAGE HEADING  line-count 30(2)

DATA : FNAME TYPE C LENGTH 20,

          FVALUE TYPE C LENGTH 20.              .

 

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,

             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.

 

  GET CURSOR FIELD FNAME VALUE FVALUE.

 

  CASE SY-LSIND.

    WHEN ‘1’.

      IF FNAME = ‘WA_SPFLI-CARRID’.

      SELECT * FROM SFLIGHT INTO TABLE IT_SFLIGHT

      WHERE CARRID = FVALUE.

      ENDIF.

      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.

  ENDCASE.

 

TOP-OF-PAGE DURING LINE-SELECTION.

 

  CASE SY-LSIND.

 

    WHEN ‘1’.

      WRITE : /1 ‘CARRID’,

                10 ‘CONNID’,

                20 ‘FLDATE’,

                30 ‘PRICE’,

                40 ‘MAX SEAT’,

                50 ‘AVAI SEAT’.

 

  ENDCASE.

Output-

c50c51c52


 

* INTERACTIVE REPORT(2) ON GET CURSOR TECHNIQUE *  

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 : V_VALUE TYPE VBELN.

DATA F_NAME(15) TYPE C.

START-OF-SELECTION.

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

  SORT IT_VBAK BY VBELN.

END-OF-SELECTION.

IF IT_VBAK IS NOT INITIAL.

  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.

ENDIF.

AT LINE-SELECTION.

  GET CURSOR FIELD F_NAME VALUE V_VALUE.

      IF SY-LSIND = 1.

    IF F_NAME = ‘WA_VBAK-VBELN’.

      WRITE : ‘TESTING GET CURSOR’.

      CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’

        EXPORTING

          INPUT         = V_VALUE

       IMPORTING

         OUTPUT        = V_VALUE

                .

      SELECT * FROM VBAP INTO TABLE IT_VBAP

       WHERE VBELN = V_VALUE.

 IF IT_VBAP IS NOT INITIAL.

      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.


 

 * INTERACTIVE REPORT(3) ON GET CURSOR TECHNIQUE *

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

 

data : name type c length 20,

         val type c length 20.

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 HOTSPOT ON,

             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.

 

get cursor field name value val.

  case SY-LSIND.

    when ‘1’.

 

      IF NAME = ‘WA_SPFLI-CARRID’.

  select * from sflight into table it_sflight

  where carrid = val.

   if it_sflight is not initial.

     loop at it_sflight into wa_sflight.

       write :/ wa_sflight-carrid HOTSPOT ON,

                wa_sflight-connid,

                wa_sflight-fldate,

                wa_sflight-price,

                wa_sflight-seatsmax,

                wa_sflight-seatsocc.

 clear wa_sflight.

       endloop.

     endif.

     ENDIF.

 

when ‘2’.

IF NAME = ‘WA_SFLIGHT-CARRID’.

  select * from sbook into table it_sbook where carrid = VAL.

    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.

 

      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.


 

*INTERACTIVE REPORT WITH GET CURSOR AND USER-COMMAND *

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

data : name type c length 20,

        val type c length 20.

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.

SET PF-STATUS ‘STATUS1’. ” Create Two buttons ‘DICT’ and ‘WORK’

  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 HOTSPOT ON,

             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.

get cursor field name value val.

  case SY-LSIND.

    when ‘1’.

      IF NAME = ‘WA_SPFLI-CARRID’.

  select * from sflight into table it_sflight where carrid = val.

   if it_sflight is not initial.

     loop at it_sflight into wa_sflight.

       write :/ wa_sflight-carrid HOTSPOT ON,

                wa_sflight-connid,

                wa_sflight-fldate,

                wa_sflight-price,

                wa_sflight-seatsmax,

                wa_sflight-seatsocc.

 clear wa_sflight.

       endloop.

     endif.

     ENDIF.

when ‘2’.

IF NAME = ‘WA_SFLIGHT-CARRID’.

  select * from sbook into table it_sbook where CARRID = VAL.

    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.

      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.

  AT USER-COMMAND. ” FUNCTION CODE -‘ PICK’ FOR F2-CHOOSE FOR                        ” DOUBLE CLICK EVENT SET IN PF STATUS

    CASE SY-UCOMM.

      WHEN ‘DICT’.

        CALL TRANSACTION ‘SE11’.

       WHEN ‘WORK’.

         CALL TRANSACTION ‘SE80’.

      ENDCASE.


 

*  CALLING A REPORT PROGRAM WITHIN A REPORT PROGRAM WITH SUBMIT STATEMENT *

REPORT  ZREP_0017  NO STANDARD PAGE HEADING LINE-COUNT 35(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,

             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.

    HIDE : WA_SPFLI-CARRID.

  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’.

      SELECT * FROM SFLIGHT INTO TABLE IT_SFLIGHT

      WHERE CARRID =

    WA_SPFLI-CARRID.

      LOOP AT IT_SFLIGHT INTO WA_SFLIGHT.

        WRITE :/1 WA_SFLIGHT-CARRID,

                10 WA_SFLIGHT-CONNID,

                20 WA_SFLIGHT-FLDATE.

      ENDLOOP.

     WHEN ‘2’.

 SUBMIT ZREP_0018. ” (DOUBLE CLICK ON THE NAME ‘ZREP_0018’ AND CREATE A REOPRT PROGRAM . WHEN THE USER DOUBLE CLICKS ON THE FIRST INERACTIVE LIST ,  THEN THE CONTROL IS TRANSFERRED TO THIS PROGRAM.) “

  ENDCASE.


 

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