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

Forwarding with the WRITE statement

Former Member
0 Likes
1,477

Hallo,

i need to figure out if it's possible to have a forward navigation with only using the WRITE Statement and without any Dynpros. For example: You start an Report which will write a tablename and u can just double click onto this one to navigate to the table. If yes how is it working ?

Kind regards,

Jan

1 ACCEPTED SOLUTION
Read only

former_member209120
Active Contributor
0 Likes
1,439

Dear Jan,

Try like this,

data : table(100) type c,
          var1 like dd02l-tabname.

   Write : / 'MARA',
           / 'EKKO',
           / 'EKPO'.

   at line-selection.

   table = sy-lisel.
   var1 = table.
   set parameter id 'DTB' field var1.
   call transaction 'SE12' and skip first screen.

12 REPLIES 12
Read only

Former Member
0 Likes
1,439

Hi Jan,

Yes you can up to 20 levels there is a standard event on write : AT LINE SELECTION.

here is a snapshot code from SAP HELP.

REPORT demo_at_line_selection.

START-OF-SELECTION.
  WRITE 'Click me!' COLOR = 5 HOTSPOT.

AT LINE-SELECTION.
  WRITE: / 'You clicked list', sy-listi,
         / 'You are on list',  sy-lsind.
  IF sy-lsind < 20.
    SKIP.
    WRITE: 'More ...' COLOR = 5 HOTSPOT.
  ENDIF.

BR

Yakub Shah

Read only

Former Member
0 Likes
1,439

Hi,

Please follow hotspot and AT LINE SELECTION as Mr Shah said.

and you wanted to navigate to table.. please below mentioned Function Module..

CALL FUNCTION 'RS_DD_SHOW'

         EXPORTING

           objname                    = 'MARA' (Table name)

           objtype                    = 'T' (Transparent table)

           popup                      = space

*         SECNAME                    = SECNAME

*         MONITOR_ACTIVATE           = 'X'

*         IMPORTING

*         FCODE                      = FCODE

        EXCEPTIONS

          object_not_found           = 1

          object_not_specified       = 2

          permission_failure         = 3

          type_not_valid             = 4

          OTHERS                     = 5.

       IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

       ENDIF.

it will take you directly to SE11

Regards

Tejas

Read only

parshuram_kokare
Explorer
0 Likes
1,439

Hi Jan,

You can try calling transaction SE11 in AT LINE-SELECTION event.

Try below code if it helps:

START-OF-SELECTION.

TYPES : BEGIN OF ty_table,
          table TYPE TABNAME16,
        END OF ty_table.

DATA : it_table TYPE STANDARD TABLE OF ty_table,
       wa_table TYPE ty_table.

wa_table-table = 'VDARL'.
Append wa_table to it_table.

wa_table-table = 'BKPF'.
Append wa_table to it_table.

wa_table-table = 'BSEG'.
Append wa_table to it_table.

LOOP AT it_table INTO wa_table.
  WRITE : / 'Table name: ', wa_table-table.
  HIDE wa_table-table.
ENDLOOP.

at LINE-SELECTION.

set PARAMETER ID 'CLASSTAB' FIELD 'X'.
set PARAMETER ID 'DTB' FIELD wa_table-table.
call TRANSACTION 'SE11'.

Thanks & Regards,

Parshuram.

Read only

former_member209120
Active Contributor
0 Likes
1,440

Dear Jan,

Try like this,

data : table(100) type c,
          var1 like dd02l-tabname.

   Write : / 'MARA',
           / 'EKKO',
           / 'EKPO'.

   at line-selection.

   table = sy-lisel.
   var1 = table.
   set parameter id 'DTB' field var1.
   call transaction 'SE12' and skip first screen.

Read only

0 Likes
1,439

Hi,

i got this working so far. But there's still an issue, if i have more than one value written in one line for example:

Write:  'This is the table you searched for: ', lv_tabname .

if i start the report now, i can click both of this parts in this line, but it's always entering the value of the first part of the line not the value of tabname into the se12 screen. Do u have any ideas how to solve this.

Thank you,

Jan

Read only

0 Likes
1,439

Hi Jan,

Try this code.

Types : begin of ty_final,
         TABNAME type dd02l-tabname,
         end of ty_final.


data: it_final type table of TY_FINAL.
data: wa_final type TY_FINAL.

WA_FINAL-TABNAME = 'MARA'.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.

WA_FINAL-TABNAME = 'EKKO'.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.

WA_FINAL-TABNAME = 'EKPO'.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.

loop at it_final into wa_final.
      WRITE😕  'This is the table you searched for: ', wa_final-tabname.
      HIDE wa_final-tabname.
endloop.

AT LINE-SELECTION.
    set parameter id 'DTB' field WA_FINAL-tabname.
    call transaction 'SE12' and skip first screen.

Regards,

Ramesh.T

Read only

Former Member
0 Likes
1,439

Hi Jan,

By using the events we can achieve your requirement AT LINE SELECTION is the event will when you click on the line.

From there you can navigate to the secondary list you want.

Let me know if any clarification/help required.

Thanks & Best Regards.

Pavan Neerukonda.

Read only

0 Likes
1,439

Well yes i got another question, as i asked ramseh in the post above, is there a way to get a certain value out of the line ? not just the whole line ?

Thank you ,

Jan

Read only

former_member209120
Active Contributor
0 Likes
1,439

Dear Jan,

Try like this,

data : table(100) type c,
          var1 like dd02l-tabname.

   Write : / 'MARA',
           / 'EKKO',
           / 'EKPO'.

   at line-selection.

   table = sy-lisel.
   var1 = table.
   set parameter id 'DTB' field var1.
   call transaction 'SE12' and skip first screen.

Read only

Former Member
0 Likes
1,439

Hi,

Please use AT LINE SELECTION event to achieve this.Thanks.

Regards,

Ravi Shankar L

Read only

Former Member
0 Likes
1,439

Hi Jan,

Here is the Full code that you need.

TABLES : dd02l.

SELECT tabname FROM dd02l UP TO 10 ROWS.

    WRITE:/ dd02l-tabname.

     HIDE dd02l-tabname.

ENDSELECT.

AT LINE-SELECTION.

   set parameter id 'DTB' field dd02l-tabname.

   call transaction 'SE12' and skip first screen.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,439

This old technology is always available, but read Classic Lists in online Abap documentation.

Regards,

Raymond