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

How to Pass Variables using Submit

spartans007
Participant
0 Kudos
2,333

Hello,

I am facing an issue to pass variables using submit, below is my code.

THE gv_value1 and gv_value2 is always blank.

I also tried using cl_salv_bs_runtime_info, But it did not work.

My variables are always blank.

Any solution to pass gv_value1 as 'X' and gv_value2 as X ?

Thank You.


     IF gv_rep EQ abap_true
             AND gv_fun EQ abap_true.
        SUBMIT z_rep
                  WITH gv_value1 = abap_true
WITH gv_value2 = abap_true
WITH p_bill = zhdr-zzmonth WITH p_fund = gs_reports-geber AND RETURN. ENDIF.
12 REPLIES 12
Read only

FredericGirod
Active Contributor
0 Kudos
2,264

did you try to specify USING SELECTION-SCREEN '1000' ?

Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
0 Kudos
2,264

Have you declared gv_value1 and gv_value2 as parameters of the Z_REP report?

Read only

Sandra_Rossi
Active Contributor
2,264

We don't know Z_REP so it's impossible to help, you don't give enough information.

Also we don't know whether GV_VALUE1 and GV_VALUE2 are PARAMETERS or not. WITH works only with selection screen fields, not global variables.

Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
2,264

You can use VIA SELECTION-SCREEN addition to the SUBMIT statement. This way the selection screen with the values passed is displayed before the report is executed. That makes it easy to verify the value passed to the report.

Read only

spartans007
Participant
0 Kudos
2,264

i have declared the values of gv_value1 and gv _value2 in my zrep.

gv_value1 and gv_value2 are not any parameters.

Read only

spartans007
Participant
0 Kudos
2,264

ok 3a9e4ce873a94034b33dc62b0ce600ee i will try it via selection screen

Read only

thkolz
Contributor
2,264

Are your parameters really called gv_value1 or gv_value2?
This sounds more like global values to me which can't be changed via SUBMIT.

You can only pass parameters or select options...

Read only

RaymondGiuseppi
Active Contributor
2,264

You wrote

'i have declared the values of gv_value1 and gv _value2 in my zrep.

gv_value1 and gv_value2 are not any parameters.'

So don't expect to pass those values with the WITH option of SUBMIT statement.

(Try to define those fields as NO-DISPLAY parameters or pass those walues with some EXPORT/IMPORT or SET/GET parameters)

Read only

thkolz
Contributor
2,264

If GV_VALUE1 and GV_VALUE2 are global variable in Z_REP, you can't pass them on via SUBMIT.
You first need to add parameters for them (they can also be hidden).

REPORT z_rep.
...
PARAMETERS:
  p_value1 TYPE char01 NO-DISPLAY,
  p_value2 TYPE char01 NO-DISPLAY.

...

START-OF-SELECTION.
* Set global variables
  gv_value1 = p_value1.
  gv_value2 = p_value1.

...

Then you can pass the values from the calling program:

DATA(lt_sel_par) = VALUE rsparams_tt( kind  = 'P'  sign  = 'I'  option = 'EQ'  
                                    ( selname = 'P_VALUE1' low = 'X' )  
                                    ( selname = 'P_VALUE2' low = 'X' )  
                                    ( selname = 'P_BILL'  low = zhdr-zzmonth ) 
                                    ( selname = 'P_FUND' low = gs_reports-geber )  ).              

SUBMIT z_rep WITH SELECTION-TABLE lt_seltab.

Second option (although not the preferred one):
Use EXPORT TO MEMORY in calling program (e.g. EXPORT abap_true TO MEMORY ID 'Z_REP_VALUE1') and IMPORT FROM MEMORY in Z_REP (IMPORT gv_value1 FROM MEMORY ID 'Z_REP_VALUE1').

Read only

0 Kudos
2,264

Using Memory ID worked for me thank you

Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
0 Kudos
2,264

spartans007 as "gv_value1 and gv_value2 are not any parameters" than you can't pass values to them with SUBMIT.

Read only

spartans007
Participant
2,264

Thank you Everyone for your support.