Page 1 of 1

Put selection value in a variable

Posted: Tue Jul 07, 2015 5:20 am
by rpinxt
So I want to "catch" the company code someone fills in when running the report into a variable.
This variable i later use in some coding which is dependant on the company code which has been entered.

The Logical Database BRF has in the selections tab the selection BR_BUKRS being company code.

So I tried with this code :

Code: Select all

WRITE BR_BUKRS TO RP_COMP.
and also with this code:

Code: Select all

MOVE BR_BUKRS TO RP_COMP.
Using this in the report however gave me output (both cases) 'IEQC'
I was expecting C001 or C090.
Strange thing is that when you press the search in that field next to IEQC you will get all the company codes in just the same way I am used to.

So I take it 'IEQC' is somewhat of a internal naming of some sort?
And if such how do I get the naming that I am used to?
Thanks.

Re: Put selection value in a variable

Posted: Tue Jul 07, 2015 5:34 am
by Baz
how are the parameters defined?

Try BR_BUKRS-LOW.

Re: Put selection value in a variable

Posted: Tue Jul 07, 2015 5:51 am
by rpinxt
Well your suggestion worked Baz!
Don't know why but thank you very much! :)

Re: Put selection value in a variable

Posted: Tue Jul 07, 2015 6:03 am
by Gothmog
A select-option is a range table, with four fields:
SIGN: I(nclude) or E(xclude)
OPTION: EQ for equal, BT for between, GT for Grater than...
LOW: lower value
HIGH: higher value

BR_BUKRS is the complete line, BR_BUKRS-LOW is the low value you wanted.
Your IEQC means Include values EQual to C... (the value has probably been truncated).

Re: Put selection value in a variable

Posted: Tue Jul 07, 2015 6:28 am
by rpinxt
Ah ok, thanks Gothmog!
Appreciate these extra knowledge details :)

Re: Put selection value in a variable

Posted: Mon Jul 13, 2015 4:38 am
by Rich
However.....

Since this is a 'range' table as GothMog so rightly says, you cannot 'catch' the company code that a user enters.

There are no restrictions on the company code select option in the LDB so the company code can be a single value, a range, a discrete list, it can contain exclusions etc etc.

If you're requirements mean that you should only be processing a single company code then you need to check the values returned by the select option first by selecting from table T001 and displaying an error if more than one company code is returned.

Also. it is possible to return company codes that are NOT mentioned in the select options explicitly either by using a range or by using the 'NE' option, or even patterns.