SAP BI & ABAP: Select with multi values
Hi all experts,
I'm pretty new in this forums, and i have a variable with customer exit, multiple values. This variable return several closing date (MM.YYYY) for a input plant. Below my sample code:
WHEN 'VARIABLE_NAME'.
CHECK i_step = 2.
*a plant
CLEAR w_plant.
*a project
CLEAR w_project.
*a version
CLEAR wt_version.
*a closing period for a budget
CLEAR w_cloper.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'plant_input'.
w_plant = loc_var_range-low.
w_project = loc_var_range-low(7).
ENDLOOP.
CALL FUNCTION 'CONVERSION_EXIT_PROJ_INPUT'
EXPORTING
input = w_project
IMPORTING
output = w_project.
SELECT * INTO TABLE w_version_table
FROM version_table
WHERE project = w_project. --> in this step i have multi value in my internal table.
If sy-subrc = 0.
LOOP AT w_version_table INTO wt_version_table.
CLEAR l_s_range.
l_s_range-low = wt_version_table-o_cloper.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range. --> in this step i get single value, last value in the internal table.
ENDLOOP.
ENDIF.
My code work it, but my variable return a single value. Which part of code i changed it to get all values.
Best regards.
Daous
Hi Daous,
if this is a BI question, would you mind posting it in one of the forums for BI & Analytics?
This here is really about search...
Best, Karsten
Similar Messages
-
CASE Statement in Where Condition with Multi Valued parameter in SSRS
Hi All,
I am little confused while using CASE statement in Where condition in SSRS. Below is my scenario:
SELECT
Logic here
WHERE
Date IN (@Date)AND
(CASE
WHEN NAME LIKE 'ABC%' THEN 'GROUP1'
WHEN ID IN ('123456', '823423','74233784') THEN 'GROUP2'
WHEN ABC_ID IS NULL THEN 'GROUP3'
ELSE 'GROUP4'
END ) IN (@GROUP)
So above query uses WHERE condition with CASE statement from @GROUP parameter. I want to pass this parameter as multi- valued parameter and hence I have used CASE statement IN (@GROUP).
For @Date one dataset will pass the available and default values and
for @GROUP parameters, another dataset will pass the available and default values.
But this is not working as expected. Please suggest me where I am making mistake in the query.
Maruthu | http://sharepoint-works.blogspot.comHi Maruthu,
According to your description, I create a sample report in my local environment. It works as I expected. In your scenario, if the selected values from the Date parameter contains some of the Date field values, the selected values from the GROUP parameter
contains some of GROUPS (‘GROUP1’,’GROUP2’,’GROUP3’,’GROUP4’) and the corresponding when statement is executed , then the dataset returns the corresponding values.
In order to trouble shoot this issue, could you tell us what results are you get and what’s your desired results? If possible, you can post the sample data with sample dataset, then we can make further analysis and help you out.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Hey,
I created a report in Reporting Services where I added multi-value parameter
( Filter). When I run my report, and try to select more than one parameter, I get an error: Incorrect syntax near ','
then i put in parameter expression : join(Parameters!Filter.Value,",")
and add : dbo.ufnSplit before calling parameter in query :
>>> set @valwhere = 'table.field IN (select * from dbo.ufnSplit(' + @Filter + ' , '',''))'
but i still have errors : incorrect syntax near 'text' which is the second value of the picklist of the parameter,
Please Any idea ?
Thanks !!I have sometimes had to collate as default with the SQL query
currently I've just using
CompanyName in
(selectitemfromdbo.fnSplit(@function,','))
In the SSRS report text box I have Join(Parameters!Company.Value,",") -
Using "Update All Mapped Fields" with multi-value attributes
Is it possible to update a value in a multi-value attribute through the import manager? It appears that if a source value is different then it just gets added as another value to the record.
For example, a product has an attribute of speed which is measured in revolutions/minute. Some products can be rated at two speeds (i.e. 1800/3600).
I created a numeric attribute for speed and enable only nominal rating and selected multi-valued.
In import manager, I set "/" as multi delimiter for source field. This created two entries in destination attribute, 1800 and 3600.
However, if on subsequent imports the speed values changes for this record (i.e. 1200 and 1800) then I will now have 1200, 1800, and 3600 as values for this record.
Would the proper solution be to create two individual numeric attributes that are single valued (i.e. Speed1 and Speed2)?Hi Aaron,
in your example it would make sense to use two different attributes called "Speed1" and "Speed2". Using the multi value option, MDM allows you to store a list of values into a single field. This list is more or less unlimited, you can add as many values as you like. A change of an existing value is not possible. The reason is that Import Manager does not know, which value you've changed! So it simply adds the "new" record (which is the 1200 in your example) to your value list. This is the intended behaviour of the "update all mapped fields option". If you really want to replace the values, you can check if the "Replace" option is useable for you. But note, that the replace will replace the complete existing record with the incoming new one. This means if the product you want to import with the replace option is smaller than the existing one (maybe it does not contain values for all segments), you'll loose data in MDM.
BR Michael -
How To Import Into A Table with Multi-Value Fields
Hello:
I have a table with a multi-value field that contains states in which a company does business. It is multi-value because there can be more than one state. I tried to import a text tab-delimited file in which the data was arranged as follows:
Field1 Tab Field 2 Tab OR, WA, CA Tab
The "State field contained the multiple entries separated by a comma (like they appear in a query of the multi-value field), but it won't accept it. Does anyone know how to import into a multi-value field?
Thanks,
Rich Locus, Logicwurks, LLCJoana:
Here's the code I used to populate a multi-value field from a parsed field. The parsing routine could be greatly improved by using the Split function, but at that time, I had not used it yet. FYI... the field name of the multi-value field in
the table was "DBAInStatesMultiValue", which you can see in the example below how it is integrated into the code.
Option Compare Database
Option Explicit
Option Base 1
Dim strInputString As String
Dim intNumberOfArrayEntries As Integer
Dim strStateArray(6) As String
' Loop Through A Table With A Multi-Value Field
' And Insert Values Into the Multi-Value Field From A
' Parsed Regular Text Field
Public Function InsertIntoMultiValueField()
Dim db As DAO.Database
' Main Recordset Contains a Multi-Value Field
Dim rsBusiness As DAO.Recordset2
' Now Define the Multi-Value Fields as a RecordSet
Dim rsDBAInStatesMultiValue As DAO.Recordset2
' The Values of the Field Are Contained in a Field Object
Dim fldDBAInStatesMultiValue As DAO.Field2
Dim i As Integer
' Open the Parent File
Set db = CurrentDb()
Set rsBusiness = db.OpenRecordset("tblBusiness")
' Set The Multi-Value Field
Set fldDBAInStatesMultiValue = rsBusiness("DBAInStatesMultiValue")
' Check to Make Sure it is Multi-Value
If Not (fldDBAInStatesMultiValue.IsComplex) Then
MsgBox ("Not A Multi-Value Field")
rsBusiness.Close
Set rsBusiness = Nothing
Set fldDBAInStatesMultiValue = Nothing
Exit Function
End If
On Error Resume Next
' Loop Through
Do While Not rsBusiness.EOF
' Parse Regular Text Field into Array For Insertion into Multi-Value
strInputString = rsBusiness!DBAInStatesText
Call ParseInputString
' If Entries Are Present, Add Them To The Multi-Value Field
If intNumberOfArrayEntries > 0 Then
Set rsDBAInStatesMultiValue = fldDBAInStatesMultiValue.Value
rsBusiness.Edit
For i = 1 To intNumberOfArrayEntries
rsDBAInStatesMultiValue.AddNew
rsDBAInStatesMultiValue("Value") = strStateArray(i)
rsDBAInStatesMultiValue.Update
Next i
rsDBAInStatesMultiValue.Close
rsBusiness.Update
End If
rsBusiness.MoveNext
Loop
On Error GoTo 0
rsBusiness.Close
Set rsBusiness = Nothing
Set rsDBAInStatesMultiValue = Nothing
End Function
Public Function ParseInputString()
Dim intLength As Integer
Dim intStartSearch As Integer
Dim intNextComma As Integer
Dim intStartOfItem As Integer
Dim intLengthOfItem As Integer
Dim strComma As String
strComma = ","
intNumberOfArrayEntries = 0
strInputString = Trim(strInputString)
intLength = Len(strInputString)
' Skip Zero Length Strings
If intLength = 0 Then
Exit Function
End If
' Strip Any Leading Comma
If Mid(strInputString, 1, 1) = "," Then
Mid(strInputString, 1, 1) = " "
strInputString = Trim(strInputString)
intLength = Len(strInputString)
If intLength = 0 Then
Exit Function
End If
End If
' Strip Any Trailing Comma
If Mid(strInputString, intLength, 1) = "," Then
Mid(strInputString, intLength, 1) = " "
strInputString = Trim(strInputString)
intLength = Len(strInputString)
If intLength = 0 Then
Exit Function
End If
End If
intStartSearch = 1
' Loop Through And Parse All the Items
Do
intNextComma = InStr(intStartSearch, strInputString, strComma)
If intNextComma <> 0 Then
intNumberOfArrayEntries = intNumberOfArrayEntries + 1
intStartOfItem = intStartSearch
intLengthOfItem = intNextComma - intStartOfItem
strStateArray(intNumberOfArrayEntries) = Trim(Mid(strInputString, intStartOfItem, intLengthOfItem))
intStartSearch = intNextComma + 1
Else
intNumberOfArrayEntries = intNumberOfArrayEntries + 1
intStartOfItem = intStartSearch
intLengthOfItem = intLength - intStartSearch + 1
strStateArray(intNumberOfArrayEntries) = Trim(Mid(strInputString, intStartOfItem, intLengthOfItem))
End If
Loop Until intNextComma = 0
End Function
Regards,
Rich Locus, Logicwurks, LLC
http://www.logicwurks.com -
Access 2007 : Dealing with multi-values
The only option I can find has been to export any multi-value tainted tables as text for future reference, then delete all those columns in order to convert the database to 2003.
Is this the best approach?Benjamin,
you can try the following:
(1) make the :ac bind variable public in the Customization Form Display Options tab. This way the :ac bind variable becomes the ac public portlet parameter;
(2) create a page parameter and name it ac in the Parameters tab of the page properties;
(3) wire the ac page parameter to the ac portlet parameter. This ensures that your portlet receives the page parameter value from the page URL;
(4) read the parameter value in the portlet's code. Here you have two options:
- read it in SQL statement:
<ORACLE>select * from hr.employees
where department_id in (:ac)</ORACLE>- read it in PL/SQL block by using PL/SQL API:
<ORACLE>
declare
l_names owa.vc_arr;
l_values owa.vc_arr;
begin
wwpro_api_parameters.retrieve(l_names, l_values);
htp.p('Number of portlet parameters: '||l_names.count);
htp.br;
for i in 1..l_names.count loop
htp.p('Parameter name: '||l_names(i));
htp.p('Parameter value: '||l_values(i));
htp.br;
end loop;
end;
</ORACLE>Hope this helps,
Sergei -
Append Query with multi values
I am attempting to append information into a new database. The old project information has some fields that are multi-value. Apparently an append query cannot handle this. Is there a way I can over come this?
Hi
>>Apparently an append query cannot handle this
Have you got some error? What's the problem you have encountered? Could you please show the sql you are using or share a sample to reproduce this ?
If you're adding a value to your multi-valued field, you can us an append query like this,
Insert into table (FieldName.value) values (value)
Best Regards
Lan
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
SAP BI Design Approach for Multi value attribute
Hi All,
I have a requirement for an object say 0MATERIAL which is having around 20 multi value attribute.(e.g. color)
I understand I can not add this attribute i.e. COLOR to master data attribute as the 0MATRIAL as this is the key and can not hold more than 1 values for its attributes.
One approach could be to create seperate DS and DSO for each of the attribute and finally combine them into info set to get the desire results, but as number of such attributes are 20 info set would not be a solution.
Could you please suggest the alternate solution for the same?
Many Thanks ,
Warm Regards,
NooNThanks Arun,
I already gone through this doc, could you please elaborate how exactly it works.
Regards,
Noon -
Bulk select with varying values ?
How do we implement bulk collect when the where condition varies ?
Here is a sample code...
I've problems with get_values procedure..
declare
type col1_type is table of number;
type col2_type is table of varchar2(30);
v_col1 col1_type;
v_col2 col2_type;
procedure get_values( p_col1 col1_type, p_col2 in out col2_type ) is
begin
forall j in p_col1.first .. p_col1.last
select col2
into p_col2
from temp2
where col1 = p_col1(j);
end;
begin
select col1, col2 bulk collect into v_col1, v_col2 from temp1;
for i in v_col1.first .. v_col1.last loop
dbms_output.put_line( v_col1(i) || ' ' || v_col2(i));
end loop;
get_values(v_col1, v_col2);
for i in v_col1.first .. v_col1.last loop
dbms_output.put_line( v_col1(i) || ' ' || v_col2(i));
end loop;
end;But my question was How can we pass an variable which hold multiple values( as shown in the example which is bold) and fetch the return values for all the values in the variable using FORALL OR RETURNING OR BULK COLLECT.
declare
type col1_type is table of number;
type col2_type is table of varchar2(30);
v_col1 col1_type;
v_col2 col2_type;
procedure get_values( p_col1 col1_type, p_col2 in out col2_type ) is
begin
/* How can we implement this using bulk without looping through each element of the variagle p_col1. I know it can done using for j in p_col1.first .. p_col1.last
loop ............ end loop; */
forall j in p_col1.first .. p_col1.last
select col2
into p_col2
from temp2
where col1 = p_col1(j);
end;
begin
select col1, col2 bulk collect
into v_col1, v_col2
from temp1;
for i in v_col1.first .. v_col1.last loop
dbms_output.put_line( v_col1(i) || ' ' || v_col2(i));
end loop;
get_values(v_col1, v_col2);
for i in v_col1.first .. v_col1.last loop
dbms_output.put_line( v_col1(i) || ' ' || v_col2(i));
end loop;
end; -
Hi All,
I have custom table with field that contains the * (star) values . ie
ABC*123
AB*1234
A*12345
A%12345
a&12345
I need to get values of all * entries using a select statement.
I don't need to select all and loop thru and filter it out
Any suggestions ?
Thanks
aRsHi,
You can build a wildcard ranges and please try something like this.
r_wildcard-sign = 'I'.
r_wildcard-option = 'CP'.
r_wildcard-low = 'B*'.
append r_wildcard.
r_wildcard-sign = 'I'.
r_wildcard-option = 'CP'.
r_wildcard-low = '*B*'.
append r_wildcard.
select * from mara
into table gt_mara_b
where mtart = 'YSAB'
and matnr in r_wildcard.
Regards,
Ferry Lianto -
Hi,
I want to use SELECT....INTO TABLE statement but using a fixed value in one column, is that possible???
I'm trying to do something like this:
SELECT matnr "sy-datum" quantity FROM ztable INTO TABLE it_table.
The it_table has got 3 columns: matnr, date and quantity but in the ztable there isn't a date and I want to insert into the table with a variable or something...
ThanksHi,
you can do like this.
Suppose your internal table structure is like that,
data:begin of itab occurs 0,
matnr type mara-matnr,
datum type sy-datum,
quant type menge,
end of itab.
SELECT matnr quant FROM ztable INTO corresponding fields of TABLE it_table.
loop at itab .
itab-datum = sy-datum.
modify itab index sy-tabix.
endloop.
If you do like this then your column of itab-datum will have sy-datum .
I hope this will help you.
Help children of U.N World Food Program by rewarding them and encourage others to answer your queries -
Abap query with constante value
hello,
I wish to create several abap query since tables MKPF and MSEG for the inventory mouvements. each query for a type of inventory turnover (101, 501, ), but I should not put the code movement in criteria of selection. it is necessary that the code movement should be fixed in the query. should-I declare the MSEG-BWART as a constante? where I can do it?
thank you for your assistance.
cordialy SaidHi,
Variant is a good option. Here is one more stable option.
Other option is to use following Code.
RANGES : ran1 FOR MSEG-BWART.
ran1-sign = 'I'.
ran1-option = 'EQ'.
ran1-low = 101.
APPEND ran1.
ran1-sign = 'I'.
ran1-option = 'EQ'.
ran1-low = 501.
APPEND ran1.
Then use ran1 similar to select option.
Hope this will help you.
Darshan -
How can I show report with multi value
Dear Maters,
I am creating a report using BUILD A REPORT USING A DYNAMIC TEMPLATE,
Although, I choose all product but my report only show value of revenue one product and not summary by quater, only by month.
Detail below:
I want to report :
ACTUAL, Periodic 2009.Q1 2009.Q2 2009.Q3 2009.Q4 2009.TOTAL
Revenue 7,300 232,000 20,000 140,000 465,000
Adjusted Revenue
Total Revenue 7,300 232,000 20,000 140,000 465,000
but I only can see :
ACTUAL, Periodic 2009.Q1 2009.Q2 2009.Q3 2009.Q4
Revenue
Adjusted Revenue
How can I customize for this,
I try using EVGST on member set but I don't know exactly what parameter on it
Please help me?
Thanks you so much and waiting advice from you
Best Regards
Chinh PhamHi,
Please refer to the EVGTS function in the below link from help.sap:
http://help.sap.com/saphelp_bpc75_nw/helpdata/en/ef/824d0b838a4c73bd460ec9d689607f/content.htm
You need to, basically, mention the data region from where you want to fetch the data. Depending on the template of your report, the account member comes from the row, and the time member comes from the column. So, for these 2 dimensions, you need to refer to the cells, which holds the ID of the members. For the rest of the dimensions, you should fetch the members from the page region, preferably.
Hope this helps. -
SAP Basis/Abap components with diff Version inEnterprise Service Builder
Dear Experts,
We have PI 7.4 system in our environment, when i check content in ESR, i have found different versions components as below.
SAP ABA 7.30
SAP BASIS 7.02 & SAP BASIS 7.40
I would like to know, since system is 7.4 version, do I need to maintain SAP ABA & Basis with 7.4 content only. Would there be any impact on developments/Models which are done using above version of ESR Content if I upload 7.40 Version content.
If I am not wrong developments/Models done with above versions would work with 7.40 too, but keen on to know what would be impact if I upload
7.40 Content in system.
Is there any possibility migrate developments/models/object to *tpz from above versions to 7.40 , if required.
I have checked SAP Note 1632370 - Maintenance of ESR Content (XI Content),SAP Note 1865292 - SAP NetWeaver 7.4: Import of ESR-Content,
and also link Importing ESR Content - Configuring Process Integration (PI) After Installation - SAP Library
still i dont see any information related to PI 7.4
SAP Note 1632370 has attachment where it only provides 7.30 version related ESR information.
Regards
ksHi Giridharan,
Thanks for reply.
I have gone through sap note 1868799 - SAP Basis ESR content versions after PI upgrade had clarified my questions.
There is no issue with seeing multiple versions of the SAP Basis content in the ESR or in the Integration Builder.
The Communication Channels will continue to work as normal using the old SAP Basis version.
The SAP Basis content contains the Adapter Metadata.
New adapter features are delivered with this Adapter Metadata.
If you have no business requirement to use any new features, then you don't need to make any changes to the existing channel configurations.
If you do have a requirement to use any new features, then you will need to change from the pre-upgrade version to the new PI version.
New channels can use either the older SAP Basis versions or the new SAP Basis version (it makes more sense to use the newer version).
Regards
sk -
Dump selective with multi tables and multi querys
Hi all,
I need generate dump from selective query.
Example
TableA
TableB
TableC
I need export TableA and TableB. TableA only record with 'fieldA' > 0 and TableB only record with 'fieldB' < 0. Is it possible?
I try exp command but I have problem with query parameter.
Exp USER/[email protected]:1521/myschema
file="mydump.dmp"
log="myLog.log"
tables=TableA,TableB
query=TableA:\"WHERE fieldA > 0\" TableB:\"WHERE fieldB > 0\"
Can you help me, please?
Thanks
LucaHi,
i think in normal exp you can not use multiple Query, you have to do it one by one
i.e
exp scott/tiger file=exp_tabel.dmp log=exp_tabel.log tables=emp query=\"WHERE sal \>4000\" statistics=nonewhile you can do it by using the expdp something like this
expdp scott/tiger directory=DATA_DD_DIR dumpfile=exp_tabel.dmp logfile=exp_tabel.log tables=emp,dept query=emp:\"WHERE sal > 4000\", dept:\"where deptno > 20\"What version of db you are using? better to use datapump
HTH
Maybe you are looking for
-
On the wifi settings it shows that my ipod is connected to a network, but when I try to open safari it does not open it, because it says its not connected to wifi
-
Cross-domain SWF loading doesn't work
I've been trying to get cross-domain SWF loading to work for a while now, but even though it works from the Flash IDE the loaded SWF is blank when I upload it to a webserver somewhere. And yes, both servers have a crossdomain.xml file in their root f
-
I need my first page to load blank!
Howdy One and All, I need the first page to load blank (just a transparent background would do) but at the moment it's loading the first page of text. I want the text to appear when I hit the home button (named: mc.menuBtn1_btn). I'm having a little
-
Ok this is driving me nuts, I have just purchased PE7, how can i get a created dvd to display in full screen on a 16.9 tv, I appreciate i will still get the small black bands top n bottom,, but what i am getting is a picture in the middle with large
-
I am using iMovie 05 HD ver 5.02 and I can't find the Plug-ins folder to add my 3rd party plugins to. I have done a spotlight search and cant find this folder. Other forums about plugins have said this folder is in the path user/library/iMovie/Plug-i