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

ALV

Former Member
0 Likes
973

Hi Guys,

I developed an alv report and my problem is a pretty simple one. When the output is being displayed, what needs to be done is when I click on the material number, it should go to MM03.


  CLEAR fieldcat.
  fieldcat-fieldname     = 'MATNR'.
  fieldcat-tabname       = 'HEADER'.
  fieldcat-ref_tabname   = 'MARA'.
  fieldcat-hotspot = 'X'.
  APPEND fieldcat.

I tried doing this, but nothing is happening. Can you suggest me what needs to be done.

Thanks

Kumar.

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
954

You need to impelement one USER_COMMAND perfomr which can handel this

Like:

in FM

REUSE_ALV_LIST_DISPLAY

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

Form user_command should be like this:

FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
             RS_SELFIELD TYPE SLIS_SELFIELD.

  SET PARAMETER ID 'MAT' FIELD RS_SELFIELD-value.
  CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

ENDFORM.                    "USER_COMMAND

Regards,

Naimesh Patel

9 REPLIES 9
Read only

Former Member
0 Likes
954

Hi Kumar,

Can you show your whole code.

Regards,

Atish

Read only

0 Likes
954

Atish,

I cant paste my whole code here. Its 3900 lines, so i dont think it will be of much help to paste my code here.

All others,

I am actually confused as to how to implement each of your suggestions. Can you give me an example which i can look into and use it.

Thanks for all your answers

Kumar.

Read only

0 Likes
954

Hi,

In that case I think you should look at the sample code of Naimesh.

Regards,

Atish

Read only

Former Member
0 Likes
954

Hi Kumar,

do like this

READ TABLE itab INDEX selfield-tabindex

INTO wa.

if ucomm = '&IC1'.

Set parameter id 'MAT' field selfield-value.

Call transaction 'MM03' and skip first screen.

endif.

<b>Reward points for helpful answers</b>

Satish

Message was edited by:

Satish Panakala

Read only

naimesh_patel
Active Contributor
0 Likes
955

You need to impelement one USER_COMMAND perfomr which can handel this

Like:

in FM

REUSE_ALV_LIST_DISPLAY

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

Form user_command should be like this:

FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
             RS_SELFIELD TYPE SLIS_SELFIELD.

  SET PARAMETER ID 'MAT' FIELD RS_SELFIELD-value.
  CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

ENDFORM.                    "USER_COMMAND

Regards,

Naimesh Patel

Read only

0 Likes
954

Naimesh,

Thanks man, it works. But the problem is if I double click on any line, say I click on plant(001) it still goes to MM03 and says material 001 doesnt exist.

Can we restrict our selection only to the material number?

Thanks

Kumar.

Read only

0 Likes
954

Ok..

Put one condition in USER_COMMAND

FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
             RS_SELFIELD TYPE SLIS_SELFIELD.

* case r_ucomm.
*  when '&IC1'.   " << code for double click
 IF RS_SELFIELD-fieldname = 'ITAB-MATNR' .   "<< your field name for material
  SET PARAMETER ID 'MAT' FIELD RS_SELFIELD-value.
  CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
 endif.
*endcase.

ENDFORM.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
954

Hi Kumar, you will need to create an 'AT LINE-SELECTION' statement. All statements under this statement will be executed upon double clicking the line in question. I usually put the 'AT LINE-SELECTION' statement just before the 'END-OF-SELECTION' statement. You can also use the 'HOTSPOT ON' option with your write statement for the material number. This will allow the user to single click the material which will invoke the 'AT LINE-SELECTION' event. Hope this helps.

Kevin

Read only

Former Member
0 Likes
954

Thank you guys.

Solved my problem.