UDF for repeated node

Hi,
My requirement is how to map data in below situation.
I have one node which occur repeatedly.
Source:
Node A
  comment
Node A
  comment
Node A
  comment
Target:
comment
comment
comment
How can I achive this using UDF.

Hello,
I am able to obtain the below output with one to one mapping for Z1WHCMTH to comment field of Line Node.
However, as you can see since Z1WHCMTH is not a substructure of Z1WHCUSTCD; you will need to seek clarity on how to populate comment for each line segment being created.
Also what exactly are NODE A and NODE B in your target xsd?
Regards,
Diptee

Similar Messages

  • Strange Errors from Import Server on Schema-based maps for repeating nodes

    I have already posted one thread about this, but perhaps some more in-depth information is required:
    We have uploaded our schema into the console, and have mapped the following multi-node file to it:
    CUSTOMER <repeating node>
      MDM_CUST (new Customer number returned)
      CUSTOMER(mapped back from XI for RECORD MATCHING)
      CREATE_DATE (text field)
      CONTACT<repeating node>
        CONTACT_NO (RECORD MATCHING : NON-QUALIFIER)
        CONTACT_SAP_NO (QUALIFIER)
         [NOTE: There are other qualifers for CONTACT, but only this one
    qualifier is being returned and is the only field that would and should be updated.
    The other fields should be left alone. However, it appears to overwrite EVERYthing
    with NULL other than these two fields. The CONTACT_NO is the sole qualifer on
    the table. It is a calculated field that equals the Auto-ID that is also produced on
    the table - but obviously not mapped.]
      PARTNER<repeating node>
        CUSTOMER_NO (RECORD MATCHING : NON-QUALIFER)
        PARTNER_FUNC (NON-QUALIFIER - Code given to lookup from PARTNER_FUNCTION table which has Code and Desc)
        PARTNER_NO     (NON-QUALIFIER)
        DEFAULT_PARTNER_FLAG (QUALIFIER)
    <CLOSE CUSTOMER NODE>
    In the Customer main table, all records are matched on CUSTOMER. The CONTACT_NO non-qualifer is matched to the CONTACT qualified lookup table directly since it is the only available non-qualifier. For the PARTNER table, the three qualifiers are mapped and then a compound field is created to map to the PARTNER table entry.
    We have the Configurations set at:
    Default Multi-Valued Update: Replace
    Default Qualified Update: Replace
    Default Matching Qualifiers: None
    Our record matching is: Create / Update(ALL MAPPED FIELDS) / Update(ALL MAPPED FIELDS)
    When the map is reused, the repeating nodes are all recognized, be it one node or many. However, when the map is reused, it does not automatically map the values for many of the Partner fields (nor the compound field) though the fields are correctly mapped.
    Also, when we attempt to use Import Server to automate the mapping, we use the mdis.ini set to
    Automap Unmapped Value=True
    Unmapped Value Handling=Add
    Always Use Unmapped Value Handling=False
    We get a very strange error saying that :
    [code]Encountered a pre-SP4 map. The map needs to be upgraded to SP4.
    Solution: Please, Launch the Import Manager GUI using the same source file and simply save the map.[code]
    Could it be that our MDM 5.5 SP4 is not compatible with schemas generated with XI v.7 SP9?
    All of our MDM is 5.5 SP4. It makes no sense that we would get THIS kind of error. Also, I am questioning our combination of these and other configurations since it doesn't always seem to do what it should

    Hi Donald,
    this sounds good so far. Just a short hint: you've set "Default Qualified Update: Replace". This explains why Import server "appears to overwrite EVERYthing
    with NULL other than these two fields.". The reason is the replace. A replace means that the old values are completely deleted and only the new incoming ones are stored. I'd suggest to use any of the Update possibilities.
    Note: the definitions you set in in the record matching step are mainly for the new records in the main table! Records in qualified look ups are handled differently! If you open your map in Import Manager, switch to tab "Map Fields/Values". Select a field that is your non qualifier. Right-Click on it and choose "Set qualified update" from the context menu. Now you can define which qualifiers can be used for the qualified look up matching. And you can define as well what should happen with new and/or existing records.
    Regarding the value mapping: do you use keymapping? Or do you use simple values only? Do you save the map everytime you add a new value mapping?
    Regarding the issue "Encountered a pre-SP4 map. The map needs to be upgraded to SP4. Solution: Please, Launch the Import Manager GUI using the same source file and simply save the map". This sounds very likely like a bug in MDIS and should be reported to SAP!
    Hope that helps
    Michael

  • BizTalk mapping for repeating Nodes using XSLT

    Hi,
    I am mapping the source schema to destination schema using Custom XSLT file. I have a repeating node in the Sources schema:
    Period node can repeat any number of times. I am using the XPath in XSLT to map the nodes from source to destination and using the "for-each" loop.
    Destination Schema:
    I want to map "PeriodID" and "Volume" both to the destination node "html:TD". I am using the following XSLT code:
    <xsl:for-each select="/*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']">
    <html:TR class="data0" level="0">
    <html:TD class="data-int" datatype="int">
    <xsl:value-of select="./*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']/*[local-name()='PeriodID' and namespace-uri()='Namespace']"/>
    </html:TD>
    <html:TD class="data-dbl" datatype="dbl">
    <xsl:value-of select="./*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']/*[local-name()='Volume' and namespace-uri()='Namespace']"/>
    </html:TD>
    </html:TR>
    </xsl:for-each>
    I am only getting the first value of both the nodes in every loop.
    I know that we can use the XPath of the actual Node(PeriodID) in "for-each" loop and use value-of="." to get the current values of the node.
    But the problem is I want both the values "PeriodID" and "Volume" repeating in the destination.

    if you use xpath like you did ( imean without index), you will only get 1 record elements each time.
    Either you have to use code like i did, or use index based xpath.
    The code i gave you should work, just try to debug it from visual studio. Because xslt is a case sensitive, check if the code i gave you matches the elements in case sensitive. may be you have to use prefixes like s1, s2 etc as per you xsl file declaration.
    Check you xsl file for prefix declarations.
    you can also try below code, it uses postion() method to get the current for loop index.
    <xsl:for-each select="/*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']">
    <html:TR class="data0" level="0">
    <html:TD class="data-int" datatype="int">
    <xsl:value-of select="(./*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']/*[local-name()='PeriodID' and namespace-uri()='Namespace'])[position()]"/>
    </html:TD>
    <html:TD class="data-dbl" datatype="dbl">
    <xsl:value-of select="(./*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']/*[local-name()='Volume' and namespace-uri()='Namespace'])[position()]"/>
    </html:TD>
    </html:TR>
    </xsl:for-each>
    but i insist you to verify for any prefix declarations in you xsl file
    Please mark the post as answer if this answers your question. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Repeating nodes using FOR loop but when concating XML string then concating only last iteration of FOr loop ??

    I stuck with a problem that I am using FOR loop for generating repeating nodes. 
    Now when I concat the generated node in the main node then I got only last iteration of that FOR loop.
    can anybody suggest me a way to handle this error....
    FOR i IN 1..pl_phone_tab.Count
    LOOP
    SELECT xmlelement("Phone"     
                                        ,xmlelement("PHONETYPE",xmlattributes('01' AS "dmnADRP_PHONETYPE"),pl_phone_tab(i).p_phtype_tab)
                         ,xmlelement("PHONENUM",pl_phone_tab(i).p_phnum_tab)
                         ,xmlelement("PRIMARY_CONTACT",pl_phone_tab(i).p_prcon_tab)
    INTO p_phone_xml
    FROM dual; END LOOP;
    SELECT xmlelement("PhoneInfo"
                           ,xmlconcat(p_phone_xml))
    INTO p_phone_info_xml
    FROM dual;
    here I am getting only one node but there has to be two nodes for PHONE node

    Not that I'm encouraging you but here are two standalone examples explaining how to do what you want :
    1) Loop through the input collection and append each node to its target container :
    SQL> declare
      2 
      3    type t_emp_tab is table of scott.emp%rowtype;
      4 
      5    emp_tab       t_emp_tab;
      6    emp_info_xml  xmltype;
      7    emp_xml       xmltype;
      8 
      9  begin
    10 
    11    -- filling emp_tab with data
    12    select e.*
    13    bulk collect into emp_tab
    14    from scott.emp e
    15    where e.deptno = 10;
    16 
    17    emp_info_xml := xmltype('<EmpInfo/>');
    18 
    19    -- looping through emp collection and appending to EmpInfo element
    20    for i in 1 .. emp_tab.count loop
    21      select appendchildxml(
    22               emp_info_xml
    23             , '/*'
    24             , xmlelement("Emp"
    25               , xmlattributes(emp_tab(i).empno as "id")
    26               , xmlforest(
    27                   emp_tab(i).ename as "Name"
    28                 , emp_tab(i).job as "Job"
    29                 )
    30               )
    31             )
    32      into emp_info_xml
    33      from dual;
    34    end loop;
    35 
    36    dbms_output.put_line(emp_info_xml.getclobval(1,2));
    37 
    38  end;
    39  /
    <EmpInfo>
      <Emp id="7782">
        <Name>CLARK</Name>
        <Job>MANAGER</Job>
      </Emp>
      <Emp id="7839">
        <Name>KING</Name>
        <Job>PRESIDENT</Job>
      </Emp>
      <Emp id="7934">
        <Name>MILLER</Name>
        <Job>CLERK</Job>
      </Emp>
    </EmpInfo>
    PL/SQL procedure successfully completed
    2) Build a secondary collection of XML nodes and use XMLAgg to aggregate them in one go :
    SQL> declare
      2 
      3    type t_emp_tab is table of scott.emp%rowtype;
      4 
      5    emp_tab       t_emp_tab;
      6    emp_info_xml  xmltype;
      7    emp_xml_tab   xmlsequencetype := xmlsequencetype();
      8 
      9  begin
    10 
    11    -- filling emp_tab with data
    12    select e.*
    13    bulk collect into emp_tab
    14    from scott.emp e
    15    where e.deptno = 10;
    16 
    17    -- looping through emp collection and appending to the collection of Emp nodes
    18    for i in 1 .. emp_tab.count loop
    19 
    20      emp_xml_tab.extend;
    21 
    22      select xmlelement("Emp"
    23             , xmlattributes(emp_tab(i).empno as "id")
    24             , xmlforest(
    25                 emp_tab(i).ename as "Name"
    26               , emp_tab(i).job as "Job"
    27               )
    28             )
    29      into emp_xml_tab(i)
    30      from dual;
    31 
    32    end loop;
    33 
    34    select xmlelement("EmpInfo", xmlagg(t.column_value))
    35    into emp_info_xml
    36    from table(emp_xml_tab) t ;
    37 
    38    dbms_output.put_line(emp_info_xml.getclobval(1,2));
    39 
    40  end;
    41  /
    <EmpInfo>
      <Emp id="7782">
        <Name>CLARK</Name>
        <Job>MANAGER</Job>
      </Emp>
      <Emp id="7839">
        <Name>KING</Name>
        <Job>PRESIDENT</Job>
      </Emp>
      <Emp id="7934">
        <Name>MILLER</Name>
        <Job>CLERK</Job>
      </Emp>
    </EmpInfo>
    PL/SQL procedure successfully completed
    Both solutions give the same output.
    Test them both and see which one fits better into your scenario.

  • UDF For Retrieving the Tax Code based on PO

    Hi all,
    Mine is a file to Idoc scenario.
    I wrote a FM to retrieve the Tax Code based on PO .
    Created the udf which directly gets the Taxcode from the r/3 with out importing in to the imported objects,is this correct i never tried this before.
    Find the UDF for the Same.
    final String    CHANNEL_NAME = "GeneratedReceiverChannel_RFC",
         VALNOTFOUND = "VALUE_NOT_FOUND",
         SAPRFCNS = "urn:sap-com:document:sap:rfc:functions",
         TAG_FM = "Z_P_INT012_RFC_LOOKUP",
         TAG_TAX_CODE = "T_TAX_CODE",
         TAG_TAX_CODE_P = "TAX_CODE";
    AbstractTrace trace = container.getTrace();
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = null;
              factory.setNamespaceAware(false);
              factory.setValidating(false);
              try {
                   builder = factory.newDocumentBuilder();
              } catch (Exception e) {
                   trace.addWarning("Error creating DocumentBuilder - " + e.getMessage());
              Document docReq = null;
              try {
                   // Building up RFC Request Document
                   docReq = builder.newDocument();
                   Node root = docReq.appendChild(docReq.createElementNS(SAPRFCNS, TAG_FM));
                   Node nodeTbOpt = root.appendChild(docReq.createElement(TAG_TAX_CODE));
                   for (int i = 0; i < pernr.length; i++) {
                        Node nodeTbOptItem = nodeTbOpt.appendChild(docReq.createElement("item"));
                        nodeTbOptItem.appendChild(docReq.createElement(TAG_TAX_CODE_P)).appendChild(docReq.createTextNode(TAX_CODE<i>));
              } catch (Exception e) {
                   trace.addWarning("Error while building RFC Request  - " + e);
              trace.addInfo("RFC Request XML: " + docReq.toString());
                                                    //trace.addWarning("RFC Request XML: " + docReq.toString());
              // Lookup
              Payload load = null;
              try {
                   Channel channel = LookupService.getChannel(receiver[0], CHANNEL_NAME);
                   RfcAccessor accessor = LookupService.getRfcAccessor(channel);
                   InputStream is = new ByteArrayInputStream(docReq.toString().getBytes());
                   XmlPayload payload = LookupService.getXmlPayload(is);
                   load = accessor.call(payload);
              } catch (LookupException e) {
                   trace.addWarning("Error during lookup - " + e);
              // Parsing RFC Response Document
              Document docRsp = null;
              try {
                   docRsp = builder.parse(load.getContent());
              } catch (Exception e) {
                   trace.addWarning("Error when parsing RFC Response - " + e.getMessage());
              trace.addInfo("RFC Response XML: " + docRsp.toString());
                                                    //trace.addWarning("RFC Response XML: " + docRsp.toString());
              try {
                   NodeList res = docRsp.getElementsByTagName("item");
                   for(int i=0;i<res.getLength();i++){
                        NodeList itemNodes = res.item(i).getChildNodes();
                        Map itemMap = new HashMap();
                        for(int j=0;j<itemNodes.getLength();j++){
                             itemMap.put(itemNodes.item(j).getNodeName(), itemNodes.item(j).getFirstChild().getNodeValue());
                        rows.add(itemMap);
                                                            catch (Exception e) {
                   trace.addWarning("Result value not found in DOM - " + e);
                   result.addValue("true");
    Error:
    16:24:08 Start of test
    Source code has syntax error:  /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:598: 'class' or 'interface' expected public void TaxValues$(String[] a,String[] b,ResultList result,Container container){ ^ /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:618: 'class' or 'interface' expected } ^ /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:619: 'class' or 'interface' expected ^ 3 errors  Source code has syntax error:  /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:598: 'class' or 'interface' expected public void TaxValues$(String[] a,String[] b,ResultList result,Container container){ ^ /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:618: 'class' or 'interface' expected } ^ /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:619: 'class' or 'interface' expected ^ 3 errors
    16:24:11 End of test.

    Hi Potharaju,
    Why don't you try this, that really works:
    If you are using PI 7.1:
    http://help.sap.com/saphelp_nwpi71/helpdata/en/33/1ec6ced273493a993a80c2301c03da/frameset.htm
    If you are using XI 3.0, PI 7.0
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    Try with these.
    Regards,
    Juan

  • Advanced functions,UDF's and node function

    Dear all,
    Can you kindly let me know about Advanced functions,UDF's and node function.Differences and Uses.
    Also Let me know about the advantages,Disadvantages of Graphical,XSLT,Java,ABAP and ABAP XSLT mappings.
    Thanks,
    Srini

    Hi,
    The term Mapping means:
    1. The transformation process, and/or
    2. The transformation rules.
    Independently from XI, you can distinguish two different mappings
    • Structure mappings transform entire message structures.
    • Value mappings transform values within messages.
    Mapping Programs to Map Messages :
    Message Mapping
    Designed by using the graphical mapping editor of Integration Builder
    Result: Generated Java Code.
    Imported Archives
    Import externally defined mapping programs into repository
    Java mapping:
    Implemented by using a specific interface
    XSLT mapping:
    Runtime supports XSLT processor
    Java methods can be called from within a Style Sheet
    ABAP Mapping
    You can execute mapping programs in a sequence
    The exchange infrastructure supports three types of mappings:
    Message mappings that can be designed using a graphical mapping editor in the Integration Builder. As a result, Java code is generated from the graphical representation that is compiled before it can be executed on the integration server.
    You can implement your own Java mapping by implementing a specific interface of the mapping API.
    You can implement an XSLT mapping
    For the latter two, there is no tool support in XI. It is expected that they are developed using external development tools. To make them available for the integration server, they have to be imported into the integration repository as JAR
    files before (JAR: Java Archives).
    Developers can even decide to combine the different mapping technologies:
    Message mappings, XSLT mappings and Java mappings can be combined in a sequence by means of an interface mapping.
    XSLT mappings can use java functions
    Message mappings support user-defined functions that can use imported java packages of the same namespace.
    In SAP XI, there is 3 types of mappings. Namely
    XSLT Mapping
    Java Mapping
    ABAP Mapping
    Here is the details of each mapping.
    XSLT Mappings (ABAP Engine)
    Interface descriptions are in the form of XML documents. XSL Transformation (XSLT) is a member of the XML family of languages. It describes how an XML structure is transformed into another XML structure.
    Customers can develop an XSLT mapping by using the Transformation Editor of the ABAP Workbench. Such XSLT mappings are executed at runtime on the ABAP Engine of the Integration Server.
    To simplify matters, this section refers to XSLT mappings of the ABAP Engine as transformation programs to differentiate them from XSLT mappings from imported archives that are executed on the J2EE Engine.
    Features
    XPath and <xsl:include>
    You can define mappings using XSLT together with XPath. XPath is also a specification of the XML family. Using XPath you can address any node in an XML document. XSLT implements XPath expressions to select substructures of an XML document. Using templates in XSLT you can define the mapping rules for the selected substructures.
    You can use the XSLT tags <xsl:include> and <xsl:import> to include predefined templates for substructures in a complete mapping definition. In this way, you can reuse mappings for data types.
    Java Mapping
    You can implement mapping programs in Java. To process XML documents, use Java API for XML Processing (JAXP), for example. The JAXP supports the Document Object Model (DOM) and the Simple API for XML (SAX). This gives you great flexibility for mapping definitions with Java.
    Implementation Considerations
    Java mapping programs are not permitted to be stateful. You are therefore not permitted to perform actions such as writing data to a database table during a Java mapping. The Integration Server cannot track such side effects. Therefore, if an attempt is made to resend a message that has not been received by the receiver, the data may inadvertently be written to the database twice in a Java mapping.
    If you use JRE classes in your Java mapping programs then the same program restrictions apply as for Enterprise Java Beans (EJBs). For a detailed description of these restrictions, see the relevant EJB specification. It is important that you also refer to the information under Scope of Functions in Runtime Environment (Java Mappings).
    The runtime environment for Java mappings has an mapping API. To use Java mapping, you must define a Java class that implements the Java interface com.sap.aii.mapping.api.StreamTransformation. This interface has two methods:
    &#9679; public void execute(java.io.InputStream in, java.io.OutputStream out)
    At runtime, the Integration Engine calls this method to execute a mapping. This method contains an input stream for the source document and an output stream for the target document as parameters. These streams are usually XML documents. You can import the substructures to be converted from the input stream and output the converted target document in the output stream.
    &#9679; public void setParameter(java.util.Map param)
    The Integration Engine transfers parameters to the mapping program with this method. It evaluates these parameters at runtime in the method execute(). This enables you to control the process flow of the mapping.
    The transferred object that implements the Java interface java.util.Map contains seven key/value pairs as parameters. These correspond to corresponding fields in the message header. Apart from the MAPPING_TRACE constant, the value objects are of type java.lang.String. The key objects are defined in the class com.sap.aii.mapping.api.StreamTransformationConstants
    ABAP Mappings
    ABAP mappings are mapping programs in ABAP objects that customers can implement using the ABAP Workbench.
    Features
    An ABAP mapping comprises an ABAP class that implements the interface IF_MAPPING in the package SAI_MAPPING.
    Exception: CX_MAPPING_FAULT
    Applications can decide themselves in the method EXECUTE how to import and change the source XML document. If you want to use the XSLT processor of SAP Web AS, you can use the ABAP Workbench to develop a stylesheet directly (see XSLT Mappings (ABAP Engine)) rather than using ABAP mappings.
    Runtime Constants
    In ABAP mapping you can read access message header fields. To do this, an object of type IF_MAPPING_PARAM is transferred to the EXECUTE method. The interface has constants for the names of the available parameters and a method GET, which returns the respective value for the parameter name. The constants are the same as in Java mappings, although the constant MAPPING_TRACE does not exist for ABAP mappings. Instead, the trace object is transferred directly using the parameter TRACE of the method IF_MAPPING~EXECUTE
    Example: Accessing a Runtime Constant
    Method IF_MAPPING~EXECUTE.
    Get mapping constant SENDER_SERVICE
    data: l_sender_service type string.
    l_sender_service = param->get( IF_MAPPING_PARAM=>SENDER_SERVICE ).
    ENDMETHOD.
    These r excellent websites which contain PPT & PDF documents on mapping:
    Excellent PDF Document on Mapping
    http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
    Mapping Development with the ABAP Workbench
    http://help.sap.com/saphelp_nw04/helpdata/en/10/5abb2d9df242f6a62e22e027a6c382/content.htm
    ABAP Mappings
    http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm
    how to create a flat file out of an IDoc-XML by means of an ABAP mapping program and the J2EE File Adapter.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
    How to Use ABAP Mapping in XI 3.0
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
    Hope this will help you, and don't forget to close this thread.
    Regards
    Aashish Sinha
    PS : reward points if helpful

  • UDF for file to IDoc.

    Hi,
    I could like to create an UDF for file to IDoc secenario.
    Srouce:
    MTCashPosting_
    Header
    CashPosting
    PubDiv
    DocType
    DocDate
    PostDate
    RefDocNo
    HeaderTxt
    Customer
    Value
    Currency
    ExchangeRate
    Ledger
    Item
    Material
    TaxValue
    VAtValue
    Trailer
    Traget: (IDOC Type: FIDCCP02 Message Type: FIDCC2)
    FIDCCP02
    IDoc (Under FIDCCP02)
    Begin (Under IDoc)
    EDIDC40_:DISABLED
    E1FIKPF (Under IDoc)
    E1FISEG (Under E1FIKPF)
    Segment
    buzei
    bschl
    shkzg
    mwskz
    dmbtr
    hkont
    matnr
    "The secenario is the 'Value,TaxVAlue & VatValue' should be handled by replicating E1FISEG like (HAve used External definition for IDoc)"
    Value -> Line item 1
    IF TaxValue exists->Line Item 2
    IF VatValue exists-> Line item 3
    Finally Line item 4 for cerdit.All above are debit
    Value____________UDF______________E1FISEG
    TaxValue_________|
    VatValue_________|
    Value____________UDF______________DMBTR
    TaxValue_________|
    VatValue_________|
    How should I map?? Inputs plzzzzz

    Hi
    I am not sure whether my understanding is correct.
    As per my understanding
    You need to duplicate E1F1SEG segment 4 times as there are 4 conditions
    and those nodes need to be enabled or suppressed based on your condition .
    Regards
    sandeep

  • UDF for filename

    Hi,
    Please help me to write an UDF for getting filename dynamically in this format
    AF_DeliveryN_<CustomerIdentifier>_<ABAP-Spool-Number>_<datetime stamp>.xml.
    Regards
    Sai

    hi,
    AF_DeliveryN_<CustomerIdentifier>_<ABAP-Spool-Number>_<datetime stamp>.xml.
    mapping logic:
    AF_DeliveryN + constant(_) + Concat+ CustomerIdentifier + Concat + constant(_) + Concat+ ABAP-Spool-Number+ Concat + constant(_) + Concat+ datetime stamp(UDF)Conactconstant(.XML)+ ConactDynamic udftarget node
    ex for ADD time Stamp:
    String AddTimestamp(String var1, Container container) throws StreamTransformationException{
    String DATE_FORMAT_NOW = "yyyyMMddHHmmssSSS";
       Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
        return sdf.format(cal.getTime());
    dynamic conf for file:
    public String DynamicConfig(String a, Container container) throws StreamTransformationException{
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    conf.put(key,a);
    return "";
    thanks,
    Edited by: bhavanisankar.solasu on Jan 17, 2012 10:01 AM

  • Create UDF for table not in the List of tables

    Hi all,
    I know that my question maybe easy or been asked before, but I couldn't find the answer.
    To create a UDF in SAP B1 version 9.0 you should go Tools -> Customization Tools -> User-Defined Fields - Management...
    which is ok and working perfect. but my question is:
    If I want to create UDF for a table not in the list of tables there what should I do? I need to create 2 UDFs for table OMRC [Manufacturers], and can't find it in master data tables.
    anyone had this issue before?
    EDIT  : Is it good to add the field by using sql server? I know it's possible, but will it be visible in SAP
    thank you
    Message was edited by: Samira Haroun

    Hi Samira,
    There is noit a simple link for this, I advise you to study the documentation for TB1300 SBO Development Certification.
    Ypu should also have knowledge of .net, and C# or VB, because you have to make a small program/addon to add the fields
    Kind regards
    Ad Kerremans

  • Error "Lead selection not set for context node"

    Hi everyone,
    I've got a Tree control in WebDynpro ABAP and I've implemented an "expand all" button.
    Here's the coding:
    METHOD expand_node_rec.
      DATA lo_el_child TYPE REF TO if_wd_context_element.
      DATA lo_node_children TYPE  wdr_context_child_map.
      DATA wa_lo_node_children LIKE LINE OF lo_node_children.
      DATA lo_nd_child TYPE REF TO if_wd_context_node.
      DATA lo_kschl TYPE klschl.
      DATA lv_has_children TYPE boolean.
      lo_el_child = node->get_element( ).
      lo_node_children = node->get_child_nodes( ).
      node->get_attribute( EXPORTING name = 'KSCHL' IMPORTING value = lo_kschl ).
      node->get_attribute( EXPORTING name = 'HAS_CHILDREN' IMPORTING value = lv_has_children ).
      IF lv_has_children = abap_true.
        node->set_attribute( name = 'IS_EXPANDED' value = abap_true ).
      ENDIF.
      LOOP AT lo_node_children INTO wa_lo_node_children.
        lo_nd_child = wa_lo_node_children-node.
        me->expand_node_rec( node = lo_nd_child  ).
      ENDLOOP.
    ENDMETHOD.
    However I'm getting the error above: "Lead selection not set for context node".
    Any suggestions?
    Edited by: DEVELOPMENT THEMIS on Jul 7, 2011 6:34 PM

    hi developement Themis,
    I think u didn't diclare "node" as context node. So declare it as a context node before using as a context node..as below
    DATA node  TYPE REF TO if_wd_context_node.
    or u can use  "lo_nd_child " as ur context node in ur program in place of "node"
    then I think this error will be removed.
    thanks,
    simadri

  • I'm sorry for repeating this, but i have not found a clear answer. i have a macbook wit iTunes library, an iMac, and a time capsule. how can i transfer my itunes library from TC backup to the iMac? thank you -

    i'm sorry for repeating this, but i have not found a clear, step-by-step answer in several hours.
    i have a macbook with iTunes library, a new iMac, and a new time capsule. how can i transfer my itunes library from TC backup to the iMac?
    (sharing the iTunes library between the macbook & iMack requires both machines and seems silly ...)
    thank you -

    No.

  • Using animation as icon for JTree node

    Hi,
    I am using a custom tree cell renderer. I have a label in the renderer, the label have gif Image Icon, but the problem is it is not getting animated. But when I use a JLabel with gif icon some where else it is working fine, but it is not working for tree node.
    package com.gopi.utilities.gui;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.GridBagConstraints;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.TreeCellRenderer;
    import com.gopi.remfilebrowser.gui.GUIUtil;
    import com.gopi.remfilebrowser.util.FileBrowserConstants;
    public class CustomTreeCellRenderer implements TreeCellRenderer
         private JPanel panel;
         private JLabel label;
         private TreeCellRenderer defaultRenderer;
         public CustomTreeCellRenderer()
              super();
              panel = GUIUtil.createGridBagPanel();
              label = new JLabel();
              label.setHorizontalAlignment(JLabel.LEFT);
              System.out.println("New");
              GridBagConstraints gc = new GridBagConstraints();
              GUIUtil.fillComponent(panel,label);
              defaultRenderer = new DefaultTreeCellRenderer();
         public Component getTreeCellRendererComponent(JTree tree, Object value,
                     boolean sel,
                     boolean expanded,
                     boolean leaf, int row,
                     boolean hasFocus)
              if(value instanceof NewAbstractTreeNode)
                   NewAbstractTreeNode node = (NewAbstractTreeNode) value;
                   System.out.println("dr");
                   label.setText(value.toString());
                   label.setIcon(ImageLoader.getInstance().getIcon(node.getIconKey()));
                   if(hasFocus && sel)
                        panel.setBackground(FileBrowserConstants.TREE_NODE_SELECTED_COLOR);
                   else if(sel)
                        panel.setBackground(FileBrowserConstants.TREE_NODE_UNSELECTED_COLOR);
                   else
                        panel.setBackground(Color.white);
                   return panel;
              return defaultRenderer.getTreeCellRendererComponent(tree,value,sel,expanded,leaf,row,hasFocus);
    }

    JLabels using ImageIcons are designed to display the icon as is, including animation and all.
    A CellRenderer only paints the Icon once, when the cell is painted. Much ike a rubber stamp of the JComponent. Hence, its not designed to do the animation and all.
    If you really want it, you can probably use MediaTracker and a Timer to do your animation scheduling. Might not be very pretty code though
    ICE

  • Purchase Order Row UDF for Received Qty

    Hi experts,
    Can someone please recommend a way to create a row UDF for purchase orders to show the qty received? We cannot use a simple calculation like Qty-Open Qty because if the row is closed manually, the open qty becomes zero. Another problem is how to prompt the PO to update this value if additional GR PO's or AP Invoices are created. Thanks.

    I should explain the circumstances more clearly. There is no problem with the standard GR PO or AP invoice receiving method. What I want is a reference field on the original PO showing the total qty received to date. For example: total of 1,000 pcs ordered -> 900 pcs received against several GR PO's -> want to see that 900 has been received back on the PO. Then let's say we want to close the PO line 100 pcs short.
    I can think of 2 ways to go about this:
    Method 1: Change the ordered qty from 1,000 to 900 -> row is closed, but lose the reference of the original order qty being 1,000.
    Method 2: Close row manually and maintain the original order qty as reference, but lose b/o qty and it is difficult to tell how many pcs where received/closed short.
    Is there another way to keep all the reference information?

  • UDF for leading zero's in message mapping

    Dear team,
    I need UDF for leading zero's in my message mapping.
    Source and Target both structures contains matnr field.But we have to maintain total 18 chars at target matnr , because RFC in R/3 needed.So I want to add leading zero's when mapping. Can anybody provide the UDF code.
    Matnr[source]--->split by value(eachvalue) ->UDF->Matnr[Target]
    Ex::if source matnr conatains value "9846538" ; I need matnr value at target side like "000000000009846538"[total 18 chars].
    -Drumi

    Hi Ambrish,
    Good day...
    I have enterd what you said and I got below error... and I gave "input" in place of var1, 18 in place of filedlenght in below program...
    =================================
    int len = Integer.parseInt(18);
    int inputLength = input.length();
    try {
    Integer.parseInt(input);
    // If it is an integer, add 0 (len - inputLength) times
    for (int i=0; i< len-inputLength;i++)
        input = "0" + input;
    return input;
    } catch (NumberFormatException numForEx) {
    // return as it is, if alphanumeric
    return input;
    ====================================
    ERROR:
    Source text of object Message Mapping: Lubrisur_SHPMNT_SHPMNT05_TO_WMMBXY_WMMBID02_TransferPosting | urn:bp:xi:dwn:lu:common:Logistics:100 has syntax errors:
    Function LeadingZeros, Line 1:
    cannot find symbol symbol  : method parseInt(int) location: class java.lang.Integer int len = Integer.parseInt(18);                  ^ 1 error
    =======================
    Please suggest

  • UDF for JDBC lookup in PI 71

    I am facing some issue while importing the SQL meta-data from db2 in PI 7.1 , guess the db2 version is old and not compatible with 7.1 or could be problem with drivers, I want to go head with writing UDF for the jdbc lookup, can you please let me know  the code and how it can be written or blogs, thanks

    >>> can you please let me know the code and how it can be written or blogs, thanks
    You can try this link if you dont want to use graphical jdbc lookup... Follow this link , it has code to use ...
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    Also refer these links
    For 7.0 -  http://scn.sap.com/people/william.li/blog/2007/03/30/using-jdbc-connection-pool-in-xi-message-mapping
    For 7.1 http://scn.sap.com/people/jin.shin/blog/2008/02/15/sap-pi-71-mapping-enhancements-series-graphical-support-for-jdbc-and-rfc-lookups

Maybe you are looking for