2009 Aug 26 5:27 AM
Hi
I want to use a set of 5 different values of a particular variable in my FM. Is there any way in ABAP to assign multiple values on a single variable? Suppose, it is not a field of any table - just a normal variable!!!
Something like...
var_name = { val1, val2, val3, val4, val5 }.
Plz help.
2009 Aug 26 5:45 AM
Hi,
You cannot assign multiple values to the same variable in ABAP. You can use Ranges for this.
Data: var_name like rsranges,
var like line of var.
var-SIGN = 'I'.
var-OPTION = 'CP'.
var-low = 'val1'.
append var to var_nam.
var-low = 'val2'.
append var to var_nam.
var-low = 'val3'.
append var to var_nam.
var-low = 'val4'.
append var to var_nam.
var-low = 'val5'.
append var to var_nam.
Regards,
Vik
Hi,
No. The CP operator cannot be used directly in the select statement. Instead you can use like operation to search with wild card patterns.
Eg,
select firld1 field2.... fieldn
from <STD TABLE>
into table <INTERNAL TABLE>
where fieldx like '%P%P%'.
Regards,
Vik
2009 Aug 26 5:38 AM
A variable can store a single value at a time so if you want to assgign multiple values to a variable then one soultion can be use of CONCATENATE command.
I am not sure whether it will fulfil your requirements or not.
Example
CONCATENATE var1 var2 va3 var4 var4 into var SEPARATED BY space.
2009 Aug 26 5:45 AM
Hi,
You cannot assign multiple values to the same variable in ABAP. You can use Ranges for this.
Data: var_name like rsranges,
var like line of var.
var-SIGN = 'I'.
var-OPTION = 'CP'.
var-low = 'val1'.
append var to var_nam.
var-low = 'val2'.
append var to var_nam.
var-low = 'val3'.
append var to var_nam.
var-low = 'val4'.
append var to var_nam.
var-low = 'val5'.
append var to var_nam.
Regards,
Vik
2009 Aug 26 6:15 AM
Can we use CONTAINS PATTERN operator while selecting records from a STD Table?
Like....
select firld1 field2.... fieldn
from <STD TABLE>
into table <INTERNAL TABLE>
where fieldx CP '#P#P'.
plz suggest
2009 Aug 26 6:23 AM
Hi,
No. The CP operator cannot be used directly in the select statement. Instead you can use like operation to search with wild card patterns.
Eg,
select firld1 field2.... fieldn
from <STD TABLE>
into table <INTERNAL TABLE>
where fieldx like '%P%P%'.
Regards,
Vik
2009 Aug 26 6:28 AM
Hi vikred
Thx for ur reply. Its really helpful.
One more doubt - do you know if there is any table that stores the Production Order related Order Types?
Thx
Rich
2009 Aug 26 6:34 AM
Well am afraid you are not supposed to ask multiple questions within the same thread. It would be better if you close this thread and post a new one with all your queries.
Regards,
Vik
2009 Aug 26 6:35 AM
Hi, Richard
Please First Search for your Query and if not able to find any Solution than Post and always open new Thread for your New Question
Have a look at [Forum Rules|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
Faisal
2009 Aug 26 6:40 AM
>
> Hi,
>
> No. The CP operator cannot be used directly in the select statement. Instead you can use like operation to search with wild card patterns.
>
> Eg,
>
>
> select firld1 field2.... fieldn > from <STD TABLE> > into table <INTERNAL TABLE> > where fieldx like '%P%P%'. >>
> Regards,
> Vik
Dear Vikred
Please Don't Reply this way it is against the Forum Rules, Please
@Nitesh Pandey: Please you too
I think asking him to open New Thread for his New Query is Enough
Please Don't Mind
Faisal
2009 Aug 26 6:48 AM
Hi Faisal,
Well what was wrong with my reply? You mean ur asking not to reply for a different question? I felt we can consider replying for just one additional question instead of spamming the forum with new threads.
2009 Aug 26 7:00 AM
Hi Faisal/Vikred
Sorry for the confusion - In fact, my latter query is very much connected to former. and Vikred's reply solved my issue also.
For better understanding the query only, I changed the title for tht alone in my reply.
Thx a lot Vikred.
Regards
Rich
2009 Aug 26 6:21 AM
Hi, Richard
You can Simple Fill an Internal Table and Pass to your FM
Please Reply for any more help.
Regards,
Faisal
2009 Aug 26 6:22 AM
Hi,
It's advisable to use CP in if statement.
Just have a look at this.
Loop at <Your-internal-table.
IF <field> CP 'A@#$'.
** Write your code here.
ENDIF.
endloop.Thanks
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |