Application Development 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: 

ALV

Former Member
0 Kudos
82

DEAR experts,

i have created ALVintractive,but what i need is for each column i should get a diffrent secondary report(ex:if i had 3 fiels in main screen ....pur order,name1,city.if i click on pur no i should go to vbap report,if i click on name1 i should go to kna1 report.........so on)

plz can u send sample code....

1 ACCEPTED SOLUTION

Former Member
0 Kudos
51

Hi naveen,

1. For this purpose, we have to DETECT the COLUMN/FIELD

which has been clicked.

2. just copy paste to get a taste of it.

REPORT abc.

TYPE-POOLS : slis.

*----


Data

DATA : BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE t001.

DATA : flag tyPE c,

END OF itab.

DATA : alvfc TYPE slis_t_fieldcat_alv.

DATA : alvly TYPE slis_layout_alv.

*----


Select Data

SELECT * FROM t001 INTO TABLE itab.

*------- Field Catalogue

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_inclname = sy-repid

CHANGING

ct_fieldcat = alvfc

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

*----


Display

alvly-box_fieldname = 'FLAG'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

it_fieldcat = alvfc

i_callback_program = sy-repid "<-------Important

i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important

is_layout = alvly

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

*----


  • CALL BACK FORM

*----


FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE

slis_selfield.

*----


IMPORTANT.

data : m(100) type c.

m = whatrow-tabindex.

condense m.

concatenate 'Row Number is ' m into m separated by space.

concatenate m ' : Field Clicked is ' whatrow-fieldname into m separated

by space.

message m type 'I'.

ENDFORM. "ITAB_user_command

regards,

amit m.

3 REPLIES 3

Former Member
0 Kudos
52

Hi naveen,

1. For this purpose, we have to DETECT the COLUMN/FIELD

which has been clicked.

2. just copy paste to get a taste of it.

REPORT abc.

TYPE-POOLS : slis.

*----


Data

DATA : BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE t001.

DATA : flag tyPE c,

END OF itab.

DATA : alvfc TYPE slis_t_fieldcat_alv.

DATA : alvly TYPE slis_layout_alv.

*----


Select Data

SELECT * FROM t001 INTO TABLE itab.

*------- Field Catalogue

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_inclname = sy-repid

CHANGING

ct_fieldcat = alvfc

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

*----


Display

alvly-box_fieldname = 'FLAG'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

it_fieldcat = alvfc

i_callback_program = sy-repid "<-------Important

i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important

is_layout = alvly

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

*----


  • CALL BACK FORM

*----


FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE

slis_selfield.

*----


IMPORTANT.

data : m(100) type c.

m = whatrow-tabindex.

condense m.

concatenate 'Row Number is ' m into m separated by space.

concatenate m ' : Field Clicked is ' whatrow-fieldname into m separated

by space.

message m type 'I'.

ENDFORM. "ITAB_user_command

regards,

amit m.

0 Kudos
51

hi amit m. ,

tnx for ur reply....it helped me a lot.........

anversha_s
Active Contributor
0 Kudos
51

hi,

chk this wondeful link with sample code.

<u>http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm</u>

which will help u.

Rgds

Anver

<i>if hlped kinldy mark points</i>