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

Reg ALV interactive

Former Member
0 Likes
1,522

Hi,

I am displaying 14 fields as output using ALV grid display. Now the new request is that when you click on the PO number field it has to go the ME23N for the PO.

Could you plz give tell me how to proceed in detail.

Thanks

Reddy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,501

Do something on the following lines:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

P_SELFLD TYPE SLIS_SELFIELD.

case p_ucomm.

when '&IC1'. "Or whatever is the sy-ucomm value for doble click

set parameter id 'BES' field p_selfld-value.

call transaction 'ME23' AND SKIP FIRST SCREEN.

endcase.

ENDFORM.

reGARDS,

Ravi

15 REPLIES 15
Read only

Former Member
0 Likes
1,502

Do something on the following lines:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

P_SELFLD TYPE SLIS_SELFIELD.

case p_ucomm.

when '&IC1'. "Or whatever is the sy-ucomm value for doble click

set parameter id 'BES' field p_selfld-value.

call transaction 'ME23' AND SKIP FIRST SCREEN.

endcase.

ENDFORM.

reGARDS,

Ravi

Read only

Former Member
0 Likes
1,501

Reddy,

We can use the ALV event SLIS_EV_USER_COMMAND. For example write a form CALLBACK_USER_COMMAND as

FORM CALLBACK_USER_COMMAND USING 
                   P_UCOMM  LIKE SYST-UCOMM
                   P_SELFIELD TYPE SLIS_SELFIELD.
  CASE P_UCOMM.
The default F2 code is '&IC1' which ALV does not process.  
    WHEN '&IC1'.    "doubleclick F2 code
      CLEAR: IT_OUT.
      READ TABLE IT_OUT INDEX  P_SELFIELD-TABINDEX.
      IF SY-SUBRC = 0.
        SET PARAMETER ID 'BES' FIELD w_BSTNR.
        CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
      ENDIF.
      CLEAR: P_UCOMM.
ENDFORM

Hope this helps you,

Cheers,

Thomas

Read only

0 Likes
1,501

Hi,

Please find the code I have made the changes to my ALV grid as guided. below that I have written form. But I am sure I have to incorporate something. Plz help me.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_PROGRAM

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_GRID_TITLE = GV_GRID_TITLE

IS_LAYOUT = LAYOUT

IT_FIELDCAT = GT_FIELDCAT

TABLES

T_OUTTAB = GT_OUT

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

P_SELFIELD TYPE SLIS_SELFIELD.

CASE P_UCOMM.

process.

WHEN '&IC1'. "doubleclick F2 code

CLEAR: GT_OUT.

READ TABLE GT_OUT INDEX P_SELFIELD-TABINDEX.

IF SY-SUBRC = 0.

SET PARAMETER ID 'BES' FIELD P_SELFIELD-VALUE.

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

ENDIF.

CLEAR: P_UCOMM.

ENDCASE.

ENDFORM.

Read only

0 Likes
1,501

Hi,

you have to change

SET PARAMETER ID 'BES' FIELD P_SELFIELD-VALUE

to

SET PARAMETER ID 'BES' FIELD GT_OUT-EBELN

Regards, Dieter

Read only

0 Likes
1,501

Hi Dieter,

Still not working, I need to write any perform for this form or not. I just using this under the ALV Grid display. as shown in the earlier mail.

Regards

Reddy

Read only

0 Likes
1,501

Hi REDDY,

can you set a breap-point at the case-line and

look when you make an double-click.

does the report stop?

if yes, look at the fields.

regards, Dieter

Read only

0 Likes
1,501

Dieter,

I have put the breat point in case-line. when I am doulble clicking in the PO it is not going back or it is not stopping any where.

Please advice.

Regards

Reddy

Read only

0 Likes
1,501

Check this link for the interactive ALV.

http://www.sapfans.com/forums/viewtopic.php?t=22036

For showing the PO in ME23N (Instead of using call transaction use the below FM):

CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT'

EXPORTING

i_ebeln = <Po Number>

i_display_only = 'X'

i_enjoy = 'X'

EXCEPTIONS

not_found = 1

no_authority = 2

invalid_call = 3

preview_not_possible = 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.

Regards,

Prakash.

Read only

0 Likes
1,501

Hi Reddy,

You have to use event exit like this:

DATA: EVENT_EXIT TYPE SLIS_T_EVENT_EXIT.

DATA: WA_EVENT_EXIT TYPE SLIS_EVENT_EXIT.

*

MOVE: '&IC1' TO WA_EVENT_EXIT-UCOMM,

'X' TO WA_EVENT_EXIT-BEFORE.

*

APPEND WA_EVENT_EXIT TO EVENT_EXIT.

*

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

...

<b> IT_EVENT_EXIT = EVENT_EXIT</b>

...

Regards, Dieter

Read only

0 Likes
1,501

Hi Prakash,

This is very good.. but how should i get the PO from the output screen.

Thanks

Reddy

Read only

0 Likes
1,501

Follow the below steps:

1) Declare type group : Code: TYPE-POOLS: slis.

2) Declare callback program and callback subroutine. SAP must know which subroutine of which program must be executed when clicking on a hotspot of an ALV grid :

Code:

data : w_callback_subroutine TYPE slis_formname,

w_callback_program LIKE sy-repid.

3) Assign value to those two variables before calling ALV grid :

Code:

w_callback_program = sy-repid.

w_callback_subroutine = 'USER_COMMAND'.

(or any other subroutine name but in upper case)

4) Define subroutine handling double-click :

Code:

FORM user_command USING p_ucomm LIKE sy-ucomm

p_selfield TYPE slis_selfield.

CASE p_ucomm.

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

*Call the transaction *

ENDCASE.

Check the link which i sent you before.

ENDFORM.

Regards,

Prakash.

Read only

0 Likes
1,501

Hi,

Thanks for assisting, But still i am not able to resolve. I have made the changes as suggested. and i have doubt how system will recognise the subroutine. No where we are using perform. Please suggest necessary changes to resolve this.. THis is very urgent.

Syntax error: Statement is not accessible.

data : w_callback_subroutine TYPE slis_formname.

w_callback_subroutine = 'USER_COMMAND'.

w_program = sy-repid.

FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

P_SELFIELD TYPE SLIS_SELFIELD.

CASE P_UCOMM.

WHEN '&IC1'.

SET PARAMETER ID 'BES' FIELD p_selfield-value.

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

CLEAR: P_UCOMM.

ENDCASE.

ENDFORM.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_PROGRAM

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = w_callback_subroutine I_GRID_TITLE = GV_GRID_TITLE

IS_LAYOUT = LAYOUT

IT_FIELDCAT = GT_FIELDCAT

IT_EVENT_EXIT =

TABLES

T_OUTTAB = GT_OUT

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

Read only

0 Likes
1,501

Hi Prakash,

Thanks it is working,. One more small help. I am not able to see the icons in the top of the output. Plz help.

Regards

Reddy.

Read only

0 Likes
1,501

Prakash,

If I am clicking other than the PO field also it is taking the value of that field and checking whether that is PO number or not. I dont want this.. i need only when i double click on PO then only it has to be work.

How to control this.

Regards

Reddy

Read only

0 Likes
1,501

Hi REDDY,

before you execute ME23N you can ask wich field you

have selected like this:

CASE RS_SELFIELD-FIELDNAME.

WHEN 'EBELN'.

do me23n

WHEN 'EBELP'.

do as you like

WHEN OTHERS.

nothing.

ENDCASE.

regards, Dieter