Padding a value with zeros

Hi,
I am trying to pad a field with leading zeros during mapping.  I am going from an IDOC to a flat file.  Is there a function in the message mapping of XI that will help me do this?
For example: the value of "91423" is passed in to a field of length 10. i want the value to look like this on the flat file  "0000091423".
Is this possible?
Thanks,
Nate

Hi Nathan,
yes this is possible:
one way - create a user defined function
with one input value (your field)
and check it's length and add (10 - length) zeros
second way - without user defined function
and use length and concat functions (build into graphical mapping functions) and if statement
if length  = 9 then string concat 0
else if length = 8 then string concat 00 ...
the first way it better but if you don't want to use java you can use the second one
Regards,
michal

Similar Messages

  • Pad a string with zeros ?

    Hello ABAP Experts,
    How to pad a string with zeros.. is there a direct method i can use.
    eg:
    string length is 8
    string is custnumb
    value is 588
    but i would like to see 00000588
    please suggest.

    You can simply move it to a TYPE n field also.
    data: n(8) type n.
    data: custnumb(8) type c value '588'.
    n = custnumb.
    custnumb = n.
    Regards,
    Rich Heilman

  • Padding a value with leading zeros

    Hi
    I am trying to create a filename (String) using a sequence int. I need this int to be 6 digits, with leading zeros
    i.e. if my seqence number is 23 my filename (String) should be:
    FILE000023
    Obviously I can do this by creating my own method that iterates through the number, but I was wondering if there was a simple method to change an int to a String and pad it out with leading zeros.
    Thanks
    Neil.

    import java.text.*;
    public class DecimalFormatTesting {
         public static void main( String[] args ) {
              DecimalFormat format = new DecimalFormat("###.###");
              format.setMinimumIntegerDigits( 6 );
              String integ = format.format( 123 );
              System.out.println("str: " + integ);
         } // end of main()
    }hope this helps
    partha

  • BEx Analyzer: Display values with Zero data

    Hi,
    I urgently need to know something about BEx QD/Analyzer:
    If I drilldown e.g. Customer into the rows, it only shows me those customers for which there are values in place. However, I need to see all Customers, i.e. also the ones where the values are zero.
    How can I do this in Bex Analyzer or if needed BEx QD.
    Thanks
    Sabine

    Thanks,
    but it won't be possible to create a multiprovider just for that.
    Maybe I wasn't clear enough
    If a have Customer A, Cust B and Cust C and I drilldown by customer in the rows, then the system only shows me Cust B and Cust C, because for a there has been e.g. no turnover in one specific month.
    But in the drilldown in the report, I still want to see Cust A as well, even though the value is zero. So I should just see an empty line (instead of the key figures for Cust A).
    Guys, that must be possible!! Help me
    Sabine

  • Positive Value with Zero Stock

    hi Experts
    I noticed while doing a stock audit report that I had a positive value of £35.00 for a item code where the stock level was zero.   How can I get the amount down to zero too?  Stock Revaluation won't work because there is no stock and any in/out stock transaction simply result in outstanding amount of £35.00. 
    We are using FIFO for value .   I would also be interested to know how I can query other items with this issue?
    thanks
    Geoff
    Edited by: Geoff Lord on Jul 8, 2011 5:26 PM

    Hi Goeff.......
    If the stock of the item is zero and still it shows the item cost then this means nothing.
    It does not affect anything in system.
    The moment you book GRN the purchase value will be overrite on it. It only shows for display as last price......
    You can try a purchase in demo DB and then run the Audit report you can find the difference.......
    Regards,
    Rahul

  • Padding character fields with zeros

    Hello,
    I need to add zeros to the end of character fields TYPE C. I know i can use the conversion routines but that only works for numeric fields.
    Thanks

    Thanks for all the replies.
    STRLEN will give me the lenght of the field but i need the offset of the last chararcter.
    Your post gave me an idea though. I'm doing the following and it's working.
    value = 'Thank You          '.
    tmp    = '00000000000000'.
    FIND REGEX `\w[ [:space:] ][ [:space:] ]` IN value MATCH OFFSET moff.
    IF SY-SUBRC = 0.
       OVERLAY value+moff WITH tmp.
    ENDIF.
    The find looks for the last alphanumeric char and 2 spaces after it meaning the last alphanumeric char in the string.
    Thanks to all, i will reward as fairly as possible.

  • Replace blank column values with ZERO

    Hi experts,
    I am building a report to display count of orders split by channel per day per hour.
    For some days one or few channels might not have any orders placed against them in which case my report shows blank values in the report.
    I would ideally like to have Zero in those columns rather than an empty cell.
    Sample Qry :-
    Select
    Channel,
    COUNT(order_num) as COUNT
    FROM
    SALES_ORDER
    Pls help !
    Thanks in advance.

    Try this code
    /* Formatted on 2009/05/11 07:53 (Formatter Plus v4.8.8) */
    SELECT   a.CLASS, a.order_date, a.time_created,
             NVL (a.count_orders, 0) AS count_orders
        FROM (SELECT   sales_order_header.soh_class AS CLASS,
                       TO_CHAR
                              (sales_order_header.soh_date_created,
                               'dd/mm/yyyy'
                              ) AS order_date,
                       SUBSTR
                          (TO_CHAR (sales_order_header.soh_time_created,
                                    'HH24:MI:SS'
                           1,
                           2
                          ) AS time_created,
                       COUNT (sales_order_header.soh_order_no) AS count_orders
                  FROM com.sales_order_header
                 WHERE sales_order_header.soh_date_created >=
                                             TRUNC (NEXT_DAY (SYSDATE, 'SUN'))
                                             - 14
                   AND sales_order_header.soh_date_created <
                                              TRUNC (NEXT_DAY (SYSDATE, 'SUN'))
                                              - 6
              GROUP BY sales_order_header.soh_class,
                       TO_CHAR (sales_order_header.soh_date_created, 'dd/mm/yyyy'),
                       SUBSTR (TO_CHAR (sales_order_header.soh_time_created,
                                        'HH24:MI:SS'
                               1,
                               2
              UNION ALL
              SELECT   sales_order_header.soh_own_id AS CLASS,
                       TO_CHAR
                              (sales_order_header.soh_date_created,
                               'dd/mm/yyyy'
                              ) AS order_date,
                       SUBSTR
                          (TO_CHAR (sales_order_header.soh_time_created,
                                    'HH24:MI:SS'
                           1,
                           2
                          ) AS time_created,
                       NVL
                          (COUNT (sales_order_header.soh_order_no),
                           0
                          ) AS count_orders
                  FROM com.sales_order_header
                 WHERE sales_order_header.soh_date_created >=
                                             TRUNC (NEXT_DAY (SYSDATE, 'SUN'))
                                             - 14
                   AND sales_order_header.soh_date_created <
                                              TRUNC (NEXT_DAY (SYSDATE, 'SUN'))
                                              - 6
              GROUP BY sales_order_header.soh_own_id,
                       TO_CHAR (sales_order_header.soh_date_created, 'dd/mm/yyyy'),
                       SUBSTR (TO_CHAR (sales_order_header.soh_time_created,
                                        'HH24:MI:SS'
                               1,
                               2
                              )) a
    ORDER BY a.order_date DESC, a.CLASS ASC

  • Dimension Values With Zero Results

    Hi All,
    We are integrating Endeca Search with a J2EE application . We need to display all the dimension values on the left hand side.
    The dimension values are displaying based on results.
    How to show all dimension values even if no results will be returned.

    Create 2 queries one for getting results and for getting dimensions.
    Check for number of records for first query .say (for N=1234 numofrecords returned are 0 )
    So create a second query with N=0 and fetch only the dimension not the records. In this way you will have dimension values if 0 results are returned

  • Pad a field with a substring

    I need to pad these fields with zero after the substring.  How do I do that?
    Current items is:
    drvLocCode
    =
    case
    when
    Substring(EecLocation,
    1, 2)
    =
    '28'
    and
    len(EecLocation)
    = 5
    then
    Substring(EecLocation,
    3, 3)
    when
    Substring(EecLocation,
    1, 2)
    =
    '28'
    and
    len(EecLocation)
    = 6
    then
    Substring(EecLocation,
    3, 4)
    when
    Substring(EecLocation,
    1, 1)
    =
    'P'
    and
    len(EecLocation)
    = 6
    then
    Substring(EecLocation,
    2, 5)
    end

    Here's a simple example:
    SELECT LEFT('myString'+REPLICATE('0',10),10)
    We're literally adding 10 0s to the end of the string, and then taking the 10 left most characters.
    So, for your example:
    drvLocCode = LEFT(case when Substring(EecLocation, 1, 2) = '28' and len(EecLocation) = 5 then Substring(EecLocation, 3, 3)
    when Substring(EecLocation, 1, 2) = '28' and len(EecLocation) = 6 then Substring(EecLocation, 3, 4)
    when Substring(EecLocation, 1, 1) = 'P' and len(EecLocation) = 6 then Substring(EecLocation, 2, 5) end+REPLICATE('0',10),10)

  • Items with  zero stock quantity show negative stock value in Stock reports

    When running Stock reports for controlling the stock value towards the GL accounts, some items appear with zero stock quantity, but the report still shows a stock value  (negative value in my case)
    How can this happen, and how can I correct this situation ?
    System parameters are :   negative stock is not allowed, Items with zero cost price not allowed. On item level average cost price method is used.
    P.K.Johnsen

    Hi Johnsen,
    I believe you have checked the" Manage Inventory by warehouse". I have noticed this issue in SAP B1 2005B but this is rectified in 2007B. The system behaves in this way as the system maintains item cost for the item for all warehouses and even if the stock is not present in the warehouse, the system would still show you a value for the same. Hope this helps. please search the forum. You'll find related threads.
    Thanks,
    Joseph

  • Excise invoice posted with Zero duty value

    Hi,
    My client has an STO process where they will generate a proforma Invoice with Excise duties,
    Initially when proforma was created excise duties were not reflecting since condition records were not maintained, user was not aware of that and created a excise invoice also with 0 Duty value.
    After this condition records were maintained and invoice was updated with excise values. But we are unable to update the excise tables through the same excise invoice no. This transaction is a back dated one for which client has already filed excise returns with SAP Excise number series, Can we pass a JV through FI to adjust the entries or any other solution.
    Regards,
    Zehran.

    Client has done PGI with ZERO quantity
          also done billing
    if i go to cancel that cancel invoice in J1IIN
         it is not allowing to cancel
    If your copy control is in line with standard settings, first of all you cannot post the goods issue without any quantity and also generation of billing is not possible.
    Coming to your second issue, please try in J1IH instead of J1IIN.
    thanks
    G. Lakshmipathi

  • Assign hexadecimal value to an Integer variable preceding with zero

    hi
    i need to pass an hexadecimal value, preceding with zero (0).
    like 0775
    the above hexadecimal value should be assigned to an integer variable. While i am trying to assign it, the output could be truncate the preceding zero value. Is it possible to do my requirement without truncating the preceding zero.?
    Edited by: sasi on Jul 23, 2012 7:09 PM

    I agree on that, this can not be carried out the way you explained.
    Either you store the hexadecimal value as a string, and convert it before arithmetic operations:
    int number = Integer.parseInt("0775", 16);
    Or you store it as an integer (no leading zero) and convert it to string as you display it:
    int number = 0x0775;
    System.out.printf("%1$04x", number);

  • PO with zero value.

    Hi,
    My client requirement is to create a Purchase order with zero price, But as per SAP standard system will not allow to process a PO with net price = 0. How to sort out this scenario.
    Note: Free indicator cannot be used for this scenario for some purpose.
    Pl suggest.
    Regards,
    RitiG

    Hi,
    The scenario where POs are raised for zero value exists in many companies, the items may be free of charge samples or replacements for damaged stock, or simply free gifts.
    As Yogesh corectly pointed out this can be done if the "invoice " indicator is unflagged on the PO item.
    One further comment though, it is up to the person posting the question to decide if it has been fully answered and also it is up to them to decide if they WANT to award points.
    Steve B

  • PO with Zero value in SRM

    Dear All;
    We are using SRM7.0 with classic scenario i.e shopping cart is created in SRM and PO is triggered in SRM but created in ERP.
    Sometimes, the buyer gets a shopping cart with several lines. After negotiation with the supplier, he agrees (the supplier) to give one of the items as free.
    While converting SC to PO in SRM, the system asks to  enter a price so that PO can be created in ERP. Then the buyer has to put 1 then goes to the ERP and tick the free indicator flag.
    Is there a way to create a PO with Zero value from SRM?
    Thanks

    Hi ,
    After the price is entered in the PO in SRM  , delete the price conditions in the conditions tab at the item level in SRM . This will mark the free goods tick in the ECC automatically .
    This works in our extended classic system .
    -Hari.

  • Extra accouning line item in billing document with zero value

    Hi,
    I am using TAXINN procedure, the following accounting document has been generated during billing.This accounting document contains an extra line item with zero value.
    However, There is no necessary for this line item with zero value. Can you tell me how to remove this line item?
    000       50          VAT Payable                       A0             0.00
    001       01          Sale within state                 A0      1,212.00
    002       50          Sales f/goods-Dome.          A0      1,000.00-
    003       50          ED Collected Clr.                 A0          160.00-
    004       50          ED Collected Clr.                 A0              3.00-
    005       50          ED Collected Clr.                 A0              2.00-
    006       50         VAT Payable                      A0            47.00-
    Thanks,
    Kanhu

    Hi
    Check if there is any summarization active for billing documents generated through SD. The path for the same is:
    IMG>Financial Acxounting>General Ledger Accounting>Integration>Sales & distribution
    Check for table VBRK
    Regards
    Sanil  K Bhandari

Maybe you are looking for