This website is not affiliated with, sponsored by, or approved by SAP AG.

Put selection value in a variable

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Put selection value in a variable

Postby rpinxt » Tue Jul 07, 2015 5:20 am

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.
rpinxt
 
Posts: 146
Joined: Mon Jul 23, 2012 8:02 am

Re: Put selection value in a variable

Postby Baz » Tue Jul 07, 2015 5:34 am

how are the parameters defined?

Try BR_BUKRS-LOW.
Baz

AsPiRiNg tUlY iDiOt Image

http://www.catb.org/~esr/faqs/smart-questions.html

Image

check out my Podcasts http://dj-baz.podomatic.com
Baz
 
Posts: 4736
Joined: Fri Nov 08, 2002 5:54 am
Location: He's out there! somewhere!!!!

Re: Put selection value in a variable

Postby rpinxt » Tue Jul 07, 2015 5:51 am

Well your suggestion worked Baz!
Don't know why but thank you very much! :)
rpinxt
 
Posts: 146
Joined: Mon Jul 23, 2012 8:02 am

Re: Put selection value in a variable

Postby Gothmog » Tue Jul 07, 2015 6:03 am

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).
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Put selection value in a variable

Postby rpinxt » Tue Jul 07, 2015 6:28 am

Ah ok, thanks Gothmog!
Appreciate these extra knowledge details :)
rpinxt
 
Posts: 146
Joined: Mon Jul 23, 2012 8:02 am

Re: Put selection value in a variable

Postby Rich » Mon Jul 13, 2015 4:38 am

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.
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool


Return to ABAP

Who is online

Users browsing this forum: Google [Bot] and 5 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.