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 - query

Former Member
0 Likes
1,058

I am trying to develop a interactive report. If the user clicks the kunnr in the basic list,

the detail list should display order details of that customer.

*&---------------------------------------------------------------------*
*&                     data declaration                                *
*&---------------------------------------------------------------------*

data: begin of itab occurs 0,
      kunnr type kna1-kunnr,
      name1 type kna1-name1,
      land1 type kna1-land1,
      end of itab.

data: begin of jtab occurs 0,
      vbeln type vbak-vbeln,
      erdat type vbak-erdat,
      netwr type vbak-netwr,
      end of jtab.

*&---------------------------------------------------------------------*
*&            selecting and display data for basic list                *
*&---------------------------------------------------------------------*

select kunnr
       name1
       land1
       from kna1 into table itab.

loop at itab.
write:/10 itab-kunnr,
       35  itab-name1,
       70  itab-land1.
endloop.
hide itab-kunnr.

*&---------------------------------------------------------------------*
*&          selecting and display data for detail list                 *
*&---------------------------------------------------------------------*

at line-selection.

case sy-lsind.

when '1'.

select vbeln
       erdat
       netwr
       from vbak into table jtab where kunnr = itab-kunnr.

loop at jtab.
write:/10 jtab-vbeln,
       35 jtab-erdat,
       70 jtab-netwr.
endloop.

endcase.

However what the kunnr I select I am getting same order details in the detail list

How to fix this error.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,030

Hi

Move the <b>hide itab-kunnr.</b> into the loop..endloop

write it after write statement of customer fields in the basic list.

Reward points if useful

Regards

Anji

11 REPLIES 11
Read only

Former Member
0 Likes
1,030

See the below code:

&----


*& data declaration *

&----


data: begin of itab occurs 0,

kunnr type kna1-kunnr,

name1 type kna1-name1,

land1 type kna1-land1,

end of itab.

data: begin of jtab occurs 0,

vbeln type vbak-vbeln,

erdat type vbak-erdat,

netwr type vbak-netwr,

end of jtab.

&----


*& selecting and display data for basic list *

&----


select kunnr

name1

land1

from kna1 into table itab.

loop at itab.

hide itab-kunnr.

write:/10 itab-kunnr,

35 itab-name1,

70 itab-land1.

endloop.

&----


*& selecting and display data for detail list *

&----


at line-selection.

case sy-lsind.

when '1'.

select vbeln

erdat

netwr

from vbak into table jtab where kunnr = itab-kunnr.

loop at jtab.

write:/10 jtab-vbeln,

35 jtab-erdat,

70 jtab-netwr.

endloop.

endcase.

Hide should use in within loop and before write statment in loop condition

Reward Points if it is helpful

Thanks

Seshu

Read only

Former Member
0 Likes
1,030

move your statement hide itab-kunnr. inside the loop.

loop at itab.

write:/10 itab-kunnr,

35 itab-name1,

70 itab-land1.

hide itab-kunnr.

endloop.

Read only

Former Member
0 Likes
1,030

am trying to develop a interactive report. If the user clicks the kunnr in the basic list,

the detail list should display order details of that customer.

&----


*& data declaration *

&----


data: begin of itab occurs 0,

kunnr type kna1-kunnr,

name1 type kna1-name1,

land1 type kna1-land1,

end of itab.

data: begin of jtab occurs 0,

vbeln type vbak-vbeln,

erdat type vbak-erdat,

netwr type vbak-netwr,

end of jtab.

&----


*& selecting and display data for basic list *

&----


select kunnr

name1

land1

from kna1 into table itab.

loop at itab.

write:/10 itab-kunnr,

35 itab-name1,

70 itab-land1.

hide itab-kunnr.

endloop.

&----


*& selecting and display data for detail list *

&----


at line-selection.

case sy-lsind.

when '1'.

select vbeln

erdat

netwr

from vbak into table jtab where kunnr = itab-kunnr.

loop at jtab.

write:/10 jtab-vbeln,

35 jtab-erdat,

70 jtab-netwr.

endloop.

endcase.

However what the kunnr I select I am getting same order details in the detail list

How to fix this error.

Read only

Former Member
0 Likes
1,031

Hi

Move the <b>hide itab-kunnr.</b> into the loop..endloop

write it after write statement of customer fields in the basic list.

Reward points if useful

Regards

Anji

Read only

0 Likes
1,030

How do I trigger events like top-of-page and end-of-page for different lists here.

Read only

0 Likes
1,030

for header - use top-of-page during line selection for secondary list

Read only

0 Likes
1,030

I am able to define "Top-of-pag" for first detail list.

How to define for the second detail list

Read only

0 Likes
1,030

write down top-of-page during line-selection

see the example code :

top-of-page during line-selection.

perform write_top_of_page.

data: v_repid like sy-repid.

write: / sy-datum, sy-uzeit,

70 'Freshdirect Order Summary Report - '.

if radio1 = 'X'.

write ' COS only'.

elseif radio2 = 'X'.

write ' Non-COS only'.

else.

write ' Non-COS and COS'.

endif.

v_repid = sy-repid.

call function 'Z_WRITE_SELECTION_SCREEN'

exporting

repid = v_repid

exceptions

report_not_found = 1

others = 2.

if p_split = 'X'.

if v_vbtyp = 'M' or v_vbtyp = 'N' or

v_vbtyp = ' '.

write: /(100) 'Invoiced in Time Period' color col_heading.

else.

write: /(100) 'Returns in Time Period' color col_heading.

endif.

else.

write: /(100) 'Net Invoiced in Time Period (invoiced - returned)'

color col_heading.

endif.

skip 1.

write: / 'Profit Center'(001),

32 ' Sales'(002),

' COGS'(003).

write: ' Gross Margin'(007),

' Invoices'(004),

' Line Items'(005),

' Picks'(008),

'Quantity Billed '(006),

' Packs'(009).

new-line.

uline.

endform. " write_top_of_page

Read only

0 Likes
1,030

I am sorry Seshu

I could not understand code.

Can you come with a simple example

Read only

0 Likes
1,030

write down below code after top-of-page.

top-of-page during line-selection.

write:/ ' material # '.

Read only

Former Member
0 Likes
1,030

hi ,

try like this.

top-of-page.

write : / 'First Page Report'.

top-of-page during line-selection.

if sy-lsind = '1'.

write : / 'Second page report'.

endif.

regards

sarath