GoodleAds

INTERACTIVE REPORT USING SY-LISEL VARIABLE

INTERACTIVE REPORT USING SY-LISEL VARIABLE :


SY-LISEL- stands for line select. This is a system variable and stores the line selected by the user in a report.
In the below program we use sy-lisel to create an interactive report.

Scenario- Display company code, company name and city in the basic list. If the user double click on any one of the record then display company code, vendor and reconcilation account in the next list. If the user double click on any one  of the record then display vendor no, vendor name and city in the next list.


*&---------------------------------------------------------------------*
*& Report  ZR_INTA_REPORT_SY_LISEL_TECH
*&
*&---------------------------------------------------------------------*
REPORT ZR_INTA_REPORT_SY_LISEL_TECH.
DATA V1 TYPE T001-BUKRS.
SELECT-OPTIONS S_BUKRS FOR V1.
TYPESBEGIN OF TY_T001,
       BUKRS 
TYPE T001-BUKRS,
       BUTXT 
TYPE T001-BUTXT,
       ORT01 
TYPE T001-ORT01,
       
END OF TY_T001.
DATA : WA_T001 TYPE TY_T001,
       IT_T001 
TYPE TABLE OF TY_T001.
TYPESBEGIN OF TY_LFB1,
       BUKRS 
TYPE LFB1-BUKRS,
       LIFNR 
TYPE LFB1-LIFNR,
       AKONT 
TYPE LFB1-AKONT,
       
END OF TY_LFB1.
DATA : WA_LFB1 TYPE TY_LFB1,
       IT_LFB1 
TYPE TABLE OF TY_LFB1.
TYPESBEGIN OF TY_LFA1,
       LIFNR 
TYPE LFA1-LIFNR,
       NAME1 
TYPE LFA1-NAME1,
       ORT01 
TYPE LFA1-ORT01,
       
END OF TY_LFA1.
DATA : WA_LFA1 TYPE TY_LFA1,
       IT_LFA1 
TYPE TABLE OF TY_LFA1.
DATA TYPE T001-BUKRS.
AT SELECTION-SCREEN.
 
SELECT SINGLE BUKRS
   
FROM T001
   
INTO WHERE
   BUKRS 
IN S_BUKRS.
 
IF SY-SUBRC <> 0.
 
MESSAGE E000(ZMESSAGE1WITH 'INVALID NUMBER'.
 
ENDIF.
START-OF-SELECTION.
 
SELECT BUKRS BUTXT ORT01
   
FROM T001
   
INTO TABLE IT_T001
   
WHERE BUKRS IN S_BUKRS.

 
LOOP AT IT_T001 INTO WA_T001.
 
WRITE:/ WA_T001-BUKRSWA_T001-BUTXTWA_T001-ORT01.
 
ENDLOOP.
AT LINE-SELECTION.
 
IF SY-LSIND '1'.
 
SELECT BUKRS LIFNR AKONT
   
FROM LFB1
   
INTO TABLE IT_LFB1
   
WHERE BUKRS SY-LISEL+0(4).

 
LOOP AT IT_LFB1 INTO WA_LFB1.
 
WRITE:/ WA_LFB1-BUKRSWA_LFB1-LIFNRWA_LFB1-AKONT.
 
ENDLOOP.

 
ELSEIF SY-LSIND '2'.
 
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
 
EXPORTING
 
INPUT SY-LISEL+5(10)
 
IMPORTING
 
OUTPUT SY-LISEL+5(10).
 
SELECT LIFNR NAME1 ORT01
   
FROM LFA1
   
INTO TABLE IT_LFA1
   
WHERE LIFNR SY-LISEL+5(10).

 
LOOP AT IT_LFA1 INTO WA_LFA1.
 
WRITE:/ WA_LFA1-LIFNRWA_LFA1-NAME1WA_LFA1-ORT01.
 
ENDLOOP.

 
ENDIF.
TOP-OF-PAGE DURING LINE-SELECTION.
 
IF SY-LSIND '1'.
 
WRITE'THESE ARE VENDORS UNDER COMPANY:', SY-LISEL+0(4).
 
ELSEIF SY-LSIND '2'.
 
WRITE'THESE ARE VENDOR DETAILS OF :'SY-LISEL+5(10).
 
ENDIF.

OUTPUT:
BASIC LIST

IF YOU DOUBLE CLICK ON ANY ONE OF THE RECORD THEN THE NEXT LIST IS AS FOLLOWS.

IF YOU DOUBLE CLIKC ON ANY ONE OF THE RECORD THEN THE NEXT LIST IS AS FOLLOWS.

No comments:

Post a Comment