Message Mapping, filling field with 0 (zeros) on left

I need to fill a field with values that has variable lenght adding 0 (zeros) on the left, how can I do it ?
I'm using the LENGHT in message mapping, with value returned by LENGHT I use FIXVALUES to map the quantity of 0 (zeros) that I need to add in the field.
Somebody can help me with this problem ?
Thank's.

Hi Regis,
You can use the Arithmetic:FormatNum built-in function for this.
If you want to left-pad the number with zeros so that the length is always 10, then specify 10 zeros for the format, 0000000000.
This function takes formats based on java.text.DecimalFormat so you can see all of the possibilities at:
java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
Thanks,
Jesse

Similar Messages

  • How to map Idoc fields with external file

    Hi All,
    How to map Idoc fields with external file.
    I want to check the settings where Idoc fields are mapped with external file.
    Thanks in advance.
    Regards,
    Govind.

    If you have configured a fileport where on trigger of IDOC you are creating the file, you can look at the message type documentation and get the offset values for each field in each segment

  • Hiding fields with zeros or blanks in ALV using factory classes

    Hi all,
    I am using Factory Method for displaying ALV.
    And I want to hide all the fields with Zeros or Blanks.
    Any help wud be rewarded.
    Thanks
    Preeti

    Hi,
       Below is the code used to hide a particular field ,here it is MANDT.This code is put after the factory method.
       data: lr_columns type ref to cl_salv_columns.
        lr_columns = gr_table->get_columns( ).
        lr_columns->set_optimize( abap_true ).
       data: lr_column type ref to cl_salv_column.
      try.
          lr_column = lr_columns->get_column( 'MANDT' ).
          lr_column->set_technical( if_salv_c_bool_sap=>true ).
        catch cx_salv_not_found.                          
      endtry.
    Thanks.

  • Message mapping problem: BAPI with range table parameters

    A kind hello to all,
    I try to call the BAPI_ALM_ORDERHEAD_GET_LIST in a 4.70 system via RFC connector. The configuration already works with another BAPI. With this here I get message mapping exception:
    Trace level="1" type="T">com.sap.aii.utilxi.misc.api.BaseRuntimeException: RuntimeException in Message-Mapping transformation: Zielelement /ns1:BAPI_ALM_ORDERHEAD_GET_LIST kann nicht angelegt werden. Prüfen Sie, ob die XML-Instanz für die Ausgangs-XSD und die Zielfeldzuordnung die Anforderungen der Ziel-XSD erfüllt. at com.sap.aii.mappingtool.tf3.AMappingProgram.start
    (How can I switch the trace language to English easily? I try to translate:
    "BAPI_ALM_ORDERHEAD_GET_LIST cannot be created. Check if the XML instance meets the requirements for the output XSD and the destination field mapping meets the requirements of the destination XSD.")
    But the mapping test tool in the Integration Builder Design does not report any warning or error.
    My guess is that the problem lies in the parameter structure of the BAPI_ALM_ORDERHEAD_GET_LIST: I have to fill the IT_RANGES selection range table, so it looks as if I need several instances of the item in the corresponding XML. Can I use "Duplicate tree" in the mapping editor? Here I got another exception?
    Many thanks for any help!
    Regards,
    Carsten

    Hi Udo,
    you gave the final hint, indeed I used a XML file that was not evidently not compliant to the message type I created (even though it had been validated by Altova XMLspy).
    From now onwards I only use the "Create instance" function of the test tool to create the XML body of my test messages...
    Thanks a lot,
    and best regards,
    Carsten

  • Mapping of field with MinOccurs 0 in SAP XI 2.0 SP5

    Hi,
    Our Scenario is
    File -> Adapter -> XI -> Idoc Adapter -> SAP
    We are trying to push IDoc and the mapping tool is giving an error. I am providing the error that I am getting.
    The snippet of the XSD for the IDoc is given below:
       <xsd:element name="E1FIKPF" minOccurs="1" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                            <xsd:annotation>
                               <xsd:documentation>FI Document Header (BKPF)</xsd:documentation>
                            </xsd:annotation>
                            <xsd:complexType>
                               <xsd:sequence>
                                  <xsd:element name="BUKRS" minOccurs="0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                                     <xsd:annotation>
                                        <xsd:documentation>Name of global company code</xsd:documentation>
                                     </xsd:annotation>
                                     <xsd:simpleType>
                                        <xsd:restriction base="xsd:string">
                                           <xsd:maxLength value="6" />
                                        </xsd:restriction>
                                     </xsd:simpleType>
                                  </xsd:element>
                                  <xsd:element name="BELNR" minOccurs="0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                                     <xsd:annotation>
                                        <xsd:documentation>Accounting Document Number</xsd:documentation>
                                     </xsd:annotation>
                                     <xsd:simpleType>
                                        <xsd:restriction base="xsd:string">
                                           <xsd:maxLength value="10" />
                                        </xsd:restriction>
                                     </xsd:simpleType>
                                  </xsd:element>
                                  <xsd:element name="GJAHR" minOccurs="0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                                     <xsd:annotation>
                                        <xsd:documentation>Fiscal Year</xsd:documentation>
                                     </xsd:annotation>
                                     <xsd:simpleType>
                                        <xsd:restriction base="xsd:string">
                                           <xsd:pattern value="\d+" />
                                           <xsd:maxLength value="4" />
                                        </xsd:restriction>
                                     </xsd:simpleType>
                                  </xsd:element>
                                  <xsd:element name="BLART" minOccurs="0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                                     <xsd:annotation>
                                        <xsd:documentation>Document type</xsd:documentation>
                                     </xsd:annotation>
                                     <xsd:simpleType>
                                        <xsd:restriction base="xsd:string">
                                           <xsd:maxLength value="2" />
                                        </xsd:restriction>
                                     </xsd:simpleType>
                                  </xsd:element>
                                  <xsd:element name="BLDAT" minOccurs="0" type="date" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                                     <xsd:annotation>
                                        <xsd:documentation>Document Date in Document</xsd:documentation>
                                     </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="BUDAT" minOccurs="0" type="date" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                                     <xsd:annotation>
                                        <xsd:documentation>Posting Date in the Document</xsd:documentation>
                                     </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="MONAT" minOccurs="0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                                     <xsd:annotation>
                                        <xsd:documentation>Fiscal Period</xsd:documentation>
                                     </xsd:annotation>
                                     <xsd:simpleType>
                                        <xsd:restriction base="xsd:string">
                                           <xsd:pattern value="\d+" />
                                           <xsd:maxLength value="2" />
                                        </xsd:restriction>
                                     </xsd:simpleType>
                                  </xsd:element>
    In this snippet as can be seen the minOccurs for the BUKRS field is 0. But if I do not map the field its giving me following error.
    /usr/java131/bin/javac -encoding UTF8   -classpath .:./system-lib/boot.jar:./system-lib/jaas.jar -extdirs ./additional-lib:./services/deploy/work/applications/ExchangeRepository -d /tmp/9_53_35_27_7_2004 /tmp/9_53_35_27_7_2004/com/sap/xi/tf/_MsgMapGcentre2Fidcc2_.java
    /tmp/9_53_35_27_7_2004/com/sap/xi/tf/_MsgMapGcentre2Fidcc2_.java:303: ';' expected
    a117.gotoNextContext();tmpValAtr = a117.getValue();if (!tmpValAtr.equals(SUPPRESS)) handler.addAttribute("SEGMENT", tmpValAtr);a117.gotoNextValue();if (!__deflt)a115.gotoNextValue();No mapping for value/FIDCCP02/IDOC/E1FIKPF/BUKRS
                     ^
    /tmp/9_53_35_27_7_2004/com/sap/xi/tf/_MsgMapGcentre2Fidcc2_.java:303: cannot resolve symbol
    symbol  : class No 
    location: class com.sap.xi.tf._MsgMapGcentre2Fidcc2_
    a117.gotoNextContext();tmpValAtr = a117.getValue();if (!tmpValAtr.equals(SUPPRESS)) handler.addAttribute("SEGMENT", tmpValAtr);a117.gotoNextValue();if (!__deflt)a115.gotoNextValue();No mapping for value/FIDCCP02/IDOC/E1FIKPF/BUKRS
    ^
    2 errors
    Compilation error
    Any one having any guesses on why this error is coming. I know this error would vanish if we map the field by an Empty Constant. But then it would start giving error for the next field until all the non mandatory fields are mapped.
    If however I go ahead and map all the fields then the output structure generates all the segments the maxOccurs times. i.e. if a segment is occuring 999 times then that segment is repeated that many time in the output whereas I never needed that segment in the output.
    Can any one suggest as to why this is happening. Am I doing some thing wrong or this is a problem with Mapping Editor in XI 2.0 SP5.
    Ashish

    Hello Ashish,
    this is a bug in the mapping tool. You have to apply the note  730081. It says:
    Symptom                                                                           
    After you import XI20 Support Package 04 or Support Package 05, you can           
    no longer change and regenerate the message mapping (graphic mapping              
    tools).                                                                           
    The following error is displayed during activation or generation: No              
    Mapping for value.......                                                          
    Other terms                                                                       
    Graphic mapping tools, SAPINTSER05, no mapping vor value                          
    Reason and Prerequisites                                                          
    This problem is caused by a translation error.                                    
    Solution                                                                          
    The translation error has been corrected.                                                                               
    As of patch level 1, the correction is provided in the SAPINTSER05_1.sca          
    archive of the INTEGRATION Services 2.0 software component and, as of             
    patch level 2 for Support Package 5, it is provided in the                        
    SAPINTBUI05_2.sca archive of the INTEGRATION BUILDER 2.0 software                 
    component. The archives are available on the SAP Service Marketplace at:                                                                               
    http://service.sap.com/patches                                                                               
    SAP EXCHANGEINFRASTRUCTURE/SAP EXCHANGEINFRASTRUCTURE 2.0                         
    Binary Patches/INTEGRATION SERVICES 2.0/OSINDEP and                               
    ..... /INTEGRATION BUILDER 2.0/OSINDEP                                            
    Import the archives using SDM.                                                                               
    The mapping must be recompiled after deployment.                                                                               
    Regards Franz

  • Message Mapping Help XMLDocument with in XML

    I am trying to pass on some XMLDocument with in XML
    Example
    <Header>
    <Detail><Text1>Text</Text1><Text2>Text</Text2></Detail>
    </Header>
    Message mapping giving error at present. My Message Type has only the following
    <Header>
    <Detail>
    I am trying to include <Text1>Text</Text1><Text2>Text</Text2> with in Detail section. Not sure how to handle this with Message Map. Please explain if there is any possibility to achieve something like this

    Hi,
    You can directly use CDATA in message mapping and can solve this.
    /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
    Else you can use xsl mapping as mentioned in this thread:
    Re: CDATA in xml file
    You can also try java mapping as mentioned here:
    XML inside a field in XI
    If you can give complete source payload, source message type and target message type then somebody here can help you out.
    Regards,
    ---Satish

  • Message Mapping : Set Field Name at Runtime

    Hi All,
    Source structure of my message is :
    <recordset>
    <Query></Query>----
    0 to unbounded
    </recordset>
    Target Structure :
    <SQL>
    <key></key>----
    0 to unbounded
    </SQL>
    Now my requirement is such that....if the source message has 3 Query elements then XI should generate key node in target message 3 times but with names key1,key2,key3.
    I am not able to set the names of these target nodes at runtime based on the number of query elements in source message.
    Can anybody please help me?

    HI,,
    YOu can not change the names of your "Fields".
    Hi,
    If you want to change Value you can do that by writing UDF.
    Enter this code in UDF.
    for(int i=0;i<a.length();i++)
    result.addValue("");
    Regards,
    Akshay Jamgoankar.
    Reward points if find useful.>

  • Filtering records in message mapping by field value

    hi,
    i have a source message:
    record: 1..1
    --row: 0..unbounded
    type: 1..1
    data: 1..1
    i want to map to target message with the same structure only rows with type = x.
    how do i do that in message mapping?
    thanks
    Tomer

    if u mean that the target message shud be generated only when type = x use the below mapping.
    type------------->
                        equalsS----->createif--->row(tgt root)
    Constant[x]--->
    Map
    type--->type
    data--->data

  • Show NUMC Type Field with Zeros in SE16

    Hi.
    Is there any way to show a field of numc type (length 9) with zeros when is shown in SE16???

    Hi
    I am not clear with your question?
    Just check the table entries in VBAP
    fields VBELN  which is of CHAR 10 and
    POSNR which of NUMC 6
    For both the fields the leading zeros are displayed in SE16
    just check it.
    so what's your question?
    Reward points if useful
    Regards
    Anji

  • Fill fields with actual date / timestamp with button

    Hello,
    I did not find an answer for my following problem.
    I want to put a button my adobe form that fills automactically three fields with data from the PC which are:
    actual time (of the PC and of course timezone info), date and username, so the User has to press one button to fill all these data for convenience. 
    So I think it is necessary to program this in JavaScript as an "on-click" action. Since I'am not too much familiar with this, it would be great if someone can post a little sample coding for this (or has some other tipp).
    regards and happy xmas
    Jörg

    you must have target fields for your Date, Time and Username, for example you have a structure in your data view called "ZINFO" with the fields "EDATE", "ETIME","ENAME"
    in your layout you need a button where you click on
    in the click event you can fill your fields (formcalc)
    xfa.resolveNode("xfa.record.ZINFO.EDATE").value = Num2Date(Date(), "DD/MM/YYYY");  
    xfa.resolveNode("xfa.record.ZINFO.ETIME").value = Num2Time(Time(), "HH:MM:SS", "de_DE");
    so you always get time/date when clicking
    but how do you know who has opened the form?? did you realize some password protection??
    br norbert

  • Multiplot graph with missing values fills them with zero instead of NaN

    I have a waveform graph with multiple arrays (2D) which has different numbers of points in each array.  LabVIEW finds the array with the most points and then plots all arrays with that many points.  It assigns the missing points a value of zero and displays those zero values.  This means arrays with fewer points than the maximum will have values of zero appear in their plots.  This can be avoided by filling in missing points with NaN.  I am acquiring data in a loop and displaying it which requires continuous determination of the number of actual points and filling in of missing points with NaN.  Not difficult, but this could be avoided if LabVIEW would fill missing points with NaN instead of with zero.  Any way to have this happen automatically ?
    Steve
    Attachments:
    Graph MultiPlot Missing Data.vi ‏18 KB

    You can also consider using an XY graph so you don't have to do additional data manipulation. See attached for comparison.
    Attachments:
    Graph MultiPlot Missing Data mod.vi ‏22 KB

  • Mapping problem:filling field with 0 (zeros) in material number

    I want to create a mapping like the ABAP function:
    CONVERSION_EXIT_MATN1_INPUT
    for example:
    1 => 000000000000000001(add zeros if input value is
    numeric)
    Z => Z(no change if input is not numeric)
    The standard function "formatnum" works well from 1 => 000000000000000001.But it causes a java exception from Z => Z.
    How to solve it?
    Must i develop a UDF?
    thanks

    if i understood your requirement, you need to do padding(left) for your input. In that case use this UDF to help you out;
    int len = 10 ; // the maximum length of the field in your target.
    StringBuffer sBuf= new StringBuffer(a);
    while (sBuf.length() < len) {
    sBuf.insert(0,'0');
    return(sBuf.toString());
    Message was edited by:
            Shabarish Vijayakumar

  • How to fill field with test data in alv grid display

    hi all,
    i m adding field TEXT to the structure for displaying grid.
    i m modifying program like this
    DATA: ALV_OUTPUT  LIKE HRPDV_EXPIRED_Q OCCURS 0 WITH HEADER LINE.
    TYPES : BEGIN OF FS_OUTPUT .
          TEXT(20) TYPE C.
            INCLUDE STRUCTURE HRPDV_EXPIRED_Q.
    TYPES       TEXT(20) TYPE C.
    TYPES    END OF FS_OUTPUT.
    DATA: fs_output like table of alv_output.
    CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'TEXT'.
      WA_FIELDCAT-seltext_l = 'Abteilungs Struktur'.
      wa_fieldcat-tabname   = 'ALV_OUTPUT'.
      WA_FIELDCAT-COL_POS  = '13'.
      APPEND WA_FIELDCAT TO P_GT_FIELDCAT.
    this is what i have write for diapalying field. but my question is how to fill test data with field TEXT.I m writing like this but not executed in the aboove grid dispaly statement.
    loop at alv_output.
    *alv_output-text(20)  = 'abcdefgh'.
    *modify alv_output.
    *endloop.
    plz tell me how to fill test data

    hI..,
    Your table declaration has to be like this..
    TYPES : BEGIN OF FS_OUTPUT .
    INCLUDE STRUCTURE HRPDV_EXPIRED_Q.
    TYPES TEXT(20) TYPE C.
    TYPES END OF FS_OUTPUT.
    DATA: ALV_OUTPUT LIKE standard table of fs_output initial size 0.
    loop at alv_output <b>into fs_output</b>.
    <b>fs</b>_output-text(20) = 'abcdefgh'.
    <b>modify alv_output index sy-tabix from fs_output transporting text.</b>
    endloop.
    Now give this table alv_output to the GRID_DISPLAY function module..
    you will get the required output !!
    Plz do remember to close the thread when ur problem is solved !!
    reward all helpful answers !!
    regards,
    sai ramesh

  • PI Message Map - useOneAsMany issue with more than 10 lines.

    I am having an issue using 'useOnAsMany' .  I am using this to map lines of text from an idoc, specifically the SHPMNT04 idoc.  When there are more than 10 lines of text (i.g. 10 occurances of E1TXTP8) the sytem drops everything after the 10th line.  When I check the context of the fields it appears all occurances are being mapped however when I execute the map it drops the text after the 10 line.  Is this a bug?  Has anyone seen this and know of an answer?
    I am using 'useOneAsMany' with E1TXTH8-TDID as the first argument and E1TXTP8-TDLINE as the second and third arguments.  I am simply moving all the text when TDID = Z001.

    Hi Busse,
    Can you check the occurence of the target field to which you are mapping? If it is 0..10 then you will only 10 lines in outupt, else it should get populated.
    Regards,
    ---Satish

  • Message Mapping delete Field

    Hello,
    i want to delete a field in the target structure.
    Like you do it with disable.
    for example
    when in the source field the value is empty i want to disable the target field.
    But when there is a value, i want to map this value into target field.
    how i have to handle that?
    regards,
    robin

    Hi,
    Use Create If in mapping. i have documented for my requirement. and apply the same logic in your case also.
    If the field CHARG is don’t have any value in the source means , we shouldn’t produce the Target Element . Then we used the Create If logic. If the Field have the value from the source means we have to produce it at target side , otherwise we have to collapse it.
    See this Screenshot
    http://img258.imageshack.us/img258/8830/createifjo4.jpg
    Regards
    Seshagiri

Maybe you are looking for

  • How can I get the coordinate in the layer coordinate system while doing the iterate?

    I found that the position(x,y) the iterate function tell me is not right sometimes. Actually,it happens when the top of the layer is negative. The "y"is in the comp coordinate system(maybe?) but not the layer.In another word, the position with y=0 is

  • Turned on for the 1st time but don't want 2 se up yet

    Ok, so this is a dumb question but i just got my macbook pro about 30min ago and don't want to mess anything up! I already plugged it in to charge and i turned it on and its ready for the set up process but i cant do it until i get home. is there a w

  • How to move further from Core JAVA.

    Hi, I have studied Core JAVA upto multithreading. And currently as S/w Quality Engineer, I am working on JUnit Tests in Spring Framework from last 2 months. Now, I want to switch into development, and for the same I want to learn more in JAVA. Please

  • Rosetta - query re message displayed during installation

    I recently installed OS 10.6 on my iMac and then upgraded to 10.6.4 using the combo update. Everything worked properly except for two old games which reported that they required Rosetta. I installed Rosetta from the OS 10.6 Disk and during that proce

  • Sun cluster/metaset

    I have two E450's connected to a D1000, have install Solaris 9 with patches and installed Sun cluster 3.2. Both 450's are in the cluster and can see the D1000. With the drives on the D1000, setup area for meta database on slice 7 starting from block