Updating an Array returned from a User Defined Query
I have the following code in the AddRecordsToSave method of a window. I am
unsure how to save a change I want to make to a field in an Array. I have
tried to use LogAttr (as pointed out in my code by the >>>>>>>>
characters) and am unsure if this is the proper way to update the field
because the change is not reflected in the database after I save. What is
the correct syntax for updating a field in an Array?
I know the syntax must be easy, but am unable to kind any doc on how to do
it.
Thanks in advance for everyone's responses.
Ken Ackimenko
Sentai Software Corporation - World Headquarters
(403)423-3113 Ext. 30
[email protected]
theControlEnt:TextNullable = new();
theControlEnt.SetValue(UserDefaultValues.Control_Ent);
AP_CONTROLQ : AP_CONTROLQuery = new();
AP_CONTROLArray : array of AP_CONTROLClass = new();
theClient: APClient = new();
AP_CONTROLQ.AddAttr(attr=AP_CONTROLQuery.ATTR_CONTROL_ENT);
AP_CONTROLQ.AddAttr(attr=AP_CONTROLQuery.ATTR_INVOICE_NO);
AP_CONTROLQ.AddConstraint(attr = AP_CONTROLQuery.ATTR_CONTROL_ENT,
operation = ConstraintOperation.OP_EQ,
value=UserDefaultValues.CONTROL_ENT);
AP_CONTROLArray = (Array of
AP_CONTROLClass)(theClient.Select(AP_CONTROLQ));
while theFlag.Value = TRUE do
AP_TRANSArray.Clear();
AP_TRANSQ.ClearConstraints(deep=FALSE);
AP_TRANSQ.AddConstraint(attr = AP_TRANSQuery.ATTR_TRANS_NO,
operation = ConstraintOperation.OP_EQ, value=theTransNo);
AP_TRANSArray = (Array of AP_TRANSClass)(theClient.Select(AP_TRANSQ,
ConcurrencyMgr.TR_CONTINUE));
if AP_TRANSArray.Items > 0 then
theTransNo.SetValue(theTransNo.Value + 1);
GetCurrentRecord().Trans_No.SetValue(theTransNo.Value);
else
theFlag.Value = FALSE;
for eachRecord in AP_CONTROLArray do
BusinessClient.LogAttr(source = eachRecord, attr =AP_CONTROLQuery.ATTR_INVOICE_NO);
eachRecord.INVOICE_NO.SetValue( theTransNo.Value + 1);
end for;
//theClient.Update(source = AP_CONTROLArray);
//BusinessClient.LogAttr(AP_CONTROLArray[1],
AP_CONTROLQuery.ATTR_SIMPLE);
//AP_CONTROLArray[1].INVOICE_NO.SetValue(AP_CONTROLArray[1].INVOICE_NO.Value
+ 1);
end if;
end while;
Hi Karthik,
<b> a) To do this compilation - what are the standard XI jar files to be made as a part of build path. </b>
Jar files are already comiled ones , you don't need to do again. just imnport in archives.
<b>
b) How do I reuse this udf in another message mapping - ?</b>
Creatre an object for the class in archived jar in udf and call the respective udf.
hope it is clear.
Thanks,
venu.
Similar Messages
-
PLD report from user defined query
Hello experts,
Is possible to create a new PLD report from a user defined query ?
Thanks in advance.
Best regards
AndreaHi,
It is possible on Query Print Layout Design(QPLD) so Try to create QPLD.
Check this link u can get presentation slide form SAP.
[Query Pld from SAP site]
First you can try to create the Query report with UDF filed.
for example,
SELECT T0.DocNum, T0.DocDate, T0.CardName, T0.CheckSum, T0.U_UDF1, T0.U_UDF2, T0.U_UDF3
FROM OVPM T0 WHERE T0.DocNum>='%0' and T0.DocNum<='%1' ORDER BY T0.DocNum
Steps to Develop a User Report in QPLD:-
If you save your Query in Query Manager. Next you can do this,
->> Choose the Query Manager on Top Menu.
->> Open the Qeury Manager Window.
->> Select the specific Query report. and
->> Click the Create Report button in Bottom on Qeury Manager Window.
->> then, Open the Create User Report Window and Select the User Report(System) in Base Template.
If you Change the QPLD name.
->> Click OK.
->> (or) If your Query Report have parameter. Click OK.
Now your Query report was Created QPLD.
Note: All SELECT statement fields will be Stored and Display in Repetetive Area1. and
Parameter Fields are in Repetetive Area0 so you can Try to Copy & Paste the Field_ID's to Repetetive Area Header (or) Repetetive Area Footer.
Example:
->> Open the QPLD and Goto Field index Window, then
->> Select the Repetetive Area Header & Repetetive Area Footer ncrease the Height on Properties Window.
->> Create the Formula fields in Repetetive Area Header & Repetetive Area Footer.
->> Which Field you want to print in header or footer. Drag the Field ID(in Repetetive Area) Copy & Paste to Formula Field.
Can you see to your Query PLD? do this,
->> Choose the Tools on Top Menu.
->> Click the Queries. -> Query Print Layout...
->> Open the Query Print Layout Window.
->> Click Reports Tab and Double the Template (Requrie QPLD) on QPLD Window.
->> Customize and Save the QPLD.
Can you see your Query PLD Preveiw and Print? do this,
->> Choose the Tools on Top Menu.
->> Click the Queries. -> Query Print Layout...
->> Open the Query Print Layout Window.
->> Select Template in Report Tab on QPLD Window.
->> Click Print Preview on Top menu.
Close this thread if issue solved
Regards,
Madhan. -
How can I call a stateful webservice from a user-defined XPath function?
I'm calling a stateful webservice from a BPEL process using a PartnerLink which implements Custom Header Handler classes to handle the session state, storing the cookie as a property of the PartnerLink.
I'd also like to call this same stateful webservice, in the same session, from a user-defined XPath function enabling me to call this from an XSL Transformation.
Is this in any way possible? Can I access the cookie and attach it to the webservice call made by the user-defined XPath function?Actually, as long as the servlet returns valid javascript, you can indeed "call it" from the client. It will initiate a request and return the result to the browser.
This example uses Perl, but it could be easily modified to go to a servlet instead.
Note that it is only supported in DOM browsers (IE6+/NN6+/etc)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title> Test server-side JS </title>
</head>
<body>
<script type="text/javascript">
function checkIt(variable, value)
var newScript = "cgi-bin/validateJS.cgi?"+variable+"="+value;
var body = document.getElementsByTagName('body').item(0)
var scriptTag = document.getElementById('loadScript');
if(scriptTag) body.removeChild(scriptTag);
script = document.createElement('script');
script.src = newScript;
script.type = 'text/javascript';
script.id = 'loadScript';
body.appendChild(script)
</script>
<p>Test.</p>
<form id="f1" action="">
<input type="text" name="t1" id="t1" onChange="checkIt(this.name, this.value)">
</body>
</html>
validateJS.cgi
#!/opt/x11r6/bin/perl
use CGI qw(:all);
my @valArray = split(/=/,$ENV{QUERY_STRING});
print "Content-type: text/javascript\n\n";
# myPass is the password
$myPass = "foobar";
if ("$valArray[1]" eq "$myPass")
print "alert(\"Success!!\")";
else
print "alert(\"Failure!!\")"; -
Prevent user defined query from being activated with the CopyTo function
Hi, I have a user defined query defined in one of the quantity field (in the grid) in the goods receipt PO window.
The query updates the quantity depending on the number of another line field. The query works great, but I dont want it to be activated when a user clicks the "Copy From" purchase order. When this happens the query gets activated and changes the quantity.
The query is defined to be activated "when exiting altered column", i have not selected the "Refresh Regulary"
Please help!Thank you so much for replying,
this is my query, depending on the column U_Empaque (type of package), I look for the right conversion in the OITM table of the item. Then I use the number from the column U_Cantidad_Empaque (Quantity Of the Type of package) to multiply by the conversion factor that I have defined for the Item in the OITM user fields. The conversion is a standard conversion, so It needs to be modified by the user to set it to the real quantity of the unit of measure (or unit of inventory). The query works great, except for the CopyTo and CopyFrom functions.
Iam using 2007 A patch 45.
México's settings.
SELECT
CASE
WHEN (SELECT 'TRUE' FROM OITM T0 WHERE T0.ITEMCODE = $[$38.1.0] AND T0.U_EMPAQUE1 = $[$38.U_Empaque.0]) = 'True' THEN (SELECT ($[$38.U_Cantidad_Empaque.0]) * T1.U_CONVERSION1 AS 'Respuesta' FROM OITM T1 WHERE T1.ITEMCODE = $[$38.1.0] AND T1.U_EMPAQUE1 = $[$38.U_Empaque.0])
WHEN (SELECT 'TRUE' FROM OITM T0 WHERE T0.ITEMCODE = $[$38.1.0] AND T0.U_EMPAQUE2 = $[$38.U_Empaque.0]) = 'True' THEN (SELECT ($[$38.U_Cantidad_Empaque.0]) * T1.U_CONVERSION2 AS 'Respuesta' FROM OITM T1 WHERE T1.ITEMCODE = $[$38.1.0] AND T1.U_EMPAQUE2 = $[$38.U_Empaque.0])
WHEN (SELECT 'TRUE' FROM OITM T0 WHERE T0.ITEMCODE = $[$38.1.0] AND T0.U_EMPAQUE3 = $[$38.U_Empaque.0]) = 'True' THEN (SELECT ($[$38.U_Cantidad_Empaque.0]) * T1.U_CONVERSION3 AS 'Respuesta' FROM OITM T1 WHERE T1.ITEMCODE = $[$38.1.0] AND T1.U_EMPAQUE3 = $[$38.U_Empaque.0])
WHEN (SELECT 'TRUE' FROM OITM T0 WHERE T0.ITEMCODE = $[$38.1.0] AND T0.U_EMPAQUE4 = $[$38.U_Empaque.0]) = 'True' THEN (SELECT ($[$38.U_Cantidad_Empaque.0]) * T1.U_CONVERSION4 AS 'Respuesta' FROM OITM T1 WHERE T1.ITEMCODE = $[$38.1.0] AND T1.U_EMPAQUE4 = $[$38.U_Empaque.0])
END -
Dear All Master Brains,
It is possible to hide our user defined query in Query Manager, apart from our user authorization.
I am waiting for your ..
Regards,
Team work never fails.Hi,
Only by authorizations you can hide the user queries.
Alternate way, If you have created those query for report purpose then you convert that query into QPLD, So that users cannot view the query you developed instead they can view the report alone.
I hope this could help you.
Regards
Raja.S -
User defined query parameter in query generator
Hi All,
i am using query generator in SAP to print some records of user defined query. precisely, the details about sales employees are to be printed. now the columns which exist in the database (ie. sales employee code, name, cardcode) etc can be given as a parameter like [%0] and [%1]. but some user defined parameter such as sales commission does not show as such parameter. i want one column as
select T0.doctotal, (T0.doctotal * [%0]) / 100 as brokerage from OINV T0
--where [%0] is some commission percentage that the user will give while running this query
This query gives correct results but it gives the parameter name as 'doctotal' while showing. any idea as to how to handle it properly in SAP?
thanks in advance,
Binita
Edited by: Binita Joshi on Sep 8, 2009 3:35 PMI sometimes defined a UDT only for getting the appropriate parameter entering window. The table has no data; I used it only for its field names in this window.
(The parameter request can be placed inside a comment and the entered value is used setting an SQL variable like this:
declare @d datetime
/*select t.createdate from ordr t where t.createdate=[%0]*/
set @d=[%0]
This SQL variable can be used later in the real query.) -
User defined query parameter in QLD
Hi All,
i am using query generator in SAP to print some records of user defined query. precisely, the details about sales employees are to be printed. now the columns which exist in the database (ie. sales employee code, name, cardcode) etc can be given as a parameter like %0 and %1. but some user defined parameter such as sales commission does not show as such parameter. i want one column as
select T0.doctotal, (T0.doctotal * [%0]) / 100 as brokerage from OINV T0
--where [%0] is some commission percentage that the user will give while running this query
This query gives correct results but it gives the parameter name as 'doctotal' while showing. also, when I join 4-5 tables and union, it totally misinterprets the paramater. any idea as to how to handle it properly in SAP?
thanks in advance,
BinitaHi
I know it list many value but u can try by this way....
declare @a numeric(3)
set @a = (select top 100 docnum from oinv T1 where T1.[docnum]= [%0])
select T0.doctotal, (T0.doctotal * @a) / 100 as brokerage from OINV T0
Thanks
Kevin -
User defined Query in Print Layout
Is it possible to print output of a user defined query in a Print Layout. For example: in Quotation
KentishThanks for your input.
But its not related to Query Print Layout. I wanted to print a query result in a Sales Quotation so that when you print the Sales Quotation, you get the result of the Query on the Sales Quotation
Thanks
Kentish -
Updating content on return from the portlet edit URI
I have written a portlet with a pageflow content URI and a pageflow edit URI. The
content URI pageflow displays some formatted data obtained from a combination
of portlet preferences and database records. The edit URI pageflow allows the
user to add records to the display, delete records from the display, or re-format
the displayed records. The edit URI pageflow is executed by clicking the “edit”
button on the portlet titlebar.
The problem is when I click the “Leave Edit” button on the portlet titlebar and
return to the content page, the display is not updated to show the additions,
deletions, or re-formats performed by the user in the edit URI pageflow. The user
must log out and log back in to see the changes.
How can I cause the portlet to re-execute the begin action on it’s content URI
pageflow when returning from the edit URI pageflow so the user doesn’t need to
log out and log back in?Heay.....this worked for me.
I am able to change the mode programatically from edit to show.
HttpPortletRendererUtil.handleEditAction(portletRenderRequest,"OK");
I removed Apply , OK and Cancel buttons and applied my own Submit and Back button in Personalize mode and then change the mode to show on click of Back button using the above mentioned statement.
Thanks
~Neeraj Sidhaye
Try_Catch_Finally @ Y !
ExtremePortal @ Gmail Dot Com -
How to fill the records from a User Define Table to PO item Grid
Hi To all,
I need to fill data from User Define table records into Purchase Order Item Grid.
I created an UDF Filed in PO - Header Part - "PRS"(Filed Name)
By using Formatted Search in itemcode column, i called a query,
"Select itemcode, qty from (@user define tablename) where PRS = $http://OPOR.U_PRS"
For eg:
Output from querry
ItemCode Qty
ABC 1
DEF 2
DFG 7
SDGD 9
By using formatted search it is filling only first data in to itemcode column in PO Grid.
Please help, how can i fill ALL the data in to my PO Grid?
Thanks in Advance
SAGARThe easisest way is to create datasource and the result bind to grid.
Datasource:
oDBDataSource = oForm.DataSources.DBDataSources.Add("@usertablename")
Dim xoConditions As SAPbouiCOM.Conditions
Dim xoCondition As SAPbouiCOM.Condition
xoConditions = New SAPbouiCOM.Conditions
xoCondition = xoConditions.Add
xoCondition.BracketOpenNum = 1
xoCondition.Alias = "u_zn"
xoCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
xoCondition.CondVal = "cond"
xoCondition.BracketCloseNum = 1
oDBDataSource.Query(xoConditions)
binding (example for matrix, in grid is simillar)
oMatrix.Clear()
Dim cols As SAPbouiCOM.Columns
Dim column As SAPbouiCOM.Column
cols = oMatrix.Columns
column = cols.Item("colX")
column.DataBind.SetBound(True, "@usertable", "u_x")
oMatrix.LoadFromDataSource()
hoep it helps
Petr -
How to add a DataBase Field in PLD from a User Defined Table
Hi All,
Please tell me how should i add a database field in PLD from User Defined Field...
The DropDown for tables in the Property window does not shows the User Define tables...How should i see them...
Thanx in Advance
ManishIn PLD choose object Database. Then press Alt + table combobox, this will show the UDT. Then choose the column.
-
Prevented from creating User Defined Metric
I am using Oracle Enterprise Manager 10g Database Control.
When I try to create a User Defined Metric I get a screen that says:
Information:
You cannot create a User Defined Metric because host <my_host> is currently unavailable. Try again later when it becomes available.
I cannot find any information on how to resolve this.In case anyone else is looking for this answer - at least what worked for us.
It seems Oracle is parsing the "select TO_CHAR(SID,'99999'), other_column from ...." by comma instead of by what the output is coming back with. So in this case it thinks the output has three columns because of the two commas in the select clause. So we just went with an inline view similar to select a.sid, a.other_column from (select TO_CHAR(SID,'99999'), other_column from .... ) a and that worked for us. Assuming its a version thing since the non-inline view worked for someone else. We're on 11.1 of the oms. -
Calling a std user exit from a user defined user exit
hi
I have a standard User Exit. I want to call it from a User Exit created by me something like zaaabbbb.
Can you please tell me the procedure how to do it ?Hi,
If the user exit is a Z include in a function module then you can call the function module like any other function module passing the required parameters. For example CALL CUSTOMER-FUNCTION '002' in transaction VA01 corresponds to function module EXIT_SAPMV45A_002. You can call this function module like you do any other function module.
CALL FUNCTION 'EXIT_SAPMV45A_002'
EXPORTING
i_tvak =
i_tvta =
i_vkgrp =
i_vkbur =
* IMPORTING
* E_KUNNR =
If the user exit is a subroutine in an include in SAP name space (For example subroutine userexit_delete_document in include mv45afzz), then find out the main program in which the include is included (for example mv45afzz is included in program sapmv45a). Once you have done that you can using the following statement to call the subroutine.
PERFORM <subroutine name> IN PROGRAM <program name>.
For Examaple
PERFORM userexit_delete_document IN PROGRAM sapmv45a.
Please make sure that you use the main program name (In our example sapmv45a) and not the include name (in our example mv45afzz). -
Alert based on user defined query
Hi
I have defined user defined field U_Jobnumber.I need to stop /inform user if user is trying to enter the same u_Jonbnumber again .This is being done at sales order (header level)
Can you please help me to provide solution
(Points will be awarded based on solution or advice )
Thank you
BishalHi Bishal,
Rather than using an alert, you could put validation code in the SBO_SP_TransactionNotification stored procedure to check for the same job number before the document is added. This is a permitted solution as SAP allow users to add their own sql code to this proc (provided it's not inserting or updating data in SBO system tables).
To set up this solution (on a test system):
1) Open SQL Studio Management
2) In the Object Explorer expand the company database, expand Programmability and Stored Procedures
3) Right-click the SBO_SP_TransactionNotification stored procedure and choose Modify. This will create an update script in the main window.
4) Look for the following section in the script:
-- ADD YOUR CODE HERE
5) Underneath the above section, paste the following code:
if @OBJECT_TYPE = '17' and @TRANSACTION_TYPE in ('U', 'A')
if exists(select DocEntry from ORDR where DocEntry <> cast(@LIST_OF_COLS_VAL_TAB_DEL as int)
and U_Jobnumber is not null and U_Jobnumber <> ''
and U_Jobnumber = (select U_Jobnumber from ORDR where DocEntry = cast(@LIST_OF_COLS_VAL_TAB_DEL as int)) )
begin
set @ERROR = '9999' -- Set your own error code here
set @ERROR_MESSAGE = 'The Job Number entered has already been used on a previous sales order.'
end
6) Click on Execute and you should get a message stating that the update was successful
7) Test adding a new sales order
The above script will raise an error when the user clicks on Add if a job number has been specified on the sales order and that number has already been used. It will not check if a job number has not been specified
Kind Regards,
Owen -
How do u create a datatable from PLSQL Associative Arrays returned from SP
Using C# 4.0 ODP.NET 11g, vs2010 on Windows XP.
Have a procedure that takes two input values and returns 35 PL\SQL Associative Arrays (pl/sql tables). I am currently able to call the proc and have it returned the values. i end up with 35 arrays each 35 elements in length.
I want to create a datatable from them but am at a lost on how to do so.
This what i have
Oracle.DataAccess.Client.OracleCommand oCommand = new Oracle.DataAccess.Client.OracleCommand();
oCommand.CommandText = ProcName;
oCommand.CommandType = CommandType.StoredProcedure;
//Input Parameters
OracleParameter param1 = oCommand.Parameters.Add("p_orderid",OracleDbType.Int32);
param1.Direction = ParameterDirection.Input;
param1.Value = OrderID;
OracleParameter param2 = oCommand.Parameters.Add("p_testinstanceid", OracleDbType.Int32);
param2.Direction = ParameterDirection.Input;
param2.Value = TestInstanceID;
//Output Parameters
OracleParameter param3 = oCommand.Parameters.Add("program_id", OracleDbType.Int32);
param3.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
param3.Direction = ParameterDirection.Output;
param3.Size = 50;
OracleParameter param4 = oCommand.Parameters.Add("normyear", OracleDbType.Varchar2);
param4.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
param4.Direction = ParameterDirection.Output;
param4.Size = 50;
param4.ArrayBindSize = new int[50];
// set the bind size value for each element
for (int i = 0; i < 50; i++)
param4.ArrayBindSize[i] = 10;
...33 more output parameters all PLSQLAssociativeArray type
oCommand.ExecuteNonQuery();
OracleDataAdapter da = new OracleDataAdapter(oCommand);
//Fill the DataTable
da.Fill(dt);
The datatable is empty. What am i doing wrong? Or this there a better way to get the output values to end up in a datatable. Note that when i examine the parameters in oCommand i see that they all the the right out values.I have multiple where conditions which needs the same subqueryThat is where the Subquery Factoring Clause comes in handy, because then
»Oracle Database optimizes the query by treating the query name as either an inline view or as a temporary table«
with temp as (
subquery
select 1
from table1
where col1 in (select * from temp)
and col2 in (select * from temp)
and col3 in (select * from temp)
Maybe you are looking for
-
Petty Cash split transaction take different posting keys
Dear Experts I set in configuration for FBCJ the Special G/L transaction key 39 credit and i am getting the same when I post single line item transaction when i do cash receipt. When I am posting cash receipt transaction through FBCJ ( petty cash ) s
-
Simon, why do I get an OrdImage.setProperties() exception ORA-22288
Hi Simon; I've debugged a problem with the ImageExample to the point where I'm convinced one cannot call setProperties indirectly as the example code shows. SetProperties can only be called during a load - for example imgObj.LoadFromFile The example
-
Problems downloading Photoshop 13 onto Mac, won't allow redemption code to ne typed
Please help. I have purchased Photoshop elements and premier elements 13 for my Mac. After downloading eventually (after a few failed attempts due to bad broadband signal) My Mac is asking of my redemption code ( long 6 box code on back of download c
-
How to use a event structure in a subVI
I am trying to use an event structure inside a subVI. The subVI has an array builder that builds arrays, and the event structure is used so that when the program is running, it allows you to change the elements of the array. It works, but when I im
-
Hacking of e-mail account (yahoo and gmail) while both are configured to my iPhone?
Yesterday the 8th of October, 2012 at about 2.45 pm IST (Indian Standard Time) both my e-mail accounts which are configured to the iPhone were hacked. The hacker not only sent some ridiculous mail from the account asking my contacts to send money thr