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

sachin_yadav3
Active Participant
0 Likes
505

Hello all,

In my output screen i have 10 fields with 100 entries.

When user click on first field it should go to one transaction and if user click on second field thenit should go on some other t-code.

I also want to read to entire row on which user click.

my problem is how to identify on which field the user has clicked and how to read that complete row.

Thanks in advance

Sachin yadav

1 ACCEPTED SOLUTION
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
486

Hi Sachin Yadav,

To do this, use the code:-


DATA : fieldnam(25),
       fieldval(25).

START-OF-SELECTION.
"select query into the internal table

AT LINE-SELECTION.
 GET CURSOR FIELD fieldnam VALUE fieldval. " these fields will retain values for the field name and value
 CASE fieldnam.
   WHEN 'FIELD1'. "when user clicks at column1
     "code
   WHEN 'FIELD2'. "when user clicks at column2 
     "code
   WHEN OTHERS.
     "error message say invalid field name or invalid command
 ENDCASE.

END-OF-SELECTION.
 loop at itab. "internal table
  "write records on to screen.
   hide : itab-field1. "say if you want this field to perform some further actions
   "this value will be retained when ever you use this field in program after double-click on any row
 endloop.

And to read a complete line when user double clicks at any row, you can use system field 'SY-LISEL'


AT LINE-SELECTION.
 WINDOW STARTING AT 10 4
        ENDING   AT 77 12.
 WRITE : / SY-LISEL. "this will write the contents of line double clicked by the user

Hope this solves your problem.

Thanks & Regards

Tarun Gambhir

3 REPLIES 3
Read only

Former Member
0 Likes
486

>

> my problem is how to identify on which field the user has clicked and how to read that complete row.

Read with System Field:

SYLISEL

And for Calling the transaction from Selected line data. just search in SCN with terms Set parameter ID,and call transaction skip first screen.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
487

Hi Sachin Yadav,

To do this, use the code:-


DATA : fieldnam(25),
       fieldval(25).

START-OF-SELECTION.
"select query into the internal table

AT LINE-SELECTION.
 GET CURSOR FIELD fieldnam VALUE fieldval. " these fields will retain values for the field name and value
 CASE fieldnam.
   WHEN 'FIELD1'. "when user clicks at column1
     "code
   WHEN 'FIELD2'. "when user clicks at column2 
     "code
   WHEN OTHERS.
     "error message say invalid field name or invalid command
 ENDCASE.

END-OF-SELECTION.
 loop at itab. "internal table
  "write records on to screen.
   hide : itab-field1. "say if you want this field to perform some further actions
   "this value will be retained when ever you use this field in program after double-click on any row
 endloop.

And to read a complete line when user double clicks at any row, you can use system field 'SY-LISEL'


AT LINE-SELECTION.
 WINDOW STARTING AT 10 4
        ENDING   AT 77 12.
 WRITE : / SY-LISEL. "this will write the contents of line double clicked by the user

Hope this solves your problem.

Thanks & Regards

Tarun Gambhir

Read only

Former Member
0 Likes
486

HI,

Refer to this link...

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dba42335c111d1829f0000e829fbfe/content.htm

If want to read entire row on which user click.You need to give the check box to fetch the selected record. Please check the above link for this. Check the system field too SY-LISEL

For calling different tcode depending on the value selected..please check the below code

REPORT ZKA51151 .

TABLES : SCARR.

SELECT-OPTIONS : S_CARRID FOR SCARR-CARRID.

DATA : IT_SCARR LIKE SCARR OCCURS 0 WITH HEADER LINE,

IT_SPFLI LIKE SPFLI OCCURS 0 WITH HEADER LINE.

DATA : CF1(15),

L_CARRID LIKE SCARR-CARRID.

AT LINE-SELECTION.

GET CURSOR FIELD CF1 VALUE L_CARRID.

SY-LSIND = 1.

  • Call Transaction

IF CF1 EQ 'IT_SCARR-CARRID'.

  • Call Transaction

ELSEIF CF1 EQ 'IT_SCARR-CURRCODE'.

  • Call Transaction

ENDIF.

START-OF-SELECTION.

SELECT * FROM SCARR

INTO TABLE IT_SCARR

WHERE CARRID IN S_CARRID.

IF NOT IT_SCARR[] IS INITIAL.

SELECT * FROM SPFLI

INTO TABLE IT_SPFLI

FOR ALL ENTRIES IN IT_SCARR

WHERE CARRID EQ IT_SCARR-CARRID.

ENDIF.

SORT IT_SPFLI BY CARRID.

LOOP AT IT_SCARR.

HIDE : IT_SCARR-CARRID,IT_SCARR-CARRNAME,IT_SCARR-CURRCODE.

WRITE : / IT_SCARR-CARRID, IT_SCARR-CARRNAME, IT_SCARR-CURRCODE.

ENDLOOP.