UDF Requiremnt
Hi Experts
Please help me in this mapping through writing a UDF
My scenario is iDOC to File
we have to count the occurance of the Segment and than map the fields.
i have one iDOC WPDBBY01 and it has segment named E1WPBB03 which initself has one more segment E1WPBB04 in which we have field MAT_NR
This segment E1WPBB03 can repeat and as per the occurance i have to map the fields accordingly
Something of this sort:
(Target FIeld) Alt1_QTY --
Take the first occurrence value of MAT_QUAN from the iDOC segment E1WPBB04
(Target Field) Alt2_QTY --
if MAT_NR from E1WPBB02 is same as MAT_NR from E1WPBB04, then take the value is "0",
elseif E1WPBB03 has second occurrence value is MAT_QUAN from the second occurance of the segment E1WPBB04
else value is "1"
(Target Field) ALt3_QTY --
if E1WPBB03 has third occurrence value is MAT_QUAN from tjhe 3rd occured segment
elseif E1WPBB03 has two occurences then value is "1",
else value is "0"
(Target Field) Alt4_QTy --
if E1WPBB03 has fourth occurrence value is MAT_QUAN from the 4th occured segment elseif E1WPBB03 has three occurences then value is "1",
else value is "0"
So on till 8th occurance...and on the
ninth
(Target Field) ALT9_QTY
if E1WPBB03 has Ninth occurrence value is "1"
else value is "0"
Can you please help me in writing a UDF for the same in which i can count the number of occurance of the segment and can map the field acoordingly
points will surely be rewarded.
Thanks
HI aquarian sharma
Now I am bit clear with your exact requirment as compare to your previous post.
Please see if the below code will be useful for you
here Input to UDF will be
MAT_QUAN,
(I hope from previous posts you are aware to create and use UDFs)
(Target FIeld) Alt1_QTY --
Take the first occurrence value of MAT_QUAN from the iDOC segment E1WPBB04
---> Just map MAT_QUAN ---> Alt1_QTY
Keep the occurance of Alt1_QTY as 1.
If its of multiple occurance then create UDf UDFAlt1_QTYand
write code as
result.addValue(MAT_QUAN [0]);
MAT_QUAN ---> UDFAlt1_QTY ---> Alt1_QTY
For further things can you please send me the exact whole structure of you IDOC so accordingly I could creaet UDF for you.
If you have imported IDOC in XI, then just open it and you will get one XSD tab, you could export it and send as and attachement to my mail id.
[email protected]
If possible could also share that whole structure details in forum, then many guyes could analyse it.
Thanks
Swarup
Similar Messages
-
UDF for replacing special or junk characters
Hi
Is there any stanard function for replacing any junk characters with zero? If not, I needed UDF for fulfilling this requirement.
My requirment is .... Am sending some files to r/3 using XI. In the source(txt file) some time some fields have some junk characters. I must make it to zero, the field which has junk. How can I acheive it? is there any UDF using which I can fulfill my requiremnt.
Thanks.Hi,
Use this UDF
Here a is the input value.
String b = "";
b = a.replaceAll(",", "0");
b = a.replaceAll("@", "0");
Like all the special characters you can take and replace with zero.
return b;
Or
Use the regular expression to check whether special characters occurs in the string then replace with zero
http://www.j2ee.me/developer/technicalArticles/releases/1.4regex/
Regards
Ramesh. -
Udf Data is not being displayed in the report
Hi all,
i have designed one report in which i am displaying some udf fields along with other system fields.
i have not used any selection criteria.
when i run report it doesn't display udf data of some random rows in the report even if data is peresent in that udf field.
If i open sales order and press 'Shift-F2' and update the document and now if i run report then i get that udf value in the report.
why this happening. data is there in the udf field only its not displayed in the report with out updating the that udf.
pls suggest some solution.
regsrds,
Chetan.Hi Ashish,
I ran the "ZPS/!ZPS" in RSRT where ZPS is the infoset name. In Dev, it displayed the values. In QA, it displayed the below messages:
ECharacteristic 0TCAKYFNM does not exist. Check authorizations
WThere are calculated elements. These results are bracketed [ ]
and below that, it displayed the values for Number of records. But, it has not displayed the values for the other figures.
Does this has any impact in QA.
Thanks & Regards,
AVN Rao. -
Error while setting a value into an UDF of type date
Hello,
i get the following error while trying to set a value to an udf with the type "date":
Exception from Server: RPC_E_SERVERFAULT
This code is used:
objDate = CDate(objLineRecordSet.Fields.Item("U_TESTDATE").Value)
objDocument.Lines.UserFields.Fields.Item("U_ACTDATE").Value = objDate '### Here comes the error
The application is in PL 29Christian,
If you search this forum on "date UDF" you will find many posts that may assist you such as this one ...
Format of string passed to Date/Time Hour UDF
HTH,
Eddy -
Error while creating an UDF in a PI 7.1 Mapping
Hi experts,
I'm having problems after creating an UDF in a Message mapping. I receive the error:
the length 0 of the array 'sortedFunctionKeys' is not equal to the number 1 of functions.
It seems like forgeting initializing something...
Regards
GonzaloUpgrading my JDK to 1.6 in my PC almost solved the problem. Anyway, sometimes that happens again.
What I actually do:
1.-Creating my Message Mapping
2.-Saving it
3.-Developping my UDF
The problem occcurs when you create an UDF and just in that moment you don't save it. It will be a bug...
Hope that helps you
Regards
Gonzalo -
Hi All,
Requesting your help in fixing an UDF issue.
This UDF is to check for a table entry and if not found it will create an alert with some source values.
Now the problem is, alert mails are getting created but the values are not getting passed.
Here is the source code:
AbstractTrace trace;
trace = container.getTrace();
MappingTrace trace1;
trace1 = container.getTrace();
Object cachedValue = null;
String result = null;
String sender = null;
String receiver = null;
//Check if source is null or blank. If so then pass blank value to target
if(((sourceValue1.trim()).equals("")) || ((sourceValue2.trim()).equals("")) || ((sourceValue3.trim()).equals("")))
result="";
else
Map map = container.getTransformationParameters();
//Sender System name which is the same as the Sender Business System name in Integration Directory
sender = (String) map.get(StreamTransformationConstants.SENDER_SYSTEM);
//Receiver System name which is the same as the Receiver Business System name in Integration Directory
receiver = (String) map.get(StreamTransformationConstants.RECEIVER_SYSTEM);
// Parameter for cache value. A semicolon is used as a separator between keys
String CONTAINER_PARAMETER = subCat.trim() + UDFReader.getString("PARAMETER_DELIMETER") +sourceValue1.trim() + UDFReader.getString("PARAMETER_DELIMETER") +sourceValue2.trim() + UDFReader.getString("PARAMETER_DELIMETER") +sourceValue3.trim();
trace1.addWarning("CONTAINER PARAMETER: " + CONTAINER_PARAMETER + "\n");
trace.addDebugMessage(UDFReader.getString("CACHE_CONTAINER_PARAMETER_TEXT") + CONTAINER_PARAMETER);
// Retrieve cached value
cachedValue = container.getParameter(CONTAINER_PARAMETER);
if(cachedValue!=null)
// Cached value found
result = cachedValue.toString();
trace.addDebugMessage(UDFReader.getString("CACHE_RESULT_TEXT") + result);
else
// Cached value not present. Fetch value from database
// Build key column names array to be passed to java class
String keyColNames[] =new String[6];
keyColNames[0]=UDFReader.getString("SAP_SYSTEM_COLUMN_NAME");
keyColNames[1]=UDFReader.getString("LEGACY_SYSTEM_COLUMN_NAME");
keyColNames[2]=UDFReader.getString("SUBCATEGORY_COLUMN_NAME");
keyColNames[3]=sourceField1;
keyColNames[4]=sourceField2;
keyColNames[5]=sourceField3;
trace1.addWarning("KeyColNames" + keyColNames[0] + "\n" + keyColNames[1] + "\n" + keyColNames[2] + "\n" + keyColNames[3] + "\n" + keyColNames[4] + "\n" + keyColNames[5] + "\n");
// Build key column values array to be passed to java class
String keyColValues[] = new String[6];
//Check whether sender system is SAP or Legacy
if(sourceField1.startsWith(UDFReader.getString("SAP_SYSTEM_PREFIX")))
//Sender system is SAP
keyColValues[0]=sender;
//Receiver system is Legacy
keyColValues[1]=receiver;
else
//Receiver system is SAP
keyColValues[0]=receiver;
//Sender system is Legacy
keyColValues[1]=sender;
keyColValues[2]=subCat.trim();
keyColValues[3]=sourceValue1.trim();
keyColValues[4]=sourceValue2.trim();
keyColValues[5]=sourceValue3.trim();
// Fetch result using java class
result=RfcLookupHandler.RFCLookup(table,keyColNames,
keyColValues,targetField,trace);
trace1.addWarning("Result:" + result);
if(!result.equals(RfcLookupHandler.VALNOTFOUND))
// Record found in database
container.setParameter(CONTAINER_PARAMETER,result);
else
// Record not found in database
//Autogenerated message id generated at runtime
String msgId = (String) map.get ( StreamTransformationConstants.MESSAGE_ID);
//Dynamic alert message details-Trigerred through RFC SALERT_CREATE
String element[] = new String[9];
String tabIndex[] = new String[9];
String elementLength[] = new String[9];
String type[] = new String[9];
String value[] = new String[9];
//Container names for alert message
element[0] = UDFReader.getString("CONTAINER_NAME_MESSAGE_ID");
element[1] =UDFReader.getString("CONTAINER_NAME_INTERFACE_NAME");
element[2] =UDFReader.getString("CONTAINER_NAME_OBJECT_TYPE");
//element[2]="SAP_MAT_NO";
element[3] =UDFReader.getString("CONTAINER_NAME_OBJECT_TYPE"); ;
element[4] =UDFReader.getString("CONTAINER_NAME_OBJECT_TYPE");
//element[4]="PLANT";
element[5] = UDFReader.getString("CONTAINER_NAME_OBJECT_VALUE");
element[6] = UDFReader.getString("CONTAINER_NAME_OBJECT_VALUE");
element[7] =UDFReader.getString("CONTAINER_NAME_OBJECT_VALUE");
element[8] ="TABLE";
trace1.addWarning("Warning: \n" + element[0] + "\n" + element[1] + "\n" + element[2] + "\n" + element[3] + "\n" + element[4] + "\n" + element[5] + "\n" + element[6] + "\n" + element[7] + "\n" + element[8]);
//Tab index of container variables in alert message
tabIndex[0] = "000001";
tabIndex[1] = "000002";
tabIndex[2] = "000003";
tabIndex[3] = "000004";
tabIndex[4] = "000005";
tabIndex[5] = "000006";
tabIndex[6] = "000007";
tabIndex[7] = "000008";
tabIndex[8] = "000009";
//Length of containers
elementLength[0] = elementLength[1] = elementLength[2] =elementLength[3] = elementLength[4] = elementLength[5] = elementLength[6] = elementLength[7]=elementLength[8]=UDFReader.getString("CONTAINER_VALUE_LENGTH");
//Data type of containers
type[0] = type[1] = type[2] = type[3] = type[4]=type[5] = type[6] =type[7] ="C";
//Values supplied to containers
value[0] =msgId;
value[1] =interfaceName;
value[2] = sourceField1;
value[3] = UDFReader.getString("MESSAGE_SEPARATOR_HYPHEN") + sourceValue1.trim();
value[4] = UDFReader.getString("MESSAGE_SEPARATOR_COMMA") + sourceField2;
value[5] = UDFReader.getString("MESSAGE_SEPARATOR_HYPHEN") + sourceValue2.trim();
value[6] = UDFReader.getString("MESSAGE_SEPARATOR_COMMA") + sourceField3;
value[7] = UDFReader.getString("MESSAGE_SEPARATOR_HYPHEN") + sourceValue3.trim();
value[8] =table;
trace1.addWarning("Table: "+table);
// Check error handling flag
if(errorHandlingFlag.equalsIgnoreCase("E"))
//Throw Error and generate alert message
trace.addInfo(UDFReader.getString("NO_RESULT_FLAG_E_TRACE"));
trace1.addWarning("Error Flag: E");
for (int i=0; i<9; i++){
trace1.addWarning("Parameters["+i+"]: " +value[i]);
result = SUPPRESS;
RfcAlertHandler.RFCAlert(alertCat,element,tabIndex,elementLength,type,value,trace);
throw new ValueMappingException(UDFReader.getString("NO_RESULT_FLAG_E_EXCEPTION"));
else if(errorHandlingFlag.equalsIgnoreCase("N"))
//Pass 'NA' value to target
result=UDFReader.getString("NO_RESULT_FLAG_N_VALUE_PASSED");
trace.addInfo(UDFReader.getString("NO_RESULT_FLAG_N_TRACE"));
trace1.addWarning("Error Flag: N");
else if(errorHandlingFlag.equalsIgnoreCase("B"))
//Pass blank value to target
result="";
trace.addInfo(UDFReader.getString("NO_RESULT_FLAG_B_TRACE"));
trace1.addWarning("Error Flag: B");
else
//Incorrect Error Handling Flag
trace.addInfo(UDFReader.getString("INCORRECT_FLAG_TRACE"));
trace1.addWarning("Error Flag: INCORRECT");
result = SUPPRESS;
throw new ValueMappingException(UDFReader.getString("INCORRECT_FLAG_EXCEPTION"));
return result;
Can someone check where could be the problem?
Thanks,
Glory.What is RfcLookupHandler? And where is RFC channel settings?
-
Get dynamic filename in a Java Mapping (NOT UDF)
Hi,
we are using a Java Mapping step in XI (not UDF). We need to have access to the filename. In the File Adapter we set the message attributes and can see the filename value in the SXMB_MONI.
We use the following code fragment to have access to the filename:
Container container = new Context(new FunctionWrapper(0));
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String sourceFileName = conf.get(key);
This doesn't work. We think the declaration of the container class is wrong. Does anybody have some information about using the dynamic attributes in Java Mappings?
Thanks in advance
Michaelimport com.sap.aii.mapping.api.*;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
public class JavaProgram
implements StreamTransformation
public JavaProgram()
public void setParameter(Map map)
param = map;
if(param == null)
param = new HashMap();
public void execute(InputStream inputstream, OutputStream outputstream)
try
DynamicConfiguration dynamicconfiguration = (DynamicConfiguration)param.get("DynamicConfiguration");
DynamicConfigurationKey dynamicconfigurationkey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
String s = dynamicconfiguration.get(dynamicconfigurationkey);
//Your logic
catch(Throwable throwable)
throwable.printStackTrace();
private Map param; -
Unable to see custom Trace messages in Log Viewer which were defined in UDF
Hello Experts, I am not able to see my trace messages in Log Viewer. I have a small user defined fuction which takes a variable and returns its uppercase and while do that it writes few warning level trace messages in the trace file. I've tried changing the levels from Warning to Info but I still don't see anything in my Log Viewer. At this point I am not even sure if I am looking at right place. When I test my mapping in Message Mapping's Test tab it works fine and shows me all my trace messages. But when I do end to end it is not writing anything to the trace file. I've tried to use instructions from following blogs:
1. /people/michal.krawczyk2/blog/2007/04/30/xipi-personalized-logging-tracing(logging and tracing)
2. /people/michal.krawczyk2/blog/2005/05/10/xi-i-cannot-see-some-of-my-messages-in-the-sxmbmoni (logging and tracing)
3. /people/michal.krawczyk2/blog/2005/02/25/simple-java-code-in-graphical-mapping--xi(for my UDF)
but I still don't see traces in my Log Viewer. Please let me know if I am doing anything wrong here.
Thanks in advance!!
==============================================================
public String TraceVar(String var1, Container container) throws StreamTransformationException{
AbstractTrace importanttrace; //create an instace of AbstractTrace
importanttrace = container.getTrace(); //get trace
importanttrace.addWarning("FiletoFileMP:MyUdflibrary: " + var1); //write first message to the trace
// fix the naming conventions later
String SenderName; // declare multiple vars to store infos
String ReceiverName;
String interface_name;
String message_ID;
String time_Sent;
java.util.Map map;
map = container.getTransformationParameters();
//get interface info into the variables
time_Sent = (String) map.get(StreamTransformationConstants.TIME_SENT);
message_ID = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
interface_name = (String) map.get(StreamTransformationConstants.INTERFACE);
SenderName = (String) map.get(StreamTransformationConstants.SENDER_NAME);
ReceiverName = (String) map.get(StreamTransformationConstants.RECEIVER_NAME);
//post interface info to the trace
importanttrace.addWarning("Time Sent: " + time_Sent);
importanttrace.addWarning("Message ID: " + message_ID);
importanttrace.addWarning("Interface Name: " + interface_name);
importanttrace.addWarning("Sender Name: " + SenderName);
importanttrace.addWarning("Receiver Name: " + ReceiverName);
//convert var1 to uppercase to make sure this function has be executed
return var1.toUpperCase();
Edited by: Mayur Patel on May 5, 2009 11:03 PMThank you Prateek for a quick response.
Yes I was able to see my trace messages in SXMB_MONI. Below is my the info... This is great. I am still not sure why this info is not showing up in Log Veiwer's (default trace) window. Any ideas? Since this XML file contains lots of other information I was wondering how to put my trace messages into the log viewer.
Thanks!!
<Trace level="1" type="T">*** START APPLICATION TRACE ***</Trace>
<Trace level="2" type="T">FiletoFileMP:MyUdfLibrary: Honda</Trace>
<Trace level="1" type="T">FiletoFileMP:MyUdfLibrary: Honda</Trace>
<Trace level="1" type="T">Time Sent: 2009-05-05T16:16:39Z</Trace>
<Trace level="1" type="T">Message ID: 366CEAF14D3B410033AFDDB71CD2AF73</Trace>
<Trace level="1" type="T">Interface Name: SIC_Car_Outbound</Trace>
<Trace level="1" type="T">Sender Name: SIC_Car_Outbound</Trace>
<Trace level="1" type="T">Receiver Name: SI_Car_Inbound</Trace>
<Trace level="1" type="T">*** END APPLICATION TRACE ***</Trace> -
Checking if UDF in System Table Exists
Hi all,
I want to add a UDF in the RDR1 table (Sales Order Lines). I'm having a problem checking if the field exists! This is my code...
If Not oUserFieldMD.GetByKey("RDR1", 0) Then
oUserFieldMD.TableName = "RDR1"
oUserFieldMD.Name = "NJ_OpnTpoQty"
oUserFieldMD.Description = "Open TPO Qty"
End If
The problem is that I have previous UDF's from other Add-Ons in that table and so I cant use a Hard Code 0 "Zero" in the "FieldID" Parameter for the GetByKey Method! It could vary depending on the number of existing UDFs. How do I check for the this UDF with using the "TableID" and "AliasID". I could use a oRecordSet.DoQuery and check if the RecordCount = 0....but I am having a "-1120 Ref Count..." error problem with having two BoObjects open simultaneously.
Does any1 have any other way of checking if UDFs exists in System Tables?
ThanksHi Noor
I know 2 ways:
1st:
Dim mRs As SAPbobsCOM.Recordset
mRs.DoQuery("SELECT TableID FROM CUFD WHERE TableID = 'RDR1' AND FieldID = 'NJ_OpnTpoQty'")
If Not mRs.EoF Then
'Add Field
End If
The problem is that you can have this field with other TableId and your code will crash
2nd:
Put your "add field" code in a Try..Catch block with no code in catch section.
HTH -
How to get a UDF value inside print event.
I'm designing an add-on that will print 3 labels based on different criteria when and Invoice or a Delivery ticket is print. Each label will go to a different printer since these are specifilly dedicated to each type of label/form.
My problem is that that I have 2 UDF in the header of the marketing documents (Y/N fields) that flag me when 2 of the labels needs to be printed. I have tried unsuccessfully to get the value from the UDF items in the form, I got several information like cardname, shipto address and total from the marketing document form, but no UDF can be access.
Below find copy of my routine (tPOTD is my UDF), this code will only work if there is only one instance of the form open, now is there's a way of knowing the instance number of a specific form?
Private Sub SBO_Application_PrintEvent(ByRef printeventInfo As SAPbouiCOM.PrintEventInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.PrintEvent
Dim s As String
Dim DocType As String
Dim oForm As SAPbouiCOM.Form
Dim tInvNum As SAPbouiCOM.EditText
Dim tName As SAPbouiCOM.EditText
Dim tshipto As SAPbouiCOM.EditText
Dim ttotal As SAPbouiCOM.EditText
Dim tPOTD As SAPbouiCOM.ComboBox
If printeventInfo.BeforeAction = True And printeventInfo.PrintEventType = SAPbouiCOM.BoPrintEventTypes.pet_Print Then
oForm = SBO_Application.Forms.Item(printeventInfo.FormUID)
If oForm.TypeEx = "133" Or oForm.TypeEx = "60090" Then
DocType = "Invoice"
Else
DocType = "Delivery"
End If
tInvNum = oForm.Items.Item("8").Specific
tName = oForm.Items.Item("54").Specific
tshipto = oForm.Items.Item("92").Specific
ttotal = oForm.Items.Item("29").Specific
' Next line is to get the value of the UDF but it fails finishing the routine and no exceptions raise
tPOTD = SBO_Application.Forms.GetForm("-" + oForm.TypeEx, oForm.TypeCount - 1).Items.Item("U_PrintOTD").Specific
s = tName.Value + Chr(13) + Chr(10) + Replace(tshipto.Value, Chr(13), Chr(13) + Chr(10)) + Chr(13) + _
Chr(10) + Chr(13) + Chr(10) + DocType + ": " + tInvNum.Value + " Total: " + ttotal.Value
End If
EndSubFirst off, do you have the UDF form visible? If not, I'm not aware of a way to retrieve the UDF data without the DI-API.
Assuming you're printing with the form active, you can use the SBO_Application.Forms.ActiveForm.TypeCount value to obtain the "instance" of the form, I'd guess. I haven't tried it, but I assume it would work:
UDFForm = SBO_Application.Forms.GetFormByTypeAndCount(-133, SBO_Application.Forms.ActiveForm.TypeCount)
Then your field would be:
UDFValue = oUDFForm.Items.Item("U_MYFIELD").Specific
Message was edited by:
Curtis Fry -
Hi,
Please help in writing a UDF for these fields in mapping, which I need for the object Iu2019m doing currently.
The fields are like this:
1) batch_no = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/5000)+1",
2) lot_id = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/500)+1",
3) How to use JDBC connection factory class in the UDF.
Some logic I can provide which I know i.e. Power (2, 28) means 2 to the power of 28 (2 multiplied 28 times), Trunc means truncate, X_TXN_SAP_Parts is a database table.The Target fields are Batch_no, lot_id & Objid.Actually, objid is mapped initially to a source field i.e. Object ID and in this function it is only being used for the calculation of the batch_no.
Thanks in Advance,
Sreedhar.Hi,
Following with my query I've tried to use this code but still I'm unable to execute the mapping.
import java.util.*;
import com.sap.aii.mapping.lookup.*;
import com.sap.aii.mapping.lookup.*;
DataBaseAccessor accessor = null;
DataBaseResult JDBCOutPayload = null;
String BusinessSystem="clarify_dev_bizsys";
//give your business system having channel name
String CommunicationChannel="JDBC_TO_CDEV";
//give your channel name
String InputPayload= " select X_TXN_PRE_SITE_XFACE.nextval from dual;";
//give your sql query
try {
Channel channel =
LookupService.getChannel(BusinessSystem,CommunicationChannel);
accessor = LookupService.getDataBaseAccessor(channel);
DataBaseResult resultSet = accessor.execute(InputPayload);
for(Iterator rows = resultSet.getRows();rows.hasNext();){
Map rowMap = (Map)rows.next();
Object cValue = rowMap.get("batchno");
//field name of field required , as in database
catch (Exception e) {}
finally {
if (accessor != null)
accessor.close();
result.addValue((String)cValue);
--> I don't know what are the parameters to be used and how to be used in the UDF because this is the first time I'm writing a UDF.
--> The problem in using this query is that both OBJID & BatchNo. are on the target side and the value for the OBJID is retrieved by a SELECT query from the database.
Kindly help me how to resolve this query of mine.
Thanks in Advance.
Sreedhar. -
Reading Numeric UDF null value in DI
We have a UDF of Numeric(4) that can be NULL, 0, 1, 2, etc. We try to read it from DI, and if it is NULL, then set the result to be -1 (the default value we difined), so we can differentiate NULL and 0.
The C# code we have look like this:
int LineNumber = -1;
SAPbobsCOM.Company oCompany;
// Code to get Company
SAPbobsCOM.Documents oDoc = oCompany.GetBusinessObject(BoObjectTypes.oQuotations);
oDoc.GetByKey(100); // Get the document by DocEntry
LineNumber = (int)oDoc.UserFields.Fields.Item("U_XX_LN").Value;
The problem is LineNumber gets 0 even if in the database U_XX_LN is NULL. We tried the code below and got the same result because oDoc.UserFields.Fields.Item("U_XX_LN").Value.ToString() always return '0' if it is NULL.
if (string.IsNullOrEmpty(oDoc.UserFields.Fields.Item("U_XX_LN").Value.ToString()))
LineNumber = -1;
else
LineNumber = (int)oDoc.UserFields.Fields.Item("U_XX_LN").Value;
The question is: how can we set it to default -1 if in the database the value is NULL?
Thank you,
GraceHi Grace,
Unfortunately the DI API automatically converts database null values to a default value for the datatype (eg null for numeric becomes 0 and null for strings is an empty string). If you want to differentiate between null and zero you will need to query the table using the isnull command rather than reading the table through the UserTables object:
oRecordSet.DoQuery("select isnull(U_XX_LN, -1) as U_XX_LN from [@MYTABLE] where Code = 'MYCODE')
This will convert the null value to a -1 in the recordset so you can tell the difference between nulls and zeros.
Kind Regards,
Owen -
Adding a new UDF throws a null pointer exception and modifying user.xml
Hello,
I have a two part question.
i. I am trying to add a UDF (using Advanced>User Configuration..Attributes) to a fully configured OIM i.e. oim with reconciliation and provisioning from and to resources but it throws a null pointer exception. Look at the log, I see
===============Excerpt form the log file==========
[2012-01-26T11:28:14.447-05:00] [oim_server1] [NOTIFICATION] [] [oracle.iam.platform.authz.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 0000JKQq8vZ8dpC5nFk3yZ1Evvpt000LzY,0] [APP: oim#11.1.1.3.0] [dcid: c62f3a4b80d21e6f:ef93519:134587d39c4:-7ffd-0000000000022a3e] [[
---Stack Trace Begins[[This is not an exception. For debugging purposes]]---
oracle.iam.platform.authz.impl.OESAuthzServiceImpl.doCheckAccess(OESAuthzServiceImpl.java:210)
oracle.iam.platform.authz.impl.OESAuthzServiceImpl.hasAccess(OESAuthzServiceImpl.java:188)
oracle.iam.platform.authz.impl.OESAuthzServiceImpl.hasAccess(OESAuthzServiceImpl.java:180)
oracle.iam.platform.authz.impl.AuthorizationServiceImpl.hasAccess(AuthorizationServiceImpl.java:173)
oracle.iam.configservice.impl.ConfigManagerImpl.checkAuthorization(ConfigManagerImpl.java:1899)
oracle.iam.configservice.impl.ConfigManagerImpl.addAttribute(ConfigManagerImpl.java:177)
oracle.iam.configservice.api.ConfigManagerEJB.addAttributex(Unknown Source)
... 21 lines skipped..
oracle.iam.configservice.api.ConfigManager_5u0nrx_ConfigManagerRemoteImpl.addAttributex(ConfigManager_5u0nrx_ConfigManagerRemoteImpl.java:864)
... 13 lines skipped..
oracle.iam.configservice.api.ConfigManagerDelegate.addAttribute(Unknown Source)
oracle.iam.configservice.agentry.config.CreateAttributeActor.perform(CreateAttributeActor.java:266)
oracle.iam.consoles.faces.mvc.canonic.Model.perform(Model.java:547)
oracle.iam.consoles.faces.mvc.admin.Model.perform(Model.java:324)
oracle.iam.consoles.faces.mvc.canonic.Controller.doPerform(Controller.java:255)
oracle.iam.consoles.faces.mvc.canonic.Controller.doSelectAction(Controller.java:178)
oracle.iam.consoles.faces.event.NavigationListener.processAction(NavigationListener.java:97)
... 24 lines skipped..
oracle.iam.platform.auth.web.PwdMgmtNavigationFilter.doFilter(PwdMgmtNavigationFilter.java:115)
... weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
oracle.iam.platform.auth.web.OIMAuthContextFilter.doFilter(OIMAuthContextFilter.java:100)
... 15 lines skipped..
weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
---Stack Tracefor this call Ends---
[2012-01-26T11:28:14.447-05:00] [oim_server1] [NOTIFICATION] [IAM-1010010] [oracle.iam.platform.authz.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 0000JKQq8vZ8dpC5nFk3yZ1Evvpt000LzY,0] [APP: oim#11.1.1.3.0] [dcid: c62f3a4b80d21e6f:ef93519:134587d39c4:-7ffd-0000000000022a3e] [arg: 1] [arg: null] [arg: USER_MANAGEMENT_CONFIG] [arg: CREATE_ATTRIBUTE] ********** Entering the Authorization Segment with parameters:: LoggedInUserId = 1, target resourceID = null, Feature = USER_MANAGEMENT_CONFIG, Action = CREATE_ATTRIBUTE **********
[2012-01-26T11:28:14.448-05:00] [oim_server1] [NOTIFICATION] [IAM-1010021] [oracle.iam.platform.authz.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 0000JKQq8vZ8dpC5nFk3yZ1Evvpt000LzY,0] [APP: oim#11.1.1.3.0] [dcid: c62f3a4b80d21e6f:ef93519:134587d39c4:-7ffd-0000000000022a3e] [arg: [InternalObligation: name: noop, values: [true], convertToObligation: false, InternalObligation: name: noop, values: [true], convertToObligation: false]] Validating the Internal Obligations: [InternalObligation: name: noop, values: [true], convertToObligation: false, InternalObligation: name: noop, values: [true], convertToObligation: false]
[2012-01-26T11:28:14.448-05:00] [oim_server1] [NOTIFICATION] [IAM-1010022] [oracle.iam.platform.authz.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 0000JKQq8vZ8dpC5nFk3yZ1Evvpt000LzY,0] [APP: oim#11.1.1.3.0] [dcid: c62f3a4b80d21e6f:ef93519:134587d39c4:-7ffd-0000000000022a3e] ---------- The list of Internal Obligation is satisfied, returning TRUE ----------
[2012-01-26T11:28:14.448-05:00] [oim_server1] [NOTIFICATION] [IAM-1010026] [oracle.iam.platform.authz.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 0000JKQq8vZ8dpC5nFk3yZ1Evvpt000LzY,0] [APP: oim#11.1.1.3.0] [dcid: c62f3a4b80d21e6f:ef93519:134587d39c4:-7ffd-0000000000022a3e] [arg: Decision :PERMIT\nObligations from policy: ] ********** Exiting the Authorization Segment with result Decision :PERMIT[[
=============Excerpt ends==============
Is there a reason why this is and how do I get by it.
ii. Can I just add the field directly within the MDS>file/user.xml? Would there be an issue with changing an existing attribute metadata using the user.xml?Pradeep thank you for your response. it was helpful. However, I also found the responses to both my questions.
i. The null pointer exception was due to using a complex query I was using in the LOV query. I tried a simple query and that worked fine.
ii. For modifying the user defined attributes one can consult the following forum post:
OIM 11g - Change UDF Field Type form String to LOV
Thanks -
How to mapp in UDF column of MasterData & Master Data Rows UDO add time?
Hi all ,
I have one MasterData(A) & 3 MasterData Rows(B&C) table
A (Code ,Name ,U_SKU,U_AName,U_AID) Master table
B(Code ,Name ,U_SKU,U_BName,U_BID) Child table
C(Code ,Name ,U_SKU,U_CName,U_CID) Child table
Now tables are automatic Mapped with Code UDO Creation time but i want to mapping with U_SKU column
please help how to mapp MasterData(A) and 3 MasterData Rows(B&C) table with UDF Column
Thanks in Advance
Surajit kunduin the start routine of transformation from 0MAT_SALES_ATTR to znewmat do the following:
select materials from /BIC/PZNEWMAT into i_mat
for all entries in source_package where material eq source_package-material.
loop at source_package.
p_ind = sy-tabix.
read table i_mat with key material = source_package-material.
if sy-subrc ne 0.
delete i_mat index p_ind.
endif.
this way you'll only update records that have previously been loaded by 0MATERIAL_ATTR DS
loading sequence:
first load ZNEWMAT from 0MATERIAL_ATTR. then activate ZNEWMAT. then load 0MAT_SALES_ATTR to ZNEWMAT.
M. -
Message Mapping activation error-Source code has syntax errors in UDF
Hi all,
I wrote a small UDF for sum of 2 numbers:
import
udf.*
public String getsum(String a, String b, Container container) throws StreamTransformationException{
int c = Integer.parseInt(a);
int d = Integer.parseInt(b);
int e = packageDemo.getSum(c,d);
return e+"";}
In imported archives, i imported pack.jar
In D:\udf , I have packageDemo.java, packageDemo.class, aii_map_api.jar, pack.jar(has the other 3)
packageDemo.java :-
package udf;
public class packageDemo{
public static int getSum(int a,int b)
int c= a+b;
return c;
Did i miss anything?? Icant activate message mapping for 2 errors:-
1.package udf does not exist
2.Function getsum, Line 3:
cannot find symbol symbol : variable packageDemo location: class com.sap.xi.tf._xml_mm_int e = packageDemo.getSum(c,d); ^Note: /usr/sap/P7R/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd4214d3099dc11dd9470001d090e4bbe/source/com/sap/xi/tf/_xml_mm_.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: /usr/sap/P7R/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd4214d3099dc11dd9470001d090e4bbe/source/com/sap/xi/tf/_xml_mm_.java uses unchecked or unsafe operations.Note: Recompile with -Xlint:unchecked for details.2 errors
Edited by: NagaDurga Nannapaneni on Oct 16, 2008 1:07 PMHi ,
Think the error is coming because the content in imported archive is not being taken into message mapping at all...so package, class, method ..nothing is identified.
Can anyone suggest the solution..
Thanks,
Durga
Maybe you are looking for
-
RE: How to quickly prototype OEM Plug-In ?
Hi: - Is there a way to quickly prototype an OEM plug-in? - When I am developing a plug-in, I do the following: 1) write xml file 2) check xml file 3) create jar file 4) deploy jar file 5) add target instance - To make any changes to the plug-in, I f
-
Create pdf from any type of file file format
Hi there; I have to create a pdf file from a special file format (which is not in the supported file list of livecycle pdf generator).Is there any chance to accompish that transform?I know Java.Thanks in advance..
-
Hi Friends, Can anyone help me with some documents for reference on ESS/MSS configuration and integration of ABAP reports/Infotypes on ESS/MSS. Regards, Ameet
-
Right-click on windows 8.1 with update (problems)
Hi guys. I have a strange problem on Windows 8.1 with update. If I right click on a file the Menu opens and closes in same second. It does not happen if I click on folders. Even if I sign out from Windows it's the same. Any hints? bostjanc
-
I got My iPhone 4s and restored using an Old Backup of my 3Gs
Out of the box the iPhone 4s started fine. I synced it without a problem refering to a previous backup of my iPhone 3Gs. Network issues meant I did not use it as my primary phone for 4 days and phone still had my apps and old contacts. When I finally