UDF for Timestamp

Hi Friends,
Can anyone please provide me the UDF for the following case.I need my output file name in following format
156WE_YYYYmmddHHMMSS.xml
Thanks for quick help..
Regards,
Dinesh

Hi,
In the target file adapter, you can choose target file name as 156WE_.xml, then in next tab choose ADD time stamp. It will create a  output filename as 156WE_YYYYmmddHHMMSS.xml, if values till underscore is fixed.
Else you can use below code.
/* Using Dynamic Configuration */
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//conf.removeAll();
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
//String filename= conf.get(key);
conf.put(key, fileName);
key= null;
return fileName;
Refer link ---  http://wiki.sdn.sap.com/wiki/display/Snippets/SAPXIDynamic+Configuration
Regards
Aashish Sinha

Similar Messages

  • 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

  • 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

  • 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

  • Query to Lookup Ship To in a UDF for the Inventory Transfer

    Good Day Experts!
    I created a UDF for the Ship To Code in the Inventory Transfer Window.  The problem is I do not know how to create a query to be used in the Formatted Search for this UDF wherein it will lookup all the Ship To Codes in the table CRD1 of that particular  Customer selected in the Inventory Transfer window.  The objective is to choose a Ship to code just like in the sales document.
    My next problem would be how to display automatically the whole Ship To Address in another UDF based on the Ship To Code chosen in the UDF Ship To Code.
    Your inputs would be highly appreciated.
    Regards,
    Jen

    To get the Complete ShipTO Address, use the following Code
    SELECT T0.cardname+CHAR(13)+isnull(T0.Address,'')+CHAR(13)+
    cast(T0.Building as varchar(100))+CHAR(13)+isnull(T0.city,'')+CHAR(13)
    +isnull(T0.zipcode,'') as Address FROM CRD1 T0
    WHERE T0.CardCode =$[OWTR.CardCode] and  T0.cardtype='S' and
    T0.Address=$[OWTR.UDF1]
    Here Replace UDF1 with the Name of the UDF in which Shipto Address Names are shown as per my previous post.
    Hope you understand

  • Reg: UDF for removing values after decimals

    HI,
      Please help me on the below issue,
      I need an UDF for the follwing requirement,
    as my input value is 12354.12354875 then the result will be like 12345.123,
    After deceimal it should get only 3 values.
    Please help me points will be awarded.
    Edited by: UDAY on Apr 5, 2010 3:56 PM

    >
    UDAY wrote:
    > yes its needed to be truncated only not rounded.
    In that case even the standard function FormatNum can also help.
    Regards,
    Abhishek.

  • UDF for Changing File Name

    Hi Experts,
    I am working on one scenrio, where i am fetching the file name dynamically by adapter module.
    Now, the file name needs to be checked for the following conditions:
    BOOKING_REF_DELIVERYNO_WB.pdf
    BOOKING_REF_DELIVERYNO_BOLCOPY.PDF
    DELIVERYNO_AWB.PDF
    Depending upon the type of file being picked up by PI from the mail box,following needs to be done:
    1.time stamp needs to be added ..
    ex..
    for file SO10162239_123_458_BOLCOPY.pdf--> the file name must be changed to :
    SO10162239_X2100_20101206_123_458_BOLCOPY.pdf.
    Please suggest if this can be done by graphical mapping ?
    Thanks,
    Sushama

    hi,
    I am using following UDF..
    FileName->ParseFile>getNykFilename>concat--
    Current date->                                                                   concat> Trim> FileName
                               concat----
    |
    constatnt[.pdf]--->
    UDF for parse file:
    String[] sarray;
    String regex = "\"";
    String retstring;
    String fname;
    int l= raw.length();
    try {
         sarray = raw.split(regex, 3);
         retstring = sarray[1];
                            fname=sarray[l-1];
            if( fname=="WB")
    raw.concat("_X2100_");
    else if (fname=="BOLCOPY")
    raw.concat("_X2101_");
    else if (fname=="AWB")
    raw.concat("_X2102_");
    } catch (Exception e) {
         retstring = "no_att_name_found.err";
    return retstring;
    UDF for getNykFileName:
    String[] sarray;
    String regex = "[_]";
    String retstring;
    if(!orgName.endsWith(".err")){
    try {
         sarray = orgName.split(regex, 3);
         retstring = sarray[0];
    } catch (Exception e) {
         retstring = "nyk_filename.err";
    return retstring;
    }else{
         return orgName;
    But, its not working..
    Its giving the file name as:
    no_att_name_found.err20101206 for the input file : 801243209_81473641_wb.pdf
    Display queue result for parsefileName:
    "no_att_name_found.err"
    Please suggest.
    Thanks,
    Suahama

  • UDF  for this mapping rule

    Hi Friends,
         I have one difficult issue which have one mapping rule to write user defined function. I am sending mapping rule Please give me java coding to create udf for this mapping rule which is following below:
    CRFT.COSTR = M_ORD_01 and
    CRFT.CRID = CRHE.CRID and
    CRFV.FTNO = CRFT.FTNO and
    CRFV.ATNAM = ZPPI_ORDER_SCHED_EN_DATE
    And
    CRFT.COSTR = M_ORD_01 and
    CRFT.CRID = CRHE.CRID and
    CRFV.FTNO = CRFT.FTNO and
    CRFV.ATNAM = ZPPI_ORDER_SCHED_EN_TIME
    From ATWRT of ZPPI_ORDER_SCHED_EN DATE+ ATWRT of ZPPIORDER_SCHED_EN_TIME
    In format yyyy-MM-ddTHH:mm:ss
    using this mapping rule, ATWART field can map with target field "End Time" i think.
    Actually source field is CALCULATE but this field is not in Source structure
    target field is "End Time"  this field is in Target Structure.
    I will wait for ur response
    Thanks adn regards
    Sai

    Hi Jagadish,
    This RFC is CONTROL_RECIPE_DOWNLOAD
    in this RFC, i want to map ATWRT field to Target field "End Time" with mapping rule which i had already given.
    In Graphical mapping, i am doing . but i can not get it because mapping condition is difficult. if you have any idea in graphical mapping give me early
    before that i have to give explantion about this is  date value and time value passed through this ATWRT field as different records.
    i am doing as a condition ie  first i have taken date condition. from that condition, first two fields  CRFT.COSTER and M_ORD_01 has given to "equals" funtion     like that have done remaining fileds then the output of those "equals" functions given to "and" functions finally i get one output of "and" function.  while sending DATE values from RFC this output  of "and " function.
    Like this, for Time condtion i have done mapping same way and giving a TIME values from RFC as Second record then output of this "and" function while sending second record with time value.
    here mainly i am getting problem is .....
    here i am taking source field ATWRT( in this field i am sending date format adn time format as different records) with the outputs of the mapping conditons as input vaules of another function. i dont have any idea for another function why because is first date record should be wait until the time record comes in this function.after then both vaules should concat .
    now here whenever you send date value through this field ATWRT as first record and after satishfy the date condition form mapping rule,  The date value of ATWRT should go to input of concat function. next i will send time value like date value through ATWRT as second record . It should go to another input of concat function. Then here both date value and time value concat with T  and should be come output in the format  yyyy-MM-ddTHH:mm:ss and this will go to Target field "End Time".
    I will be wait for ur possitive reply
    thanks for giving response
    Thanks adn regards
    sai

  • 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 Special Character Conversion

    Hello All,
    Can any one help me with the UDF for special character conversion code.
    I mean if a special character is given it should pass a blankspace.
    << Moderator message - Everyone's problem is important >>
    Many thanks,
    Rahul.
    Edited by: Rob Burbank on Oct 29, 2010 4:32 PM

    Hi Rahul ,
    the best way to deal with special character is to use proper encoding in your Sender Communication channel it self .So that in your payload you will get proper value .
    IF you are getting some special character which is not covered in encoding UTF-8 thne you can use encoding IS0-8859-1 .You can easily refer in help that how to use encoding in your communication channel .
    Regards,
    Saurabh

  • UDF for Checking the field value

    Hi
    I want to check the whether the fiels conatins any value or not in mapping ... if not i want to raise the exception using the UDF
    DO any one have sample code for writing the UDF
    SV

    Hi SV
    what is your requirement first that should br clear.
    i am giving you two UDF
    1) i have written this uDF for string and comparing the field value XYZ
    2) i am entering a string and its returning aa string which starts from the index of your input fixed length
    int len = a.length();
    String res = "";
    String temp = "";
    if ( len >= 10)
    temp = a.substring(0,10);
    if ( temp.equals("XYZ"))
    res = temp;
    else
    res = "";
    return res;
    =======================================
    String fixed = "ABCD";
    String res = "";
    int index = -1;
    index = a.indexOf(fixed);
    if (index == -1)
    res = "NO INDEX FOUND";// or if u wanna set it as null res = "";
    else
    res = b.substring(index4,index12);
    return res;
    ===
    hope these may solve your problem
    Thanks
    Sandeep sharma
    If helpful reward points

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

  • Calling webservice in udf for inserting data into webservice

    Dear Experts,
          Please give me the drawbacks of using lookup function for inserting data. we are calling a webservice from the udf for inserting the data using a webservice.
    It is a file to jdbc usnig a soap lookup . we use this approach because we need to pass the response from webservice along with the error data to the jdbc.   is there any other way to do it without using bpm ?
        In the udf we are creating the xml structure for webservice and passing the parameters through arguments.
    is there a better approach for this ?
    Thanks,
    Aju

    Hi Aju,
    You can do it without BPM.
    Write UDF for Soap Lookup. Parse the response message from Webservice.  and map the required values to respective fields.
    See the weblog
    Webservice Calls From a User Defined Function.
    Negative point of this solution is that it will take some time to call Webservice and get response back from it.
    Kulwinder

Maybe you are looking for

  • I can't remove Firefox 8 from control panel?

    I update Firefox8 to 9.1, but upon looking in control panel still said I had Firefox 8. Also, I had automatic update enabled and it never updated, so I therefore put it to manual. I was having Java issues that weren't resolved with Firefox and have d

  • Chapter buttons work fine in preview but not in build

    Hi, I am using video as a back ground and overlaying buttons that highlight when selected. The button routing is fine, default button set up, no overrides and it works fine in preview, however when I build it to disk no buttons are highlighted, canno

  • How to load webParts from external assemblies ?

    Hi i'm facing the problem when loading webParts from external assemblies. i've a lot of searched on internet, but nothing found! also i create a thread on asp.net forum, but nobody answer! does something wrong or is there any way to accomplish this ?

  • How to download Lenovo Customized ESXi 6 for System x

    Trying to find where to download Lenovo Customized ESXi 6.0 for System x? You can find it on VMware's web site. In regard to VMware vSphere ESXi Operating System, some vendors add features and release customized install images. There are such for Sys

  • USEREXIT to update BSEG-BVTYP field through VF01 transaction

    Hi Folks ! I have a requirement where I have to update the Partner Bank Type(BSEG-BVTYP) field through the transction VF01. I tried with many exits like SDVFX008, RV60AFZC, RV60AFZZ and Includes like ZXVVFU01, ZXVVFU08, but unfortunately no results.