Application Development 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: 

SET PARAMETER AND CALL TRANSACTION

former_member182371
Active Contributor
0 Kudos

Hi,

in my hierarchical ALV i´ve got the following code when double cliking a row:

form frm_alv_user_command USING UCOMM LIKE SY-UCOMM

SELFIELD TYPE SLIS_SELFIELD.

case ucomm.

when 'VER_PEDIDO'.

CHECK NOT selfield-tabname IS INITIAL.

IF SELFIELD-TABNAME = 'GT_ITAB'.

IF SELFIELD-FIELDNAME = 'VBELN'.

CLEAR gt_itab.

read table gt_itab index SELFIELD-TABINDEX.

if sy-subrc = 0.

FREE MEMORY ID 'AUN'.

SET PARAMETER ID 'AUN' FIELD GT_ITAB-VBELN.

CALL TRANSACTION 'VA23' AND SKIP FIRST SCREEN.

endif.

endif.

endif.

endcase.

The problem is that when i go to transaction VA23 i always get the last value shown in the transaction and not the one i´ve double clicked in the ALV.

Why is this happening?

Best regards.

1 ACCEPTED SOLUTION

Former Member

Hi,

Depending on what transaction you call (in your case, VA23), the value for VBAK-VBELN is populated from a different parameter ID. Try setting parameter id AGN instead of AUN.

To see where this happens, open program SAPFV45K in SE80 and look for the subroutine VBAK-VBELN_GET_PARAMETER. There you will see that the parameter ID varies, depending on config from table T180.

Cheers,

Martin

9 REPLIES 9

Former Member

Hi,

Depending on what transaction you call (in your case, VA23), the value for VBAK-VBELN is populated from a different parameter ID. Try setting parameter id AGN instead of AUN.

To see where this happens, open program SAPFV45K in SE80 and look for the subroutine VBAK-VBELN_GET_PARAMETER. There you will see that the parameter ID varies, depending on config from table T180.

Cheers,

Martin

0 Kudos

Martin's got it.

The parameter ID for quotations (VA21,VA22,VA23) is AGN not AUN.

The f1/f9 help on the field is a bit misleading as the field is set to PID AUN on the screen painter, but the code overwrites the AUN PID with the AGN PID.

If you change your PID to AGN then it will work without problem.

Brad

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check this sample.

FORM f9300_alv_events.

  • Local work areas

DATA: lw_event TYPE slis_alv_event.

  • Populating ALV events table

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

IMPORTING

et_events = i_events

EXCEPTIONS

list_type_wrong = 1

OTHERS = 2.

IF sy-subrc EQ 0.

READ TABLE i_events WITH KEY name = slis_ev_user_command

INTO lw_event.

IF sy-subrc = 0.

MOVE slis_ev_user_command TO lw_event-form.

MODIFY i_events FROM lw_event INDEX sy-tabix.

ENDIF.

ENDIF.

ENDFORM. " f9300_alv_events

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

DATA: lv_tabname LIKE rs_selfield-tabname,

lv_vbeln LIKE vbrk-vbeln.

CHECK r_ucomm EQ c_dblclk.

CASE rs_selfield-fieldname.

WHEN C_VBELN.

lv_tabname = rs_selfield-tabname.

IF lv_tabname = 'i_output'.

READ TABLE i_output INTO w_output INDEX rs_selfield-tabindex.

lv_vbeln = w_output-vbeln.

ELSE.

READ TABLE i_output1 INTO w_output1 INDEX rs_selfield-tabindex.

lv_vbeln = w_output1-vbeln.

ENDIF.

CHECK sy-subrc EQ 0.

IF NOT lv_vbeln IS INITIAL.

  • call transaction VF03

SET PARAMETER ID 'VF' FIELD lv_vbeln.

CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM. " f3100_alv_user_command

0 Kudos

The problem is not that the value is being read incorrectly from the ALV list, but the wrong parameter ID is set before calling the transaction (see above).

Former Member
0 Kudos

Hi Martin Ceronio ,

How can we find the program for the respective parameter.ie how did you find program SAPFV45K for the

the field.is it based on experience or any tips is there.

Regards,

Latha prabhu.

0 Kudos

Hello Latha,

I knew from experience that some of these SD programs override the parameter ID set on the data element. However, I will explain how I found it for this particular case, but obviously it's just general advice:

I just placed a breakpoint on the first debuggable statement from PAI of screen 102 in program SAPMV45A (which is called by VA23) - if you set on debugging before calling the transaction, it may not stop at the breakpoints you set. (You cannot set a breakpoint in the flow logic of a screen, that is why I say place it at the first debuggable statement).

Then I called VA23. In debugging mode, I set a breakpoint on statement "GET PARAMETER". After that, I just ran through the program until I got to the code in program SAPFV45K.

Hope this helps you understand how I got there.

Regards,

Martin

0 Kudos

Hello Latha,

Feel free of course to reward the above answer if you find it useful!

Thanks,

Martin

0 Kudos

Hi Martin ,

Thanks for the solution.I was not in the office for some days.Sure to reward.Trying to reward but there's some problem,I couldn't find stars.

Regards,

Latha prabhu.

Message was edited by: latha prabhu

0 Kudos

Hello Latha,

That is probably because you did not create the message originally.

Regards,

Martin