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 Variables using Submit

spartans007
Participant
0 Kudos
828

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

FredericGirod
Active Contributor
0 Kudos
759

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

DominikTylczyn
Active Contributor
0 Kudos
759

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

Sandra_Rossi
Active Contributor
759

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.

DominikTylczyn
Active Contributor
759

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.

spartans007
Participant
0 Kudos
759

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

gv_value1 and gv_value2 are not any parameters.

spartans007
Participant
0 Kudos
759

ok 3a9e4ce873a94034b33dc62b0ce600ee i will try it via selection screen

thkolz
Contributor
759

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

raymond_giuseppi
Active Contributor
759

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)

thkolz
Contributor
759

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

0 Kudos
759

Using Memory ID worked for me thank you

DominikTylczyn
Active Contributor
0 Kudos
759

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

spartans007
Participant
759

Thank you Everyone for your support.