2007 Jun 20 10:40 PM
Folks,
i am using ABAP-OO and i have not defined Select-option on selection screen rather i have defined parameters.Now once i get input from user i wrote this code to convert parameters into select-option (in internal table).
wa_It_brd_selopt-sign = 'I'.
wa_It_brd_selopt-option = 'BT'.
wa_It_brd_selopt-LOW = Stru_Cn_Selcrtr-ca_brand.
wa_It_brd_selopt-HIGH = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_It_brd_selopt TO It_brd_selopt.
wa_It_slsrl_selopt-sign = 'I'.
wa_It_slsrl_selopt-option = 'BT'.
wa_It_slsrl_selopt-LOW = Stru_Cn_Selcrtr-ca_slsrl.
wa_It_slsrl_selopt-HIGH = Stru_Cn_Selcrtr-ca_slsrl.
APPEND wa_It_slsrl_selopt TO It_slsrl_selopt.
wa_It_crtby_selopt-sign = 'I'.
wa_It_crtby_selopt-option = 'BT'.
wa_It_crtby_selopt-LOW = Stru_Cn_Selcrtr-ca_crtby.
wa_It_crtby_selopt-HIGH = Stru_Cn_Selcrtr-ca_crtby.
APPEND wa_It_crtby_selopt TO It_crtby_selopt.
inthis way i got select option internal table.
select * from ZNSLVWHDIMMD_LCL
into corresponding fields of table IT_VIEW
WHERE SALESRLNO in It_slsrl_selopt
and CREATEDBY in It_crtby_selopt
and BRANDID in It_brd_selopt.
but when i give input to SALESRLNO ,CREATEDBY and BRANDID then and then this selection statement runs and sy-subrc = 0.If i dont give only 2 input it does not work..i dont know why it is happening.It is because its ABAP-OO.I dont have any clue.Please help.Points will be rewarded.
Folks,
i am using ABAP-OO and i have not defined Select-option on selection screen rather i have defined parameters.Now once i get input from user i wrote this code to convert parameters into select-option (in internal table).
wa_It_brd_selopt-sign = 'I'.
wa_It_brd_selopt-option = 'BT'.
wa_It_brd_selopt-LOW = Stru_Cn_Selcrtr-ca_brand.
wa_It_brd_selopt-HIGH = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_It_brd_selopt TO It_brd_selopt.
wa_It_slsrl_selopt-sign = 'I'.
wa_It_slsrl_selopt-option = 'BT'.
wa_It_slsrl_selopt-LOW = Stru_Cn_Selcrtr-ca_slsrl.
wa_It_slsrl_selopt-HIGH = Stru_Cn_Selcrtr-ca_slsrl.
APPEND wa_It_slsrl_selopt TO It_slsrl_selopt.
wa_It_crtby_selopt-sign = 'I'.
wa_It_crtby_selopt-option = 'BT'.
wa_It_crtby_selopt-LOW = Stru_Cn_Selcrtr-ca_crtby.
wa_It_crtby_selopt-HIGH = Stru_Cn_Selcrtr-ca_crtby.
APPEND wa_It_crtby_selopt TO It_crtby_selopt.
inthis way i got select option internal table.
select * from ZNSLVWHDIMMD_LCL
into corresponding fields of table IT_VIEW
WHERE SALESRLNO in It_slsrl_selopt
and CREATEDBY in It_crtby_selopt
and BRANDID in It_brd_selopt.
but when i give input to SALESRLNO ,CREATEDBY and BRANDID then and then this selection statement runs and sy-subrc = 0.If i dont give only 2 input it does not work..i dont know why it is happening.It is because its ABAP-OO.I dont have any clue.Please help.Points will be rewarded.
2007 Jun 20 10:43 PM
It does not work because it is searching for blank values.
What you can do is, you can put a condition whether the parameter contains any value or not.
And i assume that it_brd_selopt is a range variable here.
If not, then plz make it a range variable.
if not Stru_Cn_Selcrtr-ca_brand is initial.
wa_It_brd_selopt-sign = 'I'.
wa_It_brd_selopt-option = 'BT'.
wa_It_brd_selopt-LOW = Stru_Cn_Selcrtr-ca_brand.
wa_It_brd_selopt-HIGH = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_It_brd_selopt TO It_brd_selopt.
endif.
Like wise keep condition for all of them.
And one more thing,
rather than using 'BT', you can use 'EQ' like this:
if not Stru_Cn_Selcrtr-ca_brand is initial.
wa_It_brd_selopt-sign = 'I'.
wa_It_brd_selopt-option = 'EQ'.
wa_It_brd_selopt-LOW = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_It_brd_selopt TO It_brd_selopt.
endif.
2007 Jun 20 10:43 PM
You shouldn't be using regular internal tables as select options. (I'm surprised it doesn't give a syntax error.) Use range tables instead.
Rob
2007 Jun 20 10:48 PM
You have to check for initial values before you fill the select options.
IF Stru_Cn_Selcrtr-ca_brand IS NOT INITIAL.
wa_It_brd_selopt-sign = 'I'.
wa_It_brd_selopt-option = 'BT'.
wa_It_brd_selopt-LOW = Stru_Cn_Selcrtr-ca_brand.
wa_It_brd_selopt-HIGH = Stru_Cn_Selcrtr-ca_brand.
APPEND wa_It_brd_selopt TO It_brd_selopt.
ENDIF.
IF Stru_Cn_Selcrtr-ca_slsrl IS INITIAL.
wa_It_slsrl_selopt-sign = 'I'.
wa_It_slsrl_selopt-option = 'BT'.
wa_It_slsrl_selopt-LOW = Stru_Cn_Selcrtr-ca_slsrl.
wa_It_slsrl_selopt-HIGH = Stru_Cn_Selcrtr-ca_slsrl.
APPEND wa_It_slsrl_selopt TO It_slsrl_selopt.
ENDIF.
IF Stru_Cn_Selcrtr-ca_crtby IS NOT INITIAL.
wa_It_crtby_selopt-sign = 'I'.
wa_It_crtby_selopt-option = 'BT'.
wa_It_crtby_selopt-LOW = Stru_Cn_Selcrtr-ca_crtby.
wa_It_crtby_selopt-HIGH = Stru_Cn_Selcrtr-ca_crtby.
APPEND wa_It_crtby_selopt TO It_crtby_selopt.
ENDIF.
2007 Jun 21 3:36 AM
Folks,
If u search data dictionary then u must have found that if field r empty althoug we get perfect ouput.I want he same..i used the 'EQ' instead of 'BT' and can anyone has code to show how to use range table in ABAP-OO.
Nirad
2007 Jun 21 3:52 AM
Nirad,
Use ranges Here.
RANGES <rangetab> FOR <f>.
This statement is simply a shortened form of the following statements:
DATA: BEGIN OF <rangetab> OCCURS 0,
sign(1) TYPE c,
option(2) TYPE c,
low LIKE <f>,
high LIKE <f>,
END OF <rangetab>.
Don't forget to reward for all useful answers...
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |