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

Dynamic selection in a submit

Former Member
0 Likes
423

Hi guys,

I have a questions about dynamic selection.

I would like to submit a report but one of the parameters change . It parameter depend on the screen selection p_new.

The line "WITH SO_CMOVI IN R_RANGE1 " or " WITH SO_CMOVI IN R_RANGE2" is the difference.

if p_new = 'X'.
SUBMIT Z_BW_CIECONT WITH SO_SOC IN PSO_SOC
                        WITH SO_OPER IN PSO_OPERBW
                        WITH P_INI EQ <FS1>
                        WITH P_FIN EQ <FS1>
                        WITH SO_TIPO EQ P_MOVI
*                        WITH SO_CMOVI IN R_RANGE1
                        WITH P_TEST EQ PP_TEST.
ELSE
SUBMIT Z_BW_CIECONT WITH SO_SOC IN PSO_SOC
                        WITH SO_OPER IN PSO_OPERBW
                        WITH P_INI EQ <FS1>
                        WITH P_FIN EQ <FS1>
                        WITH SO_TIPO EQ P_MOVI
*                        WITH SO_CMOVI IN R_RANGE2
                        WITH P_TEST EQ PP_TEST.
ENDIF.
I would like something like this :
range : R_RANGE2 for VTBFHA-SGSART.
data: G_PRODUCTO(13) type c value 'R_RANGE1'.
if p_new = '00'. 
      G_PRODUCTO =' R_RANGE2'.
endif.

FIELD-SYMBOLS: <FS2> TYPE ANY.
ASSIGN (G_PRODUCTO) TO <FS2>
if sy-subrc eq 0.
SUBMIT Z_BW_CIECONT WITH SO_SOC IN PSO_SOC
                        WITH SO_OPER IN PSO_OPERBW
                        WITH P_INI EQ <FS1>
                        WITH P_FIN EQ <FS1>
                        WITH SO_TIPO EQ P_MOVI
*                        WITH SO_CMOVI IN <FS2>
                        WITH P_TEST EQ PP_TEST.
endif.

This code is wrong because <FS2> is not an internal table.

Thanks in advance.

Best Regards.

Ana

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
382

You can use the addition WITH SELECTION-TABLE rspar of the SUBMIT syntax.

Check this link:

http://help.sap.com/abapdocu_70/en/ABAPSUBMIT_SELSCREEN_PARAMETERS.htm#!ABAP_ADDITION_3@3@

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
382

Your code is ok, you only have two problems

<fs2> should be declared as type table

At the assing you should place 'R_RANGE2[]' instead of 'R_RANGE2'. The first one is a table, the second is a structure.

Another reason to stop using the range instruction and just declare the variable as TYPE RANGE OF

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
382

Check declaring like this.

FIELD-SYMBOLS: <FS2> type any table.