‎2010 Jan 20 4:16 PM
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
‎2010 Jan 20 4:24 PM
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
‎2010 Jan 20 4:28 PM
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
‎2010 Jan 20 4:32 PM
Check declaring like this.
FIELD-SYMBOLS: <FS2> type any table.