UDF in StockTaking?

Hi,
First of all, excuse my English. It's not my mother language.
We are developing some new functionalities about inventory management. In that sense, we need that users specify additional information when they are adjusting quantities with StockTaking.
We would need to add a new column in Form 840 for that funcionality. However, we cannot do it using UI API because its a system form and it has already loaded data.
On the other hand, I think that we cannot create UDF because StockTaking is not properly a table in database, but some fields in OITW. We have added some UDF in OITW, but they are not showed in StockTaking (form 840).
Has anyone an idea about this? How could we solve this?
Thanks in advance.
Regards,
Antonio Dorta

Hi Eddy,
Thank you very much for replying.
>
Edward Neveux wrote:
> The StockTaking object is available via the DI API and the object does allow for the addition via code of user defined fields.
>
I am afraid that it is not possible. I have tried via code, via SAP menu, via LoadBatchActions, with no success.
The matrix in form 840 does not use dbdatasources in databinding, but the fields in that matrix are processed and stored in OITW table.
You can create UDFs in OITW table, but they are not showed in form 840.
It will very helpful if anyone could share some code for creating UDF in StockTaking object.
>
Edward Neveux wrote:
> my suggestion would be that you create another form that contains your fields and is triggered when some event of your choosing happens on the system form.
That event should be triggered every time you write a quantity in that form (i.e. a Validate Event), so I think that a "special pop-up form for asking a note every time" will not very useful for final users.
Thank you anyway.
Regards,
Antonio
Edited by: Antonio Dorta on Jun 19, 2008 3:23 PM

Similar Messages

  • 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 29

    Christian,
    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
    Gonzalo

    Upgrading 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

  • Issue in RFCLookup UDF

    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
    Michael

    import 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 PM

    Thank 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?
    Thanks

    Hi 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
    EndSub

    First 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

  • Need Help in writing a UDF

    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,
    Grace

    Hi 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 kundu

    in 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 PM

    Hi ,
    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

  • Mail attachment generated in UDF in SAP PI 7.1 - Issue with line feed

    Hello,
    Situation is:
    Implemented a scenario in SAP PI 7.1 with a mail receiver following this thread:
    /people/samuel.chandrasekaran2/blog/2008/10/06/xi-mail-adapter-dynamically-building-attachment-and-message-body-content-using-a-simple-udf
    which is about moving message lines from sender into an attachment forn the receiver mail.
    It is working great!
    The receiver gets the mail including the attachment with all added lines.
    But when opening this mail there is an issue depending on the program we are using to open the attachment
    which is defined as txt file
    - Using MS Editor 5.1 (Windows XP 2007, SP3) the Carriage returns and line feeds (added with
    in the UDF) to separate the message lines are not recognized. In the Editor each 
        is shown as □   within the text.  Word wrap (flag set in the editor) is different to the carriage return/line feeds set in the file.
    - Using MS Notepad 5.1 (Windows XP 2007, SP3)   situation is the same but
        is NOT shown as □ , it simply seems to be unvisible. Word wrap (flag set in the editor) is different to the carriage return/line feeds set in the file.
    - Using Word 2007 the carriage returns are recognized and used in a correct way to display the file content. But now mutated vowels (äüö) are not recognized. They are displayed as
    So I followed this thread:
    http://help.sap.com/saphelp_nw04/helpdata/en/96/f04142099eb76be10000000a155106/content.htm
    Nice....
    In the editors there is no change, but when opening the file in Word it asks now how to convert the file content
    (proposing UTF-8) and Word recognizes mutual vowels.
    But there seems to be a side effect....
    Following the second link,  PI recognizes an error.
    This is the error message.
    MP: exception caught with message Null as XI message received (PrincipalData in ModulData is null)
    Adapter Framework caught exception: Null as XI message received (PrincipalData in ModulData is null)
    Delivering the message to the application using connection Mail_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.Exception: Null as XI message received (PrincipalData in ModulData is null).
    But the message is sent to the mail recipient which could be ok if PI would not repeat the mail sending now for several times.
    So we will receive not one but a number of mails.
    So we removed the modul recommended in this help link from the channel.
    Result: Behaviour in Word changed now to the described one. But the errors are no longer coming up in channel monitoring incl. message send repetition. So this is a first success. But the partner wants to process the files first with one of the named editors. So we are looking for another solution now to fix the last issue!
    Your ideas are really welcome!
    Best regards
    Dirk

    Hi,
    as I found this in wikipedia:
    Another common problem is the use of '\n' when communicating using an Internet protocol that mandates the use of ASCII CR+LF for ending lines. Writing '\n' to a text mode stream works correctly on Windows systems, but produces only LF on Unix, and something completely different on more exotic systems. Using "\r\n" in binary mode is slightly better, as it works on many ASCII-compatible systems, but still fails in the general case. One approach is to use binary mode and specify the numeric values of the control sequence directly, "\x0D\x0A".
    Back to my issue:
    In the UDF I am adding "\r\n" but only the "\n" seems to survive!
    In Mapping test line feeds are available and the lines are shown as expected.
    Using Notepad ++ to open the created txt file from the mail shows that LF is in the file at each end of line but CR is missing.
    CR is only at the end of the last line in the file and is not from the UDF that creates the mail or the UDF that creates the attachment lines. Seems that this is added somewhere else behind the mapping.
    This is what I found in galileo computing
    (http://www.galileocomputing.de/glossar/gp/anzeige-11241/FirstLetter-Z, SORRY, only available in german language!):
    In Parsing of XML-Documents the XML-Parser changes the end of line delimiter internally in general to a simple line feed (LF, #0A) as usual in UNIX. ..... In Windows this could result in problems with readability of  source texts (e.g. in Notepad) which can be solved by choosing the right editor.
    My target application is on Windows and not able to "choose" the right editor (PI system is on windoes OS too) !
    But Im wondering where the CR at the end of the text comes from when all the \r\n will be replaced with \n as described.
    Ideas are really welcome!
    Best regards
    Dirk
    Edited by: Meinhard Dirk on May 31, 2011 2:45 PM

Maybe you are looking for

  • Duller colors from Camera Raw to Photoshop: why?

    Hello! I'm opening my Canon 70D RAW files with Camera Raw 8.4.1. After this step, I open the corrected file in Photoshop CC. At this point colors have changed, everything is duller and less contrasted. See image. Camera Raw color management: Adobe RG

  • How can I do to get excel and words into my IPAD

    How can I do to keep excel an words documents into my IPAD???

  • Select SUM in FOR ALL ENTRIES Select Query

    Hi ,         I am using for all entries select statment ,can any one guide me how can i use SUM in the select statment with for all entries . Regards, Veera

  • Merging Multiple fact tables and creating a BIA target

    Hi Folks We are  using Dataservices with BIA. We want to merge mutliple fact table and create a sinvglc cube on BIA. when we tried to do that we get a error message that we cannot merge multiple fact tables. any pointers ? Poonam

  • IMessage has become unreliable?

    Has anyone else noticed that iMessage has become horribly unreliable in the past few weeks? I regularly use iMessage to chat with friends, and my account is activated on an iPhone 5S, iPad Mini and two Macs running Mavericks. Until a few weeks ago ev