Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Interactive Report

kiran_k8
Active Contributor
0 Likes
1,306

Hi Folks,

I am in the process of creating an interactive report.When I move from basic list to list 1 it is going fine but when I add one more list,it is not working fine.

i.e

When I execute the report and press a field on basic list it is displaying both list 1 and list 2 in the list 1 itself.what could be the reason.

Thanks,

K.Kiran

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,291

Hi.

I think you process the WRITE statements of the first part again.

Check your coding, if you are calling a perform or function module again after navigating to list 2.

Regards,

Timo.

11 REPLIES 11
Read only

Former Member
0 Likes
1,292

Hi.

I think you process the WRITE statements of the first part again.

Check your coding, if you are calling a perform or function module again after navigating to list 2.

Regards,

Timo.

Read only

0 Likes
1,291

Timo,

I am getting the right data in both the lists.The problem is instead of displaying it as list 2 it is displaying as list 1.List 1 has the data of even list 2.I want the list 2 only when I press a field in list.

Even though the data is right.

K.Kiran.

Read only

0 Likes
1,291

hi kiran,

u have to use sy-lsind for this .

if ur are in second list .write a code

if sy-lsind eq 2

loop at ....

write....

endloop.

endif.

try this i am sure it will work .

dont forget to put full marks for it....

Read only

Former Member
0 Likes
1,291

are you working on ALV or Normal Report ?

See the below example code for interactive :

/* 3 Level Interactive Report */ &----


*& Report ZTEJ_INTAB1 *

*& *

&----


*& *

*& *

&----


REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE

HEADING.

*TABLES DECLARATION

TABLES : KNA1, VBAK, VBAP.

*SELECT OPTIONS

SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.

*INITIALIZATION

INITIALIZATION.

CUST_NO-LOW = '01'.

CUST_NO-HIGH = '5000'.

CUST_NO-SIGN = 'I'.

CUST_NO-OPTION = 'BT'.

APPEND CUST_NO.

*SELECTION SCREEN VALIDATION

AT SELECTION-SCREEN ON CUST_NO.

LOOP AT SCREEN.

IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.

MESSAGE E001(ZTJ1).

ENDIF.

ENDLOOP.

*BASIC LIST SELECTION

START-OF-SELECTION.

SELECT KUNNR NAME1 ORT01 LAND1 INTO

(KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)

FROM KNA1

WHERE KUNNR IN CUST_NO.

WRITE:/1 SY-VLINE,

KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,

16 SY-VLINE,

KNA1-NAME1 UNDER 'NAME',

61 SY-VLINE,

KNA1-ORT01 UNDER 'CITY',

86 SY-VLINE,

KNA1-LAND1 UNDER 'COUNTRY',

103 SY-VLINE.

HIDE: KNA1-KUNNR.

ENDSELECT.

ULINE.

*SECONDARY LIST ACCESS

AT LINE-SELECTION.

IF SY-LSIND = 1.

PERFORM SALES_ORD.

ENDIF.

IF SY-LSIND = 2.

PERFORM ITEM_DET.

ENDIF.

*TOP OF PAGE

TOP-OF-PAGE.

FORMAT COLOR 1.

WRITE : 'CUSTOMER DETAILS'.

FORMAT COLOR 1 OFF.

ULINE.

FORMAT COLOR 3.

WRITE : 1 SY-VLINE,

3 'CUSTOMER NO.',

16 SY-VLINE,

18 'NAME',

61 SY-VLINE,

63 'CITY',

86 SY-VLINE,

88 'COUNTRY',

103 SY-VLINE.

ULINE.

FORMAT COLOR 3 OFF.

*TOP OF PAGE FOR SECONDARY LISTS

TOP-OF-PAGE DURING LINE-SELECTION.

*TOP OF PAGE FOR 1ST SECONDARY LIST

IF SY-LSIND = 1.

ULINE.

FORMAT COLOR 1.

WRITE : 'SALES ORDER DETAILS'.

ULINE.

FORMAT COLOR 1 OFF.

FORMAT COLOR 3.

WRITE : 1 SY-VLINE,

3 'CUSTOMER NO.',

16 SY-VLINE,

18 'SALES ORDER NO.',

40 SY-VLINE,

42 'DATE',

60 SY-VLINE,

62 'CREATOR',

85 SY-VLINE,

87 'DOC DATE',

103 SY-VLINE.

ULINE.

ENDIF.

FORMAT COLOR 3 OFF.

*TOP OF PAGE FOR 2ND SECONDARY LIST

IF SY-LSIND = 2.

ULINE.

FORMAT COLOR 1.

WRITE : 'ITEM DETAILS'.

ULINE.

FORMAT COLOR 1 OFF.

FORMAT COLOR 3.

WRITE : 1 SY-VLINE,

3 'SALES ORDER NO.',

40 SY-VLINE,

42 'SALES ITEM NO.',

60 SY-VLINE,

62 'ORDER QUANTITY',

103 SY-VLINE.

ULINE.

ENDIF.

FORMAT COLOR 3 OFF.

*END OF PAGE

END-OF-PAGE.

ULINE.

WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',

SY-PAGNO.

SKIP.

&----


*& Form SALES_ORD

*&

*& FIRST SECONDARY LIST FORM

&----


FORM SALES_ORD .

SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO

(VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)

FROM VBAK

WHERE KUNNR = KNA1-KUNNR.

WRITE:/1 SY-VLINE,

VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,

16 SY-VLINE,

VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,

40 SY-VLINE,

VBAK-ERDAT UNDER 'DATE',

60 SY-VLINE,

VBAK-ERNAM UNDER 'CREATOR',

85 SY-VLINE,

VBAK-AUDAT UNDER 'DOC DATE',

103 SY-VLINE.

HIDE : VBAK-VBELN.

ENDSELECT.

ULINE.

ENDFORM. " SALES_ORD

&----


*& Form ITEM_DET

*&

*& SECOND SECONDARY LIST FORM

&----


FORM ITEM_DET .

SELECT VBELN POSNR KWMENG INTO

(VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)

FROM VBAP

WHERE VBELN = VBAK-VBELN.

WRITE : /1 SY-VLINE,

VBAP-VBELN UNDER 'SALES ORDER NO.',

40 SY-VLINE,

VBAP-POSNR UNDER 'SALES ITEM NO.',

60 SY-VLINE,

VBAP-KWMENG UNDER 'ORDER QUANTITY',

103 SY-VLINE.

ENDSELECT.

ULINE.

ENDFORM. " ITEM_DET

Read only

0 Likes
1,291

this is the logic kiran

at line-selection.

select matnr ernam from mara into corresponding fields of table itab2 where matnr = itab1-matnr.

if sy-lsind eq 2.

loop at itab2.

write: itab2-ernam.

endloop.

endif.

Read only

Former Member
0 Likes
1,291

Hi Kiran,

The SY-LSIND value gives the list level. Check this value and code the contents you want in your second list only if the SY-LSIND value is 2.

Regards

Anil Madhavan

Read only

Former Member
0 Likes
1,291

Hi kiran,

plz refer the following program .it will be useful.

report  zinteractivereportsv1                   .


tables: mara,vbap.

data : begin of itab occurs 0,
       matnr like mara-matnr,
       ernam like mara-ernam,
       end of itab.

data :  begin of itab1 occurs 0,
        matnr like vbap-matnr,
        vbeln like vbap-vbeln,
        end of itab1.
data: fld(20) type c,val like mara-matnr .

selection-screen begin of block blk1 with frame title text-001.
select-options: m for mara-matnr obligatory.
selection-screen end of block blk1.

at selection-screen on m.
  select single matnr from mara into mara-matnr where matnr = m-low.
  if sy-subrc ne 0.
    message e000(zz) with 'invalid ' mara-matnr 'in your ' 'selection'.
  endif.



start-of-selection.
  select matnr ernam into table itab from mara where matnr in m.
  select matnr vbeln into table itab1 from vbap for all entries in itab
  where matnr = itab-matnr.



end-of-selection.
  loop at itab.
    write:/30 itab-matnr,60 itab-ernam.
*    hide itab-matnr.
    clear itab-matnr.
  endloop.
set pf-status 'XX2'.


at line-selection.
    get cursor field fld  value val.
   case fld.
   when 'ITAB-MATNR'.
   write:/ val.
   endcase.
  case sy-lsind.
    when '1'.
      set pf-status 'XX2'.
      set titlebar 'XX2'.
      if itab1[] is initial.
        write:/ 'no data found for itab1 in first secondary list'.
      endif.
      loop at itab1.
        write:/30 itab1-matnr,60 itab1-vbeln.
*        hide itab1-matnr.
      endloop.
      when '2'.
      set pf-status 'XX2'.
      set titlebar 'XX2'.
      loop at itab.
        write:/30 itab-matnr,60 itab-ernam.
      endloop.
  endcase.

at user-command.
case sy-ucomm.
     when 'SET'.
      if sy-lsind = 1.
        window starting at 5 3 ending at 40 10.
        write 'Select line for a second window'.
      elseif sy-lsind = 2.
        window starting at 45 10 ending at 60 12.
        write 'Last window'.
      endif.

Thanks,

Suma.

Read only

kiran_k8
Active Contributor
0 Likes
1,291

Hi Folks,

Now it is working fine once checking the sy-lsind.But now I want the list if I click only on a particular field.But my report is moving to list 1 and list 2 irrespective of the field for which I have given hotspot.It is even getting the list even if I click on the other fields.

What could be the reason?

Thanks,

K.Kiran.

Read only

Former Member
0 Likes
1,291

yes kiran

it will select the entire row .so dont worry abt it .But it will take the variable what u have selected only .it is not an error.so continue.

Read only

Former Member
0 Likes
1,291

use get cursor field command ,then you will get it.

Read only

kiran_k8
Active Contributor
0 Likes
1,291

thanks