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

Regarding ALV grid.

Former Member
0 Likes
712

hi,

i want to display one or more output report in an single ALV grid display.

eg: consider A,B,C are the 3 reports

by selecting a radio button, i want to display A and B as a single alv grid display

by selecting the other radio button i want to display A and C as a single ALV grid display

please help me ASAP. <removed by moderator>

regards,

vijay

Edited by: Mike Pokraka on Aug 6, 2008 8:28 AM

hi,

i want to display one or more output report in an single ALV grid display.

eg: consider A,B,C are the 3 reports

by selecting a radio button, i want to display A and B as a single alv grid display

by selecting the other radio button i want to display A and C as a single ALV grid display

please help me ASAP. <removed by moderator>

regards,

vijay

Edited by: Mike Pokraka on Aug 6, 2008 8:28 AM

5 REPLIES 5
Read only

Former Member
0 Likes
690

use blocked alv report..........

Read only

Former Member
0 Likes
690

You can use the OOPs based alv. there you can have containers for more than one gird.

Read only

Former Member
0 Likes
690

hi look at this example......

report zalv_sample .

tables vbak.

data it_vbak like vbak occurs 0 with header line.

selection-screen begin of block b1 with frame.

parameters: alv1 radiobutton group alv, "REUSE_ALV_LIST_DISPLAY

alv2 radiobutton group alv, "REUSE_ALV_POPUP_TO_SELECT

alv3 radiobutton group alv, "REUSE_ALV_GRID_DISPLAY

alv4 radiobutton group alv. " NORMAL DISPLAY

selection-screen end of block b1.

select * from vbak

into corresponding fields of table it_vbak

up to 10 rows.

if alv1 = 'X'.

perform alv_func1.

elseif alv2 = 'X'.

perform alv_func2.

elseif alv3 = 'X'.

perform alv_func3.

elseif alv4 = 'X'.

perform norm.

endif.

&----


*& Form ALV_FUNC1

&----


form alv_func1 .

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_structure_name = 'VBAK'

tables

t_outtab = it_vbak

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. " ALV_FUNC1

&----


*& Form ALV_FUNC2

&----


form alv_func2 .

call function 'REUSE_ALV_POPUP_TO_SELECT'

exporting

i_title = 'SALES ORDER INFO'

i_zebra = 'X'

i_tabname = 1

i_structure_name = 'vbak'

tables

t_outtab = it_vbak

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. " ALV_FUNC2

&----


*& Form ALV_FUNC3

&----


form alv_func3 .

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_structure_name = 'vbak'

i_grid_title = 'SALES ORDER INFO'

tables

t_outtab = it_vbak

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. " ALV_FUNC3

&----


*& Form NORM

&----


form norm .

format intensified.

skip 1.

write: /'SALES DOC.',

' Created on ',

' Time',

' Created by',

' Valid from ',

' Sold-to party'.

format intensified off.

skip 2.

loop at it_vbak.

write: / it_vbak-vbeln,' ',

it_vbak-erdat,' ',

it_vbak-erzet,' ',

it_vbak-ernam,' ',

it_vbak-angdt,' ',

it_vbak-kunnr.

endloop.

endform. " NORM

Read only

Former Member
0 Likes
690

Hi

Try this ...

parameters: rb_AB RADIOBUTTON GROUP r1,

rb_AC RADIOBUTTON GROUP r1.

start-of-selection.

if rb_AB = 'X'.

PERFORM build_layout.

PERFORM build_fieldcat1. " Fieldcat of A

PERFORM build_fieldcat2. " Fieldcat of B

PERFORM alv_display1. " for fieldcat A and B

elseif rb_AC = 'X'.

PERFORM build_layout.

PERFORM build_fieldcat1. " Fieldcat of A

PERFORM build_fieldcat3. " Fieldcat of C

PERFORM alv_display. " for fieldcat A and C

endif.

FORM build_layout .

i_layout-zebra = c_x.

i_layout-colwidth_optimize = c_x.

ENDFORM. " BUILD_LAYOUT

FORM alv_display1 .

g_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

i_callback_program = g_repid

i_callback_pf_status_set = pfstatus

i_callback_user_command = 'USER_COMMAND'.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = i_layout

it_fieldcat = i_fieldcat

i_tabname = 'T_BASIC1'

it_events = gt_xevents

TABLES

t_outtab = t_basic1

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

it_fieldcat = i_fieldcat1

is_layout = i_layout

i_tabname = 'T_BASIC2F'

it_events = gt_yevents

TABLES

t_outtab = t_basic2f.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

EXPORTING

is_print = gt_print

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

.

ENDIF.

ENDFORM.

Similarly write alv_display2 .

Regards

Mamtha

Read only

Former Member
0 Likes
690

Just add condition on Building field like as

if radio_button1 eq 'X'.

clear wa_fieldcat.

add 1 to col_pos.

wa_fieldcat-row_pos = 1.

wa_fieldcat-col_pos = col_pos.

wa_fieldcat-fieldname = 'SNO'.

wa_fieldcat-seltext_l = 'S. No.'.

append wa_fieldcat to it_fieldcat.

clear wa_fieldcat.

add 1 to col_pos.

wa_fieldcat-row_pos = 1.

wa_fieldcat-col_pos = col_pos.

wa_fieldcat-fieldname = 'QSCOD'.

wa_fieldcat-seltext_l = 'Section Code'.

append wa_fieldcat to it_fieldcat.

endif.

if radio_button2 eq 'X'.

clear wa_fieldcat.

add 1 to col_pos.

wa_fieldcat-row_pos = 1.

wa_fieldcat-col_pos = col_pos.

wa_fieldcat-fieldname = 'TDSPL1'.

wa_fieldcat-seltext_l = 'TDS (Rs.)'.

append wa_fieldcat to it_fieldcat.

clear wa_fieldcat.

add 1 to col_pos.

wa_fieldcat-row_pos = 1.

wa_fieldcat-col_pos = col_pos.

wa_fieldcat-fieldname = 'SURPL1'.

wa_fieldcat-seltext_l = 'Surcharge (Rs.)'.

append wa_fieldcat to it_fieldcat.

clear wa_fieldcat.

add 1 to col_pos.

wa_fieldcat-row_pos = 1.

wa_fieldcat-col_pos = col_pos.

wa_fieldcat-fieldname = 'EDCES1'.

wa_fieldcat-seltext_l = 'Education Cess (Rs.)'.

append wa_fieldcat to it_fieldcat.

endif.

if radio_button3 eq 'X'.

clear wa_fieldcat.

add 1 to col_pos.

wa_fieldcat-row_pos = 1.

wa_fieldcat-col_pos = col_pos.

wa_fieldcat-fieldname = 'INTRST'.

wa_fieldcat-seltext_l = 'Interest (Rs.)'.

append wa_fieldcat to it_fieldcat.

clear wa_fieldcat.

add 1 to col_pos.

wa_fieldcat-row_pos = 1.

wa_fieldcat-col_pos = col_pos.

wa_fieldcat-fieldname = 'OTHAMT'.

wa_fieldcat-seltext_l = 'Other (Rs.)'.

append wa_fieldcat to it_fieldcat.

endif.

Hope this will be helpful

rgds

rajesh