‎2010 Feb 02 11:18 PM
hi,
I have a requirements where to include my select option for different values..
say for eg .
constant c_au10 TYPE bukrs VALUE 'AU00',
c_au99 TYPE bukrs VALUE 'AU99',
SELECT-OPTIONS: s_bukrs FOR z2rlbasedat-z2bukrs no-extension,
INITIALIZATION.
s_bukrs-sign = 'I'.
s_bukrs-option = 'BT'.
s_bukrs-low = c_au10. "005c
s_bukrs-high = c_au99.
APPEND s_bukrs.
Now i need to include for New Zealand.....so how to include NZ specific sources .....I will declare as 2 different constants ...but how to declare in the intialization part....
thanks
Edited by: JaiKarthik on Feb 3, 2010 12:18 AM
‎2010 Feb 03 12:52 PM
You can use TVARVC table for maintaining the select options.
BEGIN OF ty_range, " Type declaration for range
sign TYPE tvarv_sign, " Sign
opti TYPE tvarv_opti, " Option
low TYPE tvarv_val, " Low Value
high TYPE tvarv_val, " High Value
END OF ty_range,
DATA: c_select_option_name TYPE char25 value 'S_SELECT_OPTION'.
i_company_codes TYPE STANDARD TABLE OF ty_range, " Internal table for document types
SELECT sign " Sign
opti " Option
low " Low value
high " High value
FROM tvarvc
INTO TABLE i_company_codes WHERE name = c_select_option_name.
Use I_COMPANY_CODES as your select option.
Go to transaction STVARV
Click on selection options tab
In name type S_SELECT_OPTION
and you can insert as many as company codes in against the name S_SELECT_OPTION it will get fetched using the above code in your program during program run.
Hope this will help you.
‎2010 Feb 03 12:31 AM
Hi ,
Looks like you will need your select options to be filled in depending on the country (AU or NZ).
One way will be to maintain a custom table with the constants per country and read this in the initialixation block and fill up your select options from this table read.
The other option will be to use a case statement based on your country in the initialization.
I would recommend you try option 1.
Regards,
Neil.
‎2010 Feb 03 3:17 AM
Hi,
You can not able to declare two contants, Constant will always have a single value,
I am agree with the answer given by Mr.Neil, I also recommend the option one suggested by him,
It will be always good to maintain a seperate 'Ztable' and you can select your selection form that table, if tomorrow, say you need to add more country, it will be esay for you to add the new country in the 'Ztable' and that time, you need not required to modify your program
Hope this will help you
Rani
‎2010 Feb 03 3:45 AM
Hello Jai & others,
I have a doubt, if you want NO-EXTENSION what is the use for maintaining multiple ranges ?
Or do you want to populate the SELECT-OPTION based on some condition?
BR,
Suhas
‎2010 Feb 03 3:59 AM
you can pass using multiple option by omiting no-extension which is similar to suhas said
or u can also maintain one ztable for your required country specific and fetch from the same to acheive what ever you want
cheers
s.janagar
‎2010 Feb 03 12:52 PM
You can use TVARVC table for maintaining the select options.
BEGIN OF ty_range, " Type declaration for range
sign TYPE tvarv_sign, " Sign
opti TYPE tvarv_opti, " Option
low TYPE tvarv_val, " Low Value
high TYPE tvarv_val, " High Value
END OF ty_range,
DATA: c_select_option_name TYPE char25 value 'S_SELECT_OPTION'.
i_company_codes TYPE STANDARD TABLE OF ty_range, " Internal table for document types
SELECT sign " Sign
opti " Option
low " Low value
high " High value
FROM tvarvc
INTO TABLE i_company_codes WHERE name = c_select_option_name.
Use I_COMPANY_CODES as your select option.
Go to transaction STVARV
Click on selection options tab
In name type S_SELECT_OPTION
and you can insert as many as company codes in against the name S_SELECT_OPTION it will get fetched using the above code in your program during program run.
Hope this will help you.
‎2010 Feb 03 1:07 PM
declare the constants
then after append
s_bukrs-low = NEW
s_bukrs-high = NEW.
append again