on 10-13-2005 3:50 PM
Hi,
In the selection criteria, i am giving 5 (10,20,25,28,30) company codes in " 1 Single Val".
in the report, i want like this:
Company code = 10,20,25,28,30
does anyone know how to code this?
Thanks
I'm not exactly sure about your requirement, but try this.
report zrich_0002.
data: it001 type table of t001 with header line.
select-options: s_bukrs for it001-bukrs.
start-of-selection.
select * into corresponding fields of table it001
from t001
where bukrs in s_bukrs.
loop at it001.
write:/ it001-bukrs.
endloop.
* or
data: output(50) type c.
output = 'Company Code:'.
loop at it001.
if sy-tabix = 1.
concatenate output it001-bukrs into output separated by space.
else.
concatenate output it001-bukrs into output separated by ', '.
endif.
endloop.
write:/ output.
Regards,
Rich Heilman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The reason for the selection from db is that select-options is such a dynamic tool that you never know what is being selected from the select-options. You could be includeing, excluding, whatever. Of course you could just loop thru the table and write out the low values, but I thought that this might be a better way of catching anything that the user might enter in the select-options.
Again, the requirement is unclear.
Regards,
Rich Heilman
With Rainer suggestion......
report zrich_0002.
tables: t001.
select-options: s_bukrs for t001-bukrs.
data: output(50) type c.
start-of-selection.
output = 'Company Code:'.
loop at s_bukrs.
if sy-tabix = 1.
concatenate output s_bukrs-low into output separated by space.
else.
concatenate output s_bukrs-low into output separated by ', '.
endif.
endloop.
write:/ output.
Regards,
Rich Heilman
Rainer,
Rich is correct first time. Even though it is single values, I can still use the button 'selection options' and use something like >, >=, or <> etc. So unless I read each individual operand and the value, writing them out will not be easy. Moreover, if I declare the select option as follows
select-option s_bukrs for t001-bukrs no-intervals.
I still left the extension option open. If I click that, I get the 'Multiple selection' pop-up window. There I can enter my ranges again or exclude ranges. So now just looping a s_bukrs and writing out the LOW value will not make sense.
<b>So, to make a long story short, Rich's first approach is the correct one.</b>
Srinivas
Please make a note of what I mentioned. It works as long as you sincerely enter single values and do not use any of the complex selections or the operands other than '='. Let us say I enter '= 10' and '>30' in my single selections. So my bukrs should be 10, 40, 50 and so on. Whereas with Rich's second code, you will get it as 10, 30; which is obviously wrong.
Srinivas
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.