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

At line selection event

Former Member
0 Likes
2,154

Hi,

My requirement is to display a filed and errors( in case any using ALV) in my report output. When user click on the filed, he should be prompted to a transaction. For this, I have put HOTSPOT on my field and wrriten code in AT line selection event.

Now the issue is, When there is no ALV data , at line selection event triggers and user is prompted to transaction screen. But when ALV data is displayed, HOTSPOT is not working for that field.

Kindly suggest.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,550

hi,

try to fm REUSE_ALV_BLOCK_LIST_APPEND

there will be a table called IT_EVENT in the function module

pass event name and form name and append the table and pass table

to function module.

Regards,

R K.

Edited by: R K on Apr 3, 2009 10:45 AM

Hi,

My requirement is to display a filed and errors( in case any using ALV) in my report output. When user click on the filed, he should be prompted to a transaction. For this, I have put HOTSPOT on my field and wrriten code in AT line selection event.

Now the issue is, When there is no ALV data , at line selection event triggers and user is prompted to transaction screen. But when ALV data is displayed, HOTSPOT is not working for that field.

Kindly suggest.

9 REPLIES 9
Read only

Former Member
0 Likes
1,550

Hi,

When an Interactive Report is needed in Classical Display, we go for AT LINE-SELECTION. But when the same is needed in ALV Display, this method won't work. Instead, we need to use other way which is explained below:

We use REUSE_ALV_GRID_DISPLAY for ALV Display. Now, normally we call that FM in the following way:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'PROGRAM_NAME'

it_fieldcat = tb_fieldcat

TABLES

t_outtab = tb_output.

When it is needed to get an Interactive ALV, call the same FM in the following manner:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZTEST75599_1'

it_fieldcat = tb_fieldcat

i_callback_user_command = 'USER_COMMAND'

TABLES

t_outtab = tb_output.

Now, in the report, create a subroutine with the name USER_COMMAND as follows:

FORM user_command USING p_ucomm LIKE sy-ucomm

p_selfield TYPE slis_selfield.

CASE p_ucomm.

WHEN '&IC1'. " &IC1 - SAP standard code for double-clicking

----


  • Based on the requirement, write the logic *

----


ENDCASE.

ENDFORM.

No need to call the subroutine as PERFORM user_command. This will be takane care by REUSE_ALV_GRID_DISPLAY. We need to just write the subroutine in the report. That suffices.

Some more useful points for Interactive ALV:

1. If Hotspot is needed, then that should be done by declaring hotspot (one field in slis_t_fieldcat_alv) as 'X' in tb_fieldcat which is of type slis_t_fieldcat_alv. When hotspot is active, single click will be enough or else you should double click on the output data.

2. In Classical Display, when it is needed to read the record on which we double clicked, we do that in following way:

AT LINE-SELECTION.

GET CURSOR LINE wf_line. " wf_line gives the line number on which it has been clicked

READ LINE wf_line OF CURRENT PAGE.

But this won't work for ALV. Instead, the following logic can be used:

FORM user_command USING p_ucomm LIKE sy-ucomm

p_selfield TYPE slis_selfield.

CASE p_ucomm.

WHEN '&IC1'. " &IC1 - SAP standard code for double-clicking

READ TABLE tb_output INTO wa_output INDEX p_selfield-tabindex.

IF sy-subrc EQ 0.

----


  • Based on the requirement, write the logic *

----


ENDIF.

ENDCASE.

ENDFORM.

Hope this helps you...

Read only

Former Member
0 Likes
1,550

Hi,

I am using FM REUSE_ALV_BLOCK_LIST_DISPLAY . In that FM there is no parameter like USER_COMMAND. And the filed on which I have put HOTSPOT , is not a part of ALV data. It is a independent filed which i have displayed using WRITE statement.

Read only

0 Likes
1,550

Hi,

You need to use the HIDE statment after the WRITE statement.

So that when you click on the value on the list then you can handle in the AT line selection event.

Refer to this link..for example [AT LINE -SELECTION|http://www.sapfans.com/sapfans/qstart/zhello7.html]

Read only

0 Likes
1,550

Hi Rajneesh,

If u r using normal write statement u should use HIDE statement for the particluar fields

which satisfies the conditions.

for eq:

WRITE: /1 WA_EBAN-WERKS,
                WA_EBAN-MATNR,
                WA_EBAN-BEDNR HOTSPOT.
    HIDE: WA_EBAN-MATNR
    HIDE: WA_EBAN-BEDNR.
    HIDE: WA_EBAN-WERKS.

AT LINE-SELECTION.
  DATA NO TYPE I.
  DATA F(16).
  DATA G(16).
  CASE SY-LSIND.
    WHEN 1.
      GET CURSOR FIELD F.
      IF F EQ 'WA_EBAN-BEDNR'.
        PERFORM DRILL_DOWN.
      ENDIF.
  ENDCASE.

Thanks

Karthik

Read only

Former Member
0 Likes
1,551

hi,

try to fm REUSE_ALV_BLOCK_LIST_APPEND

there will be a table called IT_EVENT in the function module

pass event name and form name and append the table and pass table

to function module.

Regards,

R K.

Edited by: R K on Apr 3, 2009 10:45 AM

Read only

Former Member
0 Likes
1,550

Hi,

I have shown a filed let say 'Summary' and then below that my ALV data. Now I want if a user click on Summary , A transaction should be called.

I have tried HIDE also. Its working only when no ALV data is displayed.

Read only

Former Member
0 Likes
1,550

Hi,

I need a small clarification,

when there is no Data, then why are you displaying the ALV...?

Could you please let me know....?

Thanks & Regards,

Vamsi.

Read only

Former Member
0 Likes
1,550

Hi,

I am not displaying ALV when there is no data. But the field( Summary) is still displayed.

In this case, AT line selection event is triggering and and transaction is called successfully on Click.

The only issue is , when some data is displayed by ALV, then transaction is not called when clicking Summary field.

Read only

0 Likes
1,550

Hi,

In the AT line selection event write a condition....

AT LINE-SELECTION.

if table is not initial.

" processing steps....

endif.

Regards,

Siddarth