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

Call a transaction CS03 from ALV

Former Member
0 Likes
2,130

Hi all,

On clicking a row(not any kind of button on application toolbar) in ALV List Display format, the control should go to transaction CS03 and update some data...

Please tell me how ...

Many thanks in advance

Regards,

1 ACCEPTED SOLUTION
Read only

former_member188827
Active Contributor
0 Likes
1,374

try

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN 'BACK' OR 'CANC' OR 'EXIT'.

LEAVE TO SCREEN 0.

WHEN '&IC1'.

READ TABLE itab INDEX rs_selfield-tabindex.

SET PARAMETER ID 'MAT' FIELD ITAB-MATNR.

SET PARAMETER ID 'WRK' FIELD ITAB-WERKS.

SET PARAMETER ID 'CSV' FIELD ITAB-STLAN.

CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.

ENDCASE.

*ENDFORM. "USER_COMMAND

4 REPLIES 4
Read only

Former Member
0 Likes
1,374

hi

good

If you cannot fill the alternative number using SET/GET parameter then simply record transaction CS03 (using the batch recorder,SHDB) until you are on the required screen. The call the transaction within your event handler method like:

CALL TRANSACTION 'CS03' USING lt_bdcdata.

Alternatively, you can call the transaction using function module ABAP4_CALL_TRANSACTION. This fm has the advantage that it check the authorization for the transaction.

reward point if helpful.

thanks

mrutyun^

Read only

former_member188827
Active Contributor
0 Likes
1,375

try

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN 'BACK' OR 'CANC' OR 'EXIT'.

LEAVE TO SCREEN 0.

WHEN '&IC1'.

READ TABLE itab INDEX rs_selfield-tabindex.

SET PARAMETER ID 'MAT' FIELD ITAB-MATNR.

SET PARAMETER ID 'WRK' FIELD ITAB-WERKS.

SET PARAMETER ID 'CSV' FIELD ITAB-STLAN.

CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.

ENDCASE.

*ENDFORM. "USER_COMMAND

Read only

0 Likes
1,374

Thanks for ur helping hands

Read only

0 Likes
1,374

This was usefull post to me so I would like to make it even better:

Try to call CS03 this way:

  DATA: bdcdata TYPE TABLE OF bdcdata,
             wa_bdcdata TYPE bdcdata,
             opt TYPE ctu_params.

       CLEAR wa_bdcdata.
        wa_bdcdata-program  = 'SAPLCSDI'.
        wa_bdcdata-dynpro   = '0100'.
        wa_bdcdata-dynbegin = 'X'.
        APPEND wa_bdcdata TO bdcdata.

        CLEAR wa_bdcdata.
        wa_bdcdata-fnam     = 'RC29N-MATNR'.
        ASSIGN COMPONENT 'MATNR' OF STRUCTURE <grs_head> TO <grv_cell>.
        wa_bdcdata-fval     = <grv_cell>.
        APPEND wa_bdcdata TO bdcdata.

        CLEAR wa_bdcdata.
        wa_bdcdata-fnam     = 'RC29N-WERKS'.
        ASSIGN COMPONENT 'WERKS' OF STRUCTURE <grs_head> TO <grv_cell>.
        wa_bdcdata-fval     = <grv_cell>.
        APPEND wa_bdcdata TO bdcdata.

        CLEAR wa_bdcdata.
        wa_bdcdata-fnam     = 'RC29N-STLAL'.
        ASSIGN COMPONENT 'STLAL' OF STRUCTURE <grs_head> TO <grv_cell>.
        wa_bdcdata-fval     = <grv_cell>.
        APPEND wa_bdcdata TO bdcdata.

        CLEAR wa_bdcdata.
        wa_bdcdata-fnam     = 'RC29N-STLAN'.
        wa_bdcdata-fval     = '3'. " Universal BOM by default or use some logic
        APPEND wa_bdcdata TO bdcdata.

        CLEAR wa_bdcdata.
        wa_bdcdata-fnam     = 'RC29N-DATUV'.
        ASSIGN COMPONENT 'SPTAG' OF STRUCTURE <grs_head> TO <grv_cell>.
        CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
          EXPORTING
            input  = <grv_cell>
          IMPORTING
            output = wa_bdcdata-fval.
        APPEND wa_bdcdata TO bdcdata.
        wa_bdcdata-fnam     = 'RC29N-DATUB'.
        APPEND wa_bdcdata TO bdcdata.

        opt-nobinpt = 'X'.
        opt-dismode = 'E'.
        opt-racommit = 'X'.

        CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
          EXPORTING
            tcode  = 'CS03'
          EXCEPTIONS
            ok     = 1
            not_ok = 2
            OTHERS = 3.

        IF sy-subrc EQ 1.
          CALL TRANSACTION 'CS03'
          USING bdcdata
                OPTIONS FROM opt.
        ENDIF.