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: 

How to pass parameters to a transaction?

Former Member
0 Kudos
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.

5 REPLIES 5

faisal_altaf2
Active Contributor

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

0 Kudos

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.

Sandra_Rossi
Active Contributor
0 Kudos

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 ).

0 Kudos

Hi,

Thank you. Could you write the stament and send ?

0 Kudos

Look at ABAP documentation : CALL TRANSACTION ... USING ... MODE 'E'. You may use SHDB and record your transaction to see how USING internal table is to be formatted.