06-21-2007 4:12 PM
Dear folks,
I am facing weird problem with range table in selection query.I have problem with bold part of code.Here when i give input to both ranges r_salesno,r_brandid then and the selection occurs ,when i put black in one of those it does not work.I haev passed Empty table to range if no inpiut in elements..although it does not work..I dont know why it is happening...By the i m using this code in Webdynpro ABAP.Please help points will be awarded..
if Stru_Cn_Selcrtr-ca_slsrl is not initial.
wa_salesno-sign = 'I'.
wa_salesno-option = 'EQ'.
wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
APPEND wa_salesno TO r_salesno.
CLEAR : wa_salesno .
else.
wa_salesno-sign = 'I'.
wa_salesno-option = 'EQ'.
wa_salesno-LOW = space.
APPEND wa_salesno TO r_salesno.
CLEAR : wa_salesno .
endif.
if Stru_Cn_Selcrtr-ca_brand is not initial.
wa_brandid-sign = 'I'.
wa_brandid-option = 'EQ'.
wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_brandid TO r_brandid.
CLEAR : wa_brandid .
else.
wa_brandid-sign = 'I'.
wa_brandid-option = 'EQ'.
wa_brandid-LOW = space.
APPEND wa_brandid TO r_brandid.
CLEAR : wa_brandid .
endif.
*If any of these are given then select data accordingly.
<b>select * from ZNSLVWHDIMMD_LCL
into corresponding fields of table IT_VIEW
WHERE SALESRLNO in r_salesno
* and CREATEDBY in It_crtby_selopt
* and STARTDATE in It_validfrm_selopt
* and ENDDATE in It_validto_selopt
* and STATUS in It_status_selopt1
and BRANDID in r_brandid.
* and MODELNO in It_model_selopt.</b>
06-21-2007 7:34 PM
Hello Nirad
Your coding is problematic. I assume that field SALESRLNO (of table ZNSLVWHDIMMD_LCL) probably means sales number (or sales order) and, thus, must not be empty. If this is correct then the first IF statement is probably wrong:
if Stru_Cn_Selcrtr-ca_slsrl is not initial.
wa_salesno-sign = 'I'.
wa_salesno-option = 'EQ'.
wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
APPEND wa_salesno TO r_salesno.
CLEAR : wa_salesno .
else.
REFRESH: r_salesno. " means: select all sales numbers
" NOTE: If you fill the range like below this means that only sales order
" with no sales number (= ' ', space) should be select.
" Thus, there will never be any sales order selected.
* wa_salesno-sign = 'I'.
* wa_salesno-option = 'EQ'.
* wa_salesno-LOW = space.
* APPEND wa_salesno TO r_salesno.
* CLEAR : wa_salesno .
endif.
The same logic applies to the second IF statement. If you want to select all BRANDID if none has been provided as selection criteria then code:
if Stru_Cn_Selcrtr-ca_brand is not initial.
wa_brandid-sign = 'I'.
wa_brandid-option = 'EQ'.
wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_brandid TO r_brandid.
CLEAR : wa_brandid .
else.
REFRESH: r_brandid. " means: select all BRANDID
* wa_brandid-sign = 'I'.
* wa_brandid-option = 'EQ'.
* wa_brandid-LOW = space.
*
* APPEND wa_brandid TO r_brandid.
* CLEAR : wa_brandid .
endif.
Regards
Uwe
06-21-2007 7:34 PM
Hello Nirad
Your coding is problematic. I assume that field SALESRLNO (of table ZNSLVWHDIMMD_LCL) probably means sales number (or sales order) and, thus, must not be empty. If this is correct then the first IF statement is probably wrong:
if Stru_Cn_Selcrtr-ca_slsrl is not initial.
wa_salesno-sign = 'I'.
wa_salesno-option = 'EQ'.
wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
APPEND wa_salesno TO r_salesno.
CLEAR : wa_salesno .
else.
REFRESH: r_salesno. " means: select all sales numbers
" NOTE: If you fill the range like below this means that only sales order
" with no sales number (= ' ', space) should be select.
" Thus, there will never be any sales order selected.
* wa_salesno-sign = 'I'.
* wa_salesno-option = 'EQ'.
* wa_salesno-LOW = space.
* APPEND wa_salesno TO r_salesno.
* CLEAR : wa_salesno .
endif.
The same logic applies to the second IF statement. If you want to select all BRANDID if none has been provided as selection criteria then code:
if Stru_Cn_Selcrtr-ca_brand is not initial.
wa_brandid-sign = 'I'.
wa_brandid-option = 'EQ'.
wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_brandid TO r_brandid.
CLEAR : wa_brandid .
else.
REFRESH: r_brandid. " means: select all BRANDID
* wa_brandid-sign = 'I'.
* wa_brandid-option = 'EQ'.
* wa_brandid-LOW = space.
*
* APPEND wa_brandid TO r_brandid.
* CLEAR : wa_brandid .
endif.
Regards
Uwe
06-21-2007 8:49 PM
I have solved this problem with dynamic selection at my own .By the way thankx for looking at problem and i have awarded points to you.Have a good day.
Message was edited by:
nirad pachchigar
06-21-2007 8:50 PM
Problem solved by Dynamic Selection of data according to fields selected on selcection screen.