INTERACTIVE REPORT USING GET CURSOR TECHNIQUE

INTERACTIVE REPORT USING GET CURSOR TECHNIQUE :

Note: - Hide & SY-LISEL techniques generates the next list based on the line-selection. If you want to generate the next list based on the field selection then we go for get-cursor technique.

Get-cursor technique: - Get-cursor technique writes the field name as well as field value which is clicked by the user.

Syntax: - Get-cursor field <variable 1> value <variable 2>

PROGRAM:  

*&---------------------------------------------------------------------*
*& Report  ZR_INTA_REPORT_GET_CURSOR_TECH
*&
*&---------------------------------------------------------------------*
REPORT ZR_INTA_REPORT_GET_CURSOR_TECH.
data V3(10type c.
data V1 type vbak-vbeln,
       V2
(15TYPE C.
select-options s_vbeln for v1.
typesbegin of ty_vbak,
       vbeln 
type vbak-vbeln,
       audat 
type vbak-audat,
       kunnr 
type vbak-kunnr,
 
end of ty_vbak.
datawa_vbak type ty_vbak,
      it_vbak 
type table of ty_vbak.
typesbegin of ty_vbap,
       vbeln 
type vbap-vbeln,
       posnr 
type vbap-posnr,
       kwmeng 
type vbap-kwmeng,
       meins 
type vbap-meins,
       netwr 
type vbap-netwr,
       
end of ty_vbap.
datawa_vbap type ty_vbap,
      it_vbap 
type table of ty_vbap.
typesbegin of ty_kna1,
       kunnr 
type kna1-kunnr,
       name1 
type kna1-name1,
       ort01 
type kna1-ort01,
       
end of ty_kna1.
datawa_kna1 type ty_kna1,
      it_kna1 
type table of ty_kna1.


select vbeln audat kunnr
  
from vbak
  
into table it_vbak
  
where vbeln in s_vbeln.


loop at it_vbak into wa_vbak.
 
write:wa_vbak-vbelnwa_vbak-audatwa_vbak-kunnr.
endloop.


at line-selection.
 
if sy-lsind '1'.
 
get cursor field v2 value v3.
 
IF V2 'WA_VBAK-VBELN'.
 

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
 
EXPORTING
    
INPUT V3
 
IMPORTING
    
OUTPUT V3.
 
SELECT VBELN POSNR KWMENG MEINS NETWR
   
FROM VBAP
   
INTO TABLE IT_VBAP
   
WHERE VBELN V3.

 
LOOP AT IT_VBAP INTO WA_VBAP.
 
WRITE:/ WA_VBAP-VBELN,
         WA_VBAP-POSNR,
         WA_VBAP-MEINS,
         WA_VBAP-KWMENG,
         WA_VBAP-NETWR.

 
ENDLOOP.

 
ELSEIF V2 'WA_VBAK-KUNNR'.
 

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
 
EXPORTING
   
INPUT V3
 
IMPORTING
   
OUTPUT V3.
 
SELECT KUNNR NAME1 ORT01
   
FROM KNA1
   
INTO TABLE IT_KNA1
   
WHERE KUNNR V3.

 
LOOP AT IT_KNA1 INTO WA_KNA1.
 
WRITE:/ WA_KNA1-KUNNR,
         WA_KNA1-NAME1,
         WA_KNA1-ORT01.

 
ENDLOOP.
 
ENDIF.
 
ENDIF.



OUTPUT: 

BASIC LIST



IF YOU DOUBLE CLICK ON SALES DOC NO



IF YOU DOUBLE CLICK ON CUSTOMER NO