‎2009 Oct 20 7:27 PM
Hi floks,
Am new to the module pool development ,Recently i have created one program based on customer requwst. in this program First screen having 4 selection parameters like1,2,3,4. based on selection parameters i have to display values in table control .But i have lot of combinations like
first : all are initialized
second : 1is having vaue and other or intialised. like..
its crisp logic to write based on all combitions .
there is another way to declare ths type things ..
please give me pseducode or tipsof this crisp code combinations
thanks
nithaya.
‎2009 Oct 21 6:36 AM
Hi,
You can follow this alternative for your requirement.
Say you have 4 parameters as:
1st parameter : MATNR (material number from MARA)
2nd parameter : MTART (material type from MARA)
3rd parameter : MATKL (material group from MARA)
4th parameter : MBRSH (industry sector from MARA)
Now user may or may not put in the parameter values for these 4 defined parameters.
So if you want to filter data according to the entries the user provides in (in any or all of the 4 parameters)
Refer:
RANGES : r_matnr FOR mara-matnr,
r_mtart FOR mara-mtart,
r_matkl FOR mara-matkl,
r_mbrsh FOR mara-mbrsh.
"first parameter
IF NOT p_matnr IS INITIAL.
r_matnr-sign = 'I'.
r_matnr-option = 'EQ'.
r_matnr-low = p_matnr.
APPEND r_matnr.
CLEAR r_matnr.
ELSE.
REFRESH r_matnr.
ENDIF.
"second parameter
IF NOT p_mtart IS INITIAL.
r_mtart-sign = 'I'.
r_mtart-option = 'EQ'.
r_mtart-low = p_mtart.
APPEND r_mtart.
CLEAR r_mtart.
ELSE.
REFRESH r_mtart.
ENDIF.
"third parameter
IF NOT p_matkl IS INITIAL.
r_matkl-sign = 'I'.
r_matkl-option = 'EQ'.
r_matkl-low = p_matkl.
APPEND r_matkl.
CLEAR r_matkl.
ELSE.
REFRESH r_matkl.
ENDIF.
"fourth parameter
IF NOT p_mbrsh IS INITIAL.
r_mbrsh-sign = 'I'.
r_mbrsh-option = 'EQ'.
r_mbrsh-low = p_mbrsh.
APPEND r_mbrsh.
CLEAR r_mbrsh.
ELSE.
REFRESH r_mbrsh.
ENDIF.
Now use these ranges to populate the data.
SELECT <field1, field2, ...>
FROM MARA
INTO it_material
WHERE matnr IN r_matnr
AND mtart IN r_mtart
AND matkl IN r_matkl
AND mbrsh IN r_mbrsh.
Now this query will fetch you the details as per your requirement.
Hope this helps you.
Let me know if you need some more help.
Regards,
Tarun
‎2009 Oct 22 12:35 PM
Hi ,
The solution suggested is clear,
However if you have to make selection on the parameters using combination like and ,or then u could use dynamic select query to retrieve data .
since u can not give with all the combinations ,
So once u have fetced the parameters in ranges table then use the dynamic selection to fetch the required data.
Thanks ,
M.Naveen Kumar