Passing a table as input to a query
Hi Experts,
I am new to Visual Composer so this might be a fairly simple question.
My query takes in a input parameter (CUSTOMER ID) and generates an output table. I can easily display this output table in Visual Composer. However my problem is that the query takes in a one CUSTOMER ID, and not a table of CUSTOMER IDs. What I need to do is pass a table of CUSTOMER IDs to the query and iteratively run the Query for each CUSTOMER ID. The output table from the query would be a cumulative output table of all the data from each output table associated with each CUSTOMER ID.
I am not sure how I can do this in Visual Composer.
Thanks!
Osman
Hi Osman,
you can pass a whole table into your query. You have to flip port of the table, which is used as input (the table with your customer IDs). In your query (I think it's an ABAP function module) you can bring your result together to an cumulative output table as you need it. Hope this helps.
Also check the Wiki entries:
[ Multiple tables into one dataservice|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/multipletablesintoonedataservice]
[ Combining two tables, BAPIs or queries|https://wiki.sdn.sap.com/wiki/display/VC/Combiningtwotables%2CBAPIsor+queries]
Best Regards,
Marcel
Similar Messages
-
RFC function : passing a table as input
Hi,
I have no trouble passing input values to an RFC model in web dynpro, but I have difficulties to pass an input table.
By default, the input "it_table" node of the model I use, is defined like this : card 0..n, selec 0..1 Singleton True.
Do I have to change something?
Then, what is the correct code for creating the node (because card is 0..n) and then add items (for each line of my table)?
For the moment, I get this error : value node is created without a reference.
ThanksI finally managed to get it work.
Here is the COMPLETE solution.
Note that in my solution, it was easier for me to put data in a value Node FIRST and THEN to copy it to the model Node.
--> In the RFC function, declare the table "TYPE TLINE_T", and not "LIKE TLINE".
GestionAvisComp - Context
- Z2_I_Gestion_Simplifiee_Avis_Input (Model Node, card 0..1, sel 0..1, singleton true)
+ It_Ajout_Texte_Avis (card 0..n, sel 0..1, singleton true) Class Tline
- Tdformat
- Tdline
- Qmart
- It_Texte_Avis (Value node, card 0..n, sel 0..1, singleton true)
public void wdDoInit()
//@@begin wdDoInit()
//$$begin Service Controller(1353609186)
Z2_I_Gestion_Simplifiee_Avis_Input input = new Z2_I_Gestion_Simplifiee_Avis_Input();
wdContext.nodeZ2_I_Gestion_Simplifiee_Avis_Input().bind(input);
//$$end
//@@end
WhateverView
public void onActionSauvegarderAvis(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
// Add two elements to the value node
IIt_Texte_Avis_InputElement firstTexte_AvisEl = wdContext.nodeIt_Texte_Avis_Input().createIt_Texte_Avis_InputElement();
IIt_Texte_Avis_InputElement secondTexte_AvisEl = wdContext.nodeIt_Texte_Avis_Input().createIt_Texte_Avis_InputElement();
firstTexte_AvisEl.setTdformat("/*");
firstTexte_AvisEl.setTdline("Line 1");
secondTexte_AvisEl.setTdformat("/*");
secondTexte_AvisEl.setTdline("Line 2");
wdContext.nodeIt_Texte_Avis_Input().addElement(firstTexte_AvisEl);
wdContext.nodeIt_Texte_Avis_Input().addElement(secondTexte_AvisEl);
// Moving the elements of the value node into the model node
int size = wdContext.nodeIt_Texte_Avis_Input().size();
for (int i = 0; i < size; i++) {
wdContext.nodeIt_Texte_Avis_Input().setLeadSelection(i);
Tline x = new Tline();
x.setTdformat(wdContext.currentIt_Texte_Avis_InputElement().getTdformat());
x.setTdline(wdContext.currentIt_Texte_Avis_InputElement().getTdline());
wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().modelObject().addIt_Ajout_Texte_Avis(x);
wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().setQmart("ZE");
// Execute the RFC model
// Clear the Value Node
while ( wdContext.nodeIt_Texte_Avis_Input().size() > 0 )
wdContext.nodeIt_Texte_Avis_Input().removeElement(
wdContext.nodeIt_Texte_Avis_Input().getElementAt(0)
// Clear the Model Node
if (wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().modelObject().getIt_Ajout_Texte_Avis() != null) {
while(wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().modelObject().getIt_Ajout_Texte_Avis().size() > 0)
wdContext.currentZ2_I_Gestion_Simplifiee_Avis_InputElement().modelObject().getIt_Ajout_Texte_Avis().remove(0)
Edited by: Emanuel Champagne on Jan 17, 2008 9:32 PM
Edited by: Emanuel Champagne on Jan 18, 2008 10:20 PM -
How to pass Dynamic Table(s) to FM
Hello All i hv an requirement in which i need to process a block of code recursively. right now i am trying to do the same with Subroutine but its hard i know. I have an option to use FM instead but i am not sure if we can pass dynamic tables to FM, so is there anybody who had solution for the same. otherwise i can use it using TOP include to declare dynamic table in comon arae as im calling it from another FM(RFC) but i dont want to use that as it will consume more memory.
So i have 2 question
1. should i use FM instead of subroutine for recursive operation if yes how can know if i reached the maximum alloted size of memory for a program. is there any FM which can tell me about the memory used or somethign like that so that i can avoid any ABAP dump.
2.how can i pass dynamic tables as input to parameters.
Note : i allready seen https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f50dcd4e-0501-0010-3596-b686a7b51492Hello Mani
Perhaps the sample report ZUS_SDN_TABLE_READ_VIA_RFC_XML in thread
How to return back a structure of dynamic tables in a Function Module
might be a useful approach for you.
Regards
Uwe -
Passing different tables as a input parameter
HI,
I've 5 tables TAB1, TAB2, TAB3, TAB4, TAB5
and I created 5 store procedures to generate 5 file.txt with utl_file utility.
Now I'd like to know if possible create just one stored procedure (or package) with just one cursor
that passing different tables as a input parameter.
Have you any idea?
Thanks in advance!Here you go...
SQL> create table tab1 as select 1 as x, 'A' as y from dual union
2 select 2, 'B' from dual union
3 select 3, 'C' from dual;
Table created.
SQL>
SQL> create table tab2 as select 4 as x, 'D' as y from dual union
2 select 5, 'E' from dual union
3 select 6, 'F' from dual;
Table created.
SQL>
SQL> CREATE OR REPLACE PROCEDURE output_tbl (p_table_name IN VARCHAR2) IS
2 v_cur SYS_REFCURSOR;
3 x NUMBER;
4 y VARCHAR2(10);
5 BEGIN
6 OPEN v_cur FOR 'SELECT x, y FROM '||p_table_name||' ORDER BY x';
7 LOOP
8 FETCH v_cur INTO x, y;
9 EXIT WHEN v_cur%NOTFOUND;
10 -- Here you would output to your file, but for ease of
11 -- demonstration I'll just dbms_output the data
12 DBMS_OUTPUT.PUT_LINE(x||' : '||y);
13 END LOOP;
14 END;
15 /
Procedure created.
SQL> exec output_tbl('TAB1');
1 : A
2 : B
3 : C
PL/SQL procedure successfully completed.
SQL> exec output_tbl('TAB2');
4 : D
5 : E
6 : F
PL/SQL procedure successfully completed.
SQL> -
Passing request table to Jco function
Hello Experts,
We have one requirement where we need to pass the table data from the BLS to SAP Jco Function Module call. For example we are reading the material numbers from the oracle database and then we need to pass these material numbers to SAP Function Module as a table to read the further details from SAP for the given material numbers.
We wrote a custom function module in SAP which accepts the material number as table. Is it possible to pass the table request parameter to Function Module? If possible how can we do this? I tried to pass the XML document to Function Module table, but no luck.
Thanks
MohanMohan,
in the BLT, configure the JCO action to use you custom function. After pressing enter, MII reads the xml structure of the function (if the connection MII to SAP is working). In the further processing of the BLT, you can fill the RFC table which you can see in the link editor using your query results and the link editor types "AppendXML" or "AppendAfter".
The following thread might help: [RFC call with multiple input|http://forums.sdn.sap.com/click.jspa?searchID=34070350&messageID=8134561].
Michael -
How to override security for table access when using SAP Query?
We have a number of infosets which use table join between PA0001 and CATSDB table. To execute a query based on such a query you would need access to table auth group PA through S_TABU_DIS. This was earlier not a problem as SAP query was earlier used by support staff and not end users. We do not want to give S_TABU_DIS with to end users as this amounts to givin them access to all PA tables.
The generated code for the query checks for the condition
"%rtmode-no_authchk = space"
before going for the authorization check.
Thus, ideally the authorization check for an InfoSet can be skipped if we can pass X for this variable from the InfoSet definition. Is there a way to do this?
Would appreciste any inputs to help suppress the authorization check at this point. Thanks.....>
Julius Bussche wrote:
> Perhaps you could replace it with a class of your own (transaction SE24)?
>
> I have not tried to do this; it was just a thought.
>
> Kind regards,
> Julius
unfortunately this does not work. SAP saw fit to 'hard-code' the implementation of the interface in RSAQEXCE:
(only parts of that abap displayed here).
170 data: iref type ref to if_query_tab_access_authority.
1107 * FORM AUTHORITY_BEGIN
1112 form authority_begin using p_auth_classname type AQS_CLSNA.
1119 perform authority_init using p_auth_classname.
1120 call method iref->access_authority_begin.
well for my part (searching a solution for a query on LTAK, wanting L_LGNUM as an object) i'm out of ideas. i shall have to modify SAP-standard and disable the class and do my own coding in the info-set. no other possibility - i cannot allow S_TABU_DIS for group LA and even if i did, what help would it be - i would have to allow that to all companies in that client having WM - and that would be literally all - i need LGNUM here! -
How to pass a date parameter from report builder query designer to oracle database
i'm using report builder 3.0 connected to oracle database. i'm trying to pass a date parameter in the query with no success, i don't
know the exact syntax. I've tried :
SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEAR IN(:UW_YEAR) AND (LOSS_DATE) >To_Date('01/01/2014','mm/dd/yyyy')
it worked perfectly.
However if i try to put a date parameter "From" instead of 01/01/2014 it will not work, a Define Query Parameter popup window appear and error occurred after i fill
the values (usually i shouldnt get this popup i should enter the value when i run the report)
SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEAR IN(:UW_YEAR) AND (LOSS_DATE) >To_Date(:From,'mm/dd/yyyy')
appreciate your assistanceHi Gorgo,
According to your description, you have problem when in passing a parameter for running a Oracle Query. Right?
Based on my knowledge, it use "&" as synax for parameter in Oracle, like we use "@" in SQL Server. In this scenario, maybe you can try '01/01/2014' when inputing in "From". We are not sure if there's any limitation for To_Date()
function. For your self-testing, you can try the query in sqlplus/sql delveloper. Since your issue is related to Oracle query, we suggest you post this thread onto Oracle forum.
Best Regards,
Simon Hou -
How to call a BAPI when there are structure tables as Input.
Environment: Data Services 3.1 SAP ECC 6.
I can run simple BAPI's where I just populate the Input Parameters.
My question is around more complex BAPI's.
I created a data flow that looks like:
Row Generation > Query > Unnest Query > Template table.
Inside of the query I created a new Function and called the BAPI_PROJECT_MAINTAIN.
This BAPI requires adding data as part of the Structure Tables in the BAPI. I see these tables in the SAP Data Store and I also see a single input field in the Data Services Function Wizard that desribes the Structure.
My question is - how do I populate the fields when it comes from a Structure Table in the BAPI?A table parameter is a schema, so you need an upfront query where you create that schema with the nested data. The schema is then mapped to the table parameter, the columns of the schema have to match by name.
https://wiki.sdn.sap.com:443/wiki/display/BOBJ/Calling+RFCs-BAPIs -
Dynamic table name in native sql query
Can i pass a dynamic table name in this query ---
EXEC SQL PERFORMING APPEND_MTO.
SELECT
LTOG_QUANTITY_TYPE,
FCONO,
WBSELEMENT,
PROJECT
INTO :IMTO
FROM RWORKS.MTO_ISO_V2
WHERE LTOD_DATE > TO_DATE(:MAXD,'YYYYMMDDHH24MISS')
ENDEXEC.
How can i pass this table name RWORKS.MTO_ISO_V2 dynamically in the query
Edited by: Madhukar Shetty on Nov 26, 2009 2:40 PMCan i pass a dynamic table name in this query ---
EXEC SQL PERFORMING APPEND_MTO.
SELECT
LTOG_QUANTITY_TYPE,
FCONO,
WBSELEMENT,
PROJECT
INTO :IMTO
FROM RWORKS.MTO_ISO_V2
WHERE LTOD_DATE > TO_DATE(:MAXD,'YYYYMMDDHH24MISS')
ENDEXEC.
How can i pass this table name RWORKS.MTO_ISO_V2 dynamically in the query
Edited by: Madhukar Shetty on Nov 26, 2009 2:40 PM -
How can I pass/add these results in my Main query's column
Hello Experts
I’m working on a subquery. My subquery works fine and give the results what I need. But how can I pass/add these results in my Main query’s column ‘MGRNAME’. Here is my query
select pc.c_id "Project ID",
cn.c_id "Client ID", cn.c_last "Last Name", cn.c_first "First Name",
pj.mgr_id "Manager ID", pj.project_name "Project", MGRNAME
from project_consultant pc
join consultant cn
on (pc.c_id = cn.c_id)
join project pj
on (pc.p_id = pj.p_id)
where lower(cn.c_last) = 'myers'
and MGRNAME in
( select concat (substr(c_last,1,20),
substr(c_first,1,20))
as MGRNAME from consultant
where c_id in (102, 103)
When I run the above query I got error.
Thanks a lot on advanceI’ve join three tables to get the information about I need. I got everything working expert one part. The subquery
( select concat (substr(c_last,1,20),
substr(c_first,1,20))
as MGRNAME from consultant
where c_id in (102, 103)
Gives me the names of employees I need. The output comes 2 names. I’m trying to add these 2 names in my main query and show the results but I got the following error
Error at Command Line:11 Column:4
Error report:
SQL Error: ORA-00904: "MGRNAME": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
I can understand there is something wrong with MGRNAME field but not sure what it is. Can somebody point it out?
Once again this is main query with single sub query
select pc.c_id "Project ID",
cn.c_id "Client ID", cn.c_last "Last Name", cn.c_first "First Name",
pj.mgr_id "Manager ID", pj.project_name "Project",
MGRNAME
from project_consultant pc
join consultant cn
on (pc.c_id = cn.c_id)
join project pj
on (pc.p_id = pj.p_id)
where lower(cn.c_last) = 'myers'
and MGRNAME in
( select concat (substr(c_last,1,20),
substr(c_first,1,20))
as MGRNAME from consultant
where c_id in (102, 103)
Hope it helps -
Output of One Query is input to other Query??
Hi All,
How to make output of one query as input to other Query and what are the points to be takeb care of to do it?
regards,
murali.
Message was edited by: MuraliHallo
You got a second query where you also have 0date. Based on the selection on the second query, you get some value for 0date. this values are then passed in background to the first query which will show you the output based on the input date of the first query. You can also have othe variable in the query.
http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
I hope everything is fine.
Mike -
How to pass a table as parameter on a stored procedure
Hello all,
I want to pass the name of a table as parameter into a stored procedure, that will be used for cursors etc.
But when i pass the parameter and i compile the S.P. it give me error (error: table not existing...)
Any Help?
Thanks in advance, MarcoMarco wrote:
As i've written above, i'm using stored procedures like 'batch' programs which will be executed with oracle scheduler (passing to s.p. the name of the 'input' tables)
These input tables are 'external' tables which have got the same structure; for example i've got TABLEX_001, TABLEX_002, XXTAB etc. with the same structure.
This is the the reason... what do you think?An external table definition can reference multiple files via the LOCATION definition or you can user "ALTER TABLE" to alter the location and change the file that the external table points to.
Thus you only need one static External Table and use an alter table (via execute immediate) to change the file location it points to, or if you want all the data together, just specify all the files in the location.
That would be clean design, using one fixed table, without the need to pass any table names, just dynamically altering the file names if necessary at run time. -
Pass a table from my webdynpro JAVA application to an RFC in R/3
Hi All,
I need to Pass a table from my webdynpro JAVA application to an RFC in R/3. How can I do that?
Regards
SarathHi,
Please have a look at this thread,
Pass Table as Input to Adaptive RFC
Regards,
Saravanan K -
Passing Internal tables to Workflow
Hello all,
I learning workflow and have a small doubt related to passing internal table as parameter to workflow when it is triggered by a report program explicitely.
I wrote a prog to upload data from flat file into internal table and by passing this ITAB to the workflow for futher processing. <b>Actually i succeeded in this with only one field in my flat file (lfa1-lifnr).</b>
<b>what if my flat file contains more than one field? (i.e., lifnr, name1, city, county) how should i declare the parameters for my EVENT (triggering event) and same with my container declaration?</b>
Any inputs in this regards are welcome.
Thank you in advance,
Lakshmi NarayanaHi Lakshmi,
Create Workflow container
swc_container lt_container.
swc_create_container lt_container.
Fill internal table with data
The container type and the internal table type should be same, U can use a structure to define both.
Declare a structure with all the fields.
Define a conatiner of same type of structure in worklow and set it in <b>wait for event</b> setp.
swc_set_table lt_container '<container_name>' lit_int_data.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = lc_objtyp
objkey = lv_objkey
event = lc_event
IMPORTING
event_id = lv_eventid
TABLES
event_container = lt_container
EXCEPTIONS
objtype_not_found = 1
OTHERS = 2.
Rgds,
Prakash
Message was edited by: Prakashsingh Mehra -
Hello fellows, (using LabVIEW 8.5 full dev with WinXP)
I'm dealing with calling DLLs functions. So, I have the DLL code to build for passing from LabVIEW a table of char like this:
char table [ ] = {0x04, 0x0F, 0x04, 0x00,0x00,0xFA,0x00}
So I pass the data by creating a table of char in labview and select "Adapt to type" when passing this table in the calling DLL function node.
Then I wrote the data to a Pipe to be interpreted by the other program.
here is the c program:
extern "C" _declspec (dllexport) void test_Write_Event(HANDLE HandlePipe, char InputArray[255] ,char OutputArray[255],int size)
BOOL fileRead;
DWORD bytesWrite;
int i;
char *pEvent = "";
/* Copy the input array */
for(i = 0; i < size; i++)
pEvent[i] = InputArray[i];
OutputArray = InputArray;
//Write to pipe
fileRead = WriteFile(HandlePipe,
pEvent,
(size),
&bytesWrite, NULL);
I don't know if my data type adaptation is right ?? some help !
PS: the vi to test this DLL function attached
Attachments:
TestFunction.vi 17 KBSadly, in the example there is no return value to TestStand.
However, I did manage to return the pointer of the char array to TestStand:
int __declspec( dllexport ) bounceString2(char* argument)
void *pointer;
int i;
argument = "Hello";
pointer = argument;
i = (int) pointer;
return i;
So, right now I have to find out how to retrieve the char array from the pointer...
Jeroen
PS, I will look at the CVI code, and let you know about my process
Maybe you are looking for
-
Mountain Lion free upgrade program is not working
I have tried three times today to apply for the Mountain Lion Free upgrade program (purchased my 13"Macbook Air on July 9) and the application form constantly hangs or crashes. Anyone else expeirencing problems? JW
-
Howa can i change the questions on app store i fogot it
hello, anyone can help me with this i'm trying to change my question on itunes i forgot the answers, when i did it they say email sen " Check your inbox for an email with instructions on how to reset your security information" i check out my email th
-
Has anyone used ONLY an iSCSI volume with XSAN?
I'm trying to get an iSCSI volume available as a LUN for XSAN. It seems that without FC hardware attached to a machine, I can't even start the service... What is your experience?
-
Inputs Required - XML formation
Hi, We have a specific requirement where we have to generate an XML that should not contain any namespace/xsd reference but contains DTD reference. This XML is sent to our partners through automated workflow. The partner only understands DTDs and wil
-
Download Assistant and password 12
I just wanna shoot myself. When I was registrating an Adobe ID I used my favorite password and its longer than 12 characters. But! When I have tried to 'Sign in' with Download Assistant... Guess what? You're right: "Your password must be 6 and 12 cha