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: 

user_command

Former Member
0 Kudos

Hi All,

My requirement is in Report, in output when we click the vendor field value then XK03 transaction must open and how to write coding for this any one can suggest please.and now it is going to dump error

Thanks in Advance

12 REPLIES 12

Former Member
0 Kudos

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_top_of_page = text-061

is_layout = gi_layout

it_fieldcat = gi_fcat

it_excluding = gi_exclude

i_callback_user_command = gc_ucommand " FORM NAME

TABLES

t_outtab = gi_final1

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 BUILD_LAYOUT

&----


FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN gc_click. "for double click

IF rs_selfield-fieldname = gc_vbeln.

SET PARAMETER ID gc_aun FIELD rs_selfield-value.

CALL TRANSACTION gc_va02 AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM. "USER_COMMAND

this will help

Former Member
0 Kudos

HI.

First find the set parameter id and use this example code.

if selfield-fieldname = 'PLNUM'.

set parameter id 'PAF' field selfield-value.

call transaction 'MD13' and skip first screen.

endif.

Regards.

jay

Former Member
0 Kudos

Hi,

Try the code written below for your requirement.

Form z_user_command using r_ucomm like sy-ucomm

rs_selfield type slis_selfield.

case r_ucomm. "FCODE

when 'XK03'.

if rs_selfield-fieldname = 'LIFNR'.

set parameter id 'LIF' field rs_selfield-value.

call transaction 'XK03' and skip first screen.

Looking forward to hear from you.

Best Regards,

Deepa Kulkarni

Former Member
0 Kudos

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = sy-repid

I_CALLBACK_USER_COMMAND = 'USER_COMM'

is_layout =u_er_layout

it_fieldcat = ls_fieldcat

i_default = 'X'

i_save = 'A'

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

tables

t_outtab = itab.

form user_command using f_ucomm like sy-ucomm

i_selfield type slis_selfield.

Former Member
0 Kudos

Hi Nagisethi,

It seems that you want to call the transaction when click on the field 'vendor' on your report. For this no need of using user command instead you have to use 'at line-selection'.

For example say your field name through which your printing on output is 'wa_test-lifnr'.

Now you try to the coding like below,

DATA: w_cursor(20) type c.

GET CURSOR FIELD w_cursor.

CASE w_cursor.

WHEN 'WA_TEST-LIFNR'.

READ CURRENT LINE FIELD VALUE wa_test-lifnr.

SET PARAMETER ID 'LIF' FIELD wa_test-lifnr.

CALL TRANSACTION 'XK03'.

ENDCASE.

former_member1245113
Active Contributor
0 Kudos

Hi

Please specify which type of output you are using ALV or STANDARD

as you the replies suggest they are confused with the type of output

Please be clear

Regards

Ramchander Rao.K

Former Member
0 Kudos

Hi Nagisethi,

It seems you want to call the transaction when you click on a field in report output.

For this you no need to use user command instead you can use 'AT LINE-SELECTION'.

Say your fied on output screen is 'WA_VENDOR-LIFNR' , then write your coding like below,

DATA: w_cursor(20) TYPE c.

.

.(Your code)

.

AT LINE-SELECTION.

GET CURSOR FIELD w_cursor

CASE w_cursor.

WHEN 'WA_VENDOR-LIFNR'.

READ CURRENT LINE FIELD VALUE wa_vendor-lifnr.

SET PARAMETER ID 'LIF' FIELD wa_vendor-lifnr.

CALL TRANSACTION 'XK03'.

ENDCASE.

If you want to skip your frst screen in your transction, then use

CALL TRANSACTION 'XK03' AND SKIP FIRST SCREEN.

Hope this will help you.

Regards,

Manoj Kumar P

Edited by: Manoj Kumar on Nov 28, 2008 12:48 PM

Edited by: Manoj Kumar on Nov 28, 2008 12:49 PM

Former Member
0 Kudos

use call transaction xk01 and skip first screen.

or submit <porogramname> with <fieldname> = 'sadf'.

and return

Edited by: thirukumaran rajendran on Nov 28, 2008 12:55 PM

Former Member
0 Kudos
at line-selection.

    call transaction 'XK03'.

check this code:

CASE sy-ucomm.
    WHEN 'CUSTOMER'.
      GET CURSOR FIELD w_field.
      IF w_field = 'FS_ORDER-KUNNR'.
        READ LINE sy-lilli FIELD VALUE
                        fs_order-kunnr.
        IF fs_order-kunnr IS NOT INITIAL.

          IF sy-subrc = 0.
            SET PARAMETER ID  'KUN' FIELD fs_order-kunnr.
            CALL TRANSACTION 'XD03'.

          ENDIF.                       " IF SY-SUBRC = 0
        ELSE.

        MESSAGE text-006 TYPE 'I'.
        ENDIF.                         " IF FS_ORDER-KUNNR IS NOT INI...

      ELSE.

        MESSAGE text-006 TYPE 'I'.
      ENDIF.                           " IF W_FIELD = 'FS_ORDER-KUNNR'

    WHEN 'ORDER'.
      GET CURSOR FIELD w_field.
      IF w_field = 'FS_ORDER-VBELN'.
        READ LINE sy-lilli FIELD VALUE
                        fs_order-VBELN.
        IF fs_order-VBELN IS NOT INITIAL.

          IF sy-subrc = 0.
            SET PARAMETER ID  'AUN' FIELD fs_order-VBELN.
            CALL TRANSACTION 'VA03'.
          ENDIF.                       " IF SY-SUBRC = 0
        ELSE.
          MESSAGE text-007 TYPE 'I'.

        ENDIF.                         " IF FS_ORDER-AUFNR IS NOT INI...
      ELSE.
        MESSAGE text-007 TYPE 'I'.
      ENDIF.                           " IF W_FIELD = 'FS_ORDER-AUFNR'
  ENDCASE.                             " CASE SY-UCOMM

ENDFORM.                               " SY-UCOMM_CUSTOMER_ORDE

With luck,

Pritam.

Former Member
0 Kudos

Hi ,

You can use AT LINE SELECTION

Code example:

AT LINE-SELECTION

SET PARAMETER ID 'PAR' FIELD XK03-<FIELD> ,

'PAR1' FIELD XK03-<FIELD1> .

CALL TRANSACTION XK03 .

where PAR AND PAR1 are your parameters and <FIELD> AND <FIELD1> Are your fields which will be displayed on trigger of CALL TRANSACTION XK03 event .

you can also use SUBMIT OR LEAVE TO TRANSACTION ACCORGING TO YOUR NEEDS.

hope your query is cleared

Former Member
0 Kudos

kkl