Skip to Content
avatar image
Former Member

How to pass parameters to a transaction?

I have called transactions QP02 and QP03 by passing the data as shown in the below code.

SET PARAMETER ID: 'PLN' FIELD gwa_plancreated-plnnr,

'MAT' FIELD gwa_plancreated-matnr,

'WRK' FIELD gwa_plancreated-werks,

'PAL' FIELD gwa_plancreated-plnal.

CALL TRANSACTION 'QP03' AND SKIP FIRST SCREEN.

SET PARAMETER ID: 'PLN' FIELD gwa_plancreated-plnnr,

'MAT' FIELD gwa_plancreated-matnr,

'WRK' FIELD gwa_plancreated-werks,

'PAL' FIELD gwa_plancreated-plnal.

CALL TRANSACTION 'QP02' AND SKIP FIRST SCREEN.


I could do the above thing because the initial screens of those transactions have some fileds which need to be filled with data.

I should do the same for CG02 transaction But the problem is that i cannot pass the values because we need to first press a push button to navigate to the fields. Please see the transaction CG02 once and provide me with a solution.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Jul 12, 2009 at 09:34 AM

    Hi, Vishnu

    You better do the following way here is the Sample Code.

    DATA: it_bdcdata TYPE TABLE OF bdcdata,
          wa_it_bdcdata LIKE LINE OF it_bdcdata.
    
    DATA opt TYPE ctu_params.
    
    CLEAR wa_it_bdcdata.
    wa_it_bdcdata-program  = 'SAPLCPDI'.
    wa_it_bdcdata-dynpro   = '8010'.
    wa_it_bdcdata-dynbegin = 'X'.
    APPEND wa_it_bdcdata TO it_bdcdata.
    
    CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_CURSOR'.
    wa_it_bdcdata-fval = 'RC27M-MATNR'.
    APPEND wa_it_bdcdata TO it_bdcdata.
    
    CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'RC27M-MATNR'.
    wa_it_bdcdata-fval = '00009700100900'. " Here Give Matnr
    APPEND wa_it_bdcdata TO it_bdcdata.
    
    CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_CURSOR'.
    wa_it_bdcdata-fval = 'RC27M-WERKS'.
    APPEND wa_it_bdcdata TO it_bdcdata.
    
    CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'RC27M-WERKS'.
    wa_it_bdcdata-fval = '3000'.  " Here Enter Werks
    APPEND wa_it_bdcdata TO it_bdcdata.
    
    opt-dismode = 'E'.
    
    CALL TRANSACTION 'QP02' USING it_bdcdata OPTIONS FROM opt.

    Please Reply if any Issue,

    Best Regards,

    Faisal

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Faisal,

      thanks alot for the answer. But i have no issues with QP02 or QP03 transactions. I have issue with CG02 transaction. Please help me solving this.

  • Jul 12, 2009 at 10:04 AM

    could you please reformat your initial question, because it appears too wide in the navigator.

    One solution to your issue is to call CG02 by "call transaction" in E mode (display screen only if error), so that to simulate button (and you may fill fields) and E is to remain on the last dynpro (though E is usually used for tests, this behavior is a welcome side effect 😊).

    Add comment
    10|10000 characters needed characters exceeded