Regarding zppending zeroes in ABAP.

Hi,
How can I code followng in ABAP ?
If the length of field (ZDCM-ZIPCODE) is less than 5 digits, then append zeros at beginning so that length becomes 5 digits.
Ex: If we have 45 then it should become    00045
      If we have 1 then it should become      00001
      If we have 3478 then it should become 03478
Regards,
Rajesh

Here is an easy way.  Simple move it to a numeric with a length of 5 and then move it back to ZIPCODE.
data: n(5) type n.
n = ZDCM-ZIPCODE.
ZDCM-ZIPCODE = n.
Regards,
Rich Heilman

Similar Messages

  • Leading zeroes in ABAP

    How to remove leading zeros in ABAP?

    shift <field> left deleting leading '0'.
    U write ur code like this
    data a(9) value '000012345'.
    SHIFT a LEFT DELETING LEADING '0'.
    write:/ a.
    Output will be : 12345
    Or use this method also
    data a(9) value '000012345'.
    Call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
    Exporting
    input = a
    Importing
    output = a.
    write a.
    output:
    12345.
    Thanks and best of luck
    Reward if useful
    Ankesh

  • Adding leading zeros in abap objects.

    Can anyone explain me
    1. How to add leading zeros to a field in abap objects.
    For eg:
    data: dmb(6) type c value '123456',
    actually the output value of c should have leading zeros added to it for length 16.
    i.e '0000000000123456' . If the length of dmb is less than 16 then leading zeros should be added to that value to make it 16 as length.
    Please tell me how to do it in ABAP Objects.

    Hi Camila
    Try to use the statement
    DATA: ALPHABET(15) VALUE '     ABCDEFGHIJ',
          M1(4)        VALUE 'ABCD',
          M2(6)        VALUE 'BJJCA '.
    SHIFT ALPHABET LEFT DELETING LEADING M1.
    The field
    ALPHABET
    remains unchanged.
    SHIFT ALPHABET LEFT DELETING LEADING SPACE.
    The field ALPHABET now has the following contents:
    'ABCDEFGHIJ     '.
    SHIFT ALPHABET RIGHT DELETING TRAILING M2.
    <b>ALPHABET</b> now has the following contents:
    '      ABCDEFGHI'.
    <u><b>IN CHARACTER MODE</b></u>
    <b>Effect</b>
    This is the default setting (see above), and the addition is therefore optional.
    <b>Note
    Performance:</b>
    For performance reasons, you should avoid using SHIFT in WHILE loops.
    The runtime required to shift a field with length 10 by one character to the right or left requires about 5 msn (standardized microseconds). A cyclical shift requires around 7 msn. The runtime for the ...
    LEFT DELETING LEADING
    ... variant is around 3.5 msn, for ...
    RIGHT DELETING TRAILING
    ... around 4.5 msn.
    Reward all helpfull answers
    Regards
    Pavan

  • Regarding BADI's in ABAP

    Hi,
    Can anybody tell me What is meant BY <b>BADI's</b>!
    Also what are the main diffrences between <b>User-Exits and BADI's</b>!
    Can anybody explain me wether any diffrent types of <b>BADI's</b> are available!
    Can anybody provide me documentation with the examples
    for <b>BADI's</b>.
    If anybody is having good material on the same please post it.
    (or)
    Please send the material to
    My Personnal Mail id : <b>[email protected]</b>
    Thanks in advanace.
    Thanks & Regards,
    Rayeez.

    I.What is Badi?
    1.New SAP enhancement technique
    2.To accommodate user requirements not available / too specific to be included in the SAP standard Program
    3.Based on ABAP Objects – It has Interfaces & Methods
    4.Guaranteed upward compatibility of all Business Add-In interfaces
    -Release upgrades do not affect enhancement calls from within the standard software nor do they affect the validity of call interfaces
    II.BAdi & Customer-Exit
    1.Though different enhancement technique, BAdi has following distinct features
    -Uses Object oriented approach
    -Two parts - Definition and its Implementation - definition can either be SAP provided or user may also create it
    -no longer assumes a two-system infrastructure (SAP and customers)
    -allows multiple levels of software development (by SAP, partners, and customers, and as country versions, industry solutions, and the like)
    3.BAdi – where to find
    1.Look for BAdi in IMG and in component hierarchy (using transaction SE18)
    2.Create own implementation of the add-in (complete coding for Methods) and activate
    3.Enhancement's active components are called at runtime.
    BAdi Definition (SE18)1.To include Business Add-Ins in the program
    - Define an interface for the enhancement in the SAP menu under Tools-> ABAP Workbench -> Utilities -> Business Add-Ins -> Definition (transaction SE18)
    -Call the interface at the appropriate point in application program
    -Customers can then select the add-in and implement it according to their needs
    BAdi Implementation (SE19)
    1.ABAP Workbench ->Utilities -> Business Add-Ins -> Implementation (transaction SE19)
    2.Find the suitable Business Add-Ins present in system (Use IMG or Component hierarchy)
    3.Use Add-Ins Documentation to understand functionality & to decide
    4.Implement the Add-Ins
    -a class is created with the same interface
    -Finalize coding for the method
    5.Implementations are discrete transport objects and lie within the namespace of the person or organization implementing them
    check the SAP help link on BADI's
    http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm
    /people/sergey.korolev/blog/2005/03/14/the-time-for-me-to-have-a-badi-of-my-own
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ef6c0507-0701-0010-7395-e526c68bbc4e
    Thanks & Regards,

  • Regarding parallel queries in ABAP same as in oracle 10g

    Hi,
       Is there any way we can write parallel queries in ABAP, in the same way we do in oracle 10g.Kindly see below;
    alter table emp parallel (degree 4);
    select degree from user_tables where table_name = 'EMP';
    select count(*) from emp;
    alter table emp noparallel;
    SELECT /*+ PARALLEL(emp,4) / COUNT()
    FROM emp;
    The idea here is to distribute the load of select query in multiple CPUs for load balancing & performance improvement.
    Kindly advise.
    Thanks:
    Gaurav

    Hi,
    >    Is there any way we can write parallel queries in ABAP, in the same way we do in oracle 10g.
    sure. Since it is just a hint...
    SELECT *
      FROM t100 INTO TABLE it100
      %_HINTS ORACLE 'PARALLEL(T100,4)'.
    will give you such an execution plan for example:
    SELECT STATEMENT ( Estimated Costs = 651 , Estimated #Rows = 924.308 )
           4 PX COORDINATOR
               3 PX SEND QC (RANDOM) :TQ10000
                 ( Estim. Costs = 651 , Estim. #Rows = 924.308 )
                 Estim. CPU-Costs = 33.377.789 Estim. IO-Costs = 646
                   2 PX BLOCK ITERATOR
                     ( Estim. Costs = 651 , Estim. #Rows = 924.308 )
                     Estim. CPU-Costs = 33.377.789 Estim. IO-Costs = 646
                       1 TABLE ACCESS FULL T100
                         ( Estim. Costs = 651 , Estim. #Rows = 924.308 )
                         Estim. CPU-Costs = 33.377.789 Estim. IO-Costs = 646
    PX = Parallel eXecution...
    But be sure that you know what you do with the parallel execution option... it is not scalable.... .
    Kind regards,
    Hermann

  • Regarding the Authorization in ABAP-HR

    Hi all,
        I want to know about the Authorizations in the ABAP-HR. If any body is having any material regarding the can you plz share with me...
    thanks in advance,
    Suresh

    Hi Kutam,
    Chk these Links....
    Can i have the list of infotypes .
    abap hr
    http://www.asug.com/client_files/Calendar/Upload/HR_STRUCTURAL_AUTHORIZATIONS.ppt
    Reward Points if Useful
    All the Best
    Gokul

  • Regarding interface in the ABAP-HR

    Hi Experts,
             Iam new to ABAP-HR,
             I have 2 custom table which are updated with OT records from one batch program.
             Now i have to generate two files for regular OT data file and Off-Cycle OT data file respectually.
    What i have to do?For this i have to  pick the data from those two custom tables and create the files by using open dataset statement,Is this right way in HR?
    Actually the selection screen is having Payroll area,Current period and Other period fields.
    and the table is having BEGDA,ENDDA in one table and OTdate in onother table.How can i compare the dates?

    Hi,
    <b>Interface</b> Can be declared globally or locally within a program.
    Locally declared in the global portion of a program using:-
    INTERFACE <intf>.
    ENDINTERFACE.
    The definition contains the declaration for all components (attributes, methods, events) of the interface.
    Interfaces are included in the public section of a class.
    Interfaces do not have an implementation part, since their methods are implemented in the class that implements the interface.
    Interfaces do not have instances.
    A component <icomp> of an interface <intf> can be addressed as though it were a member of the class under the name <intf~icomp>.
    <b>Addressing Objects Using the class reference variable <cref>:</b>
    To access an attribute <attr>: <cref>-><intf~attr>
    To call a method <meth>:
    CALL METHOD <cref>-><intf~meth>
    <b>Using the interface reference variable <iref>:</b>
    To access an attribute <attr>: < iref>-><attr>
    To call a method <meth>:
    CALL METHOD <iref>-><meth>
    Addressing a constant <const>:
    <intf>=><const> (Cannot use class name).
    Addressing a static attribute <attr>:
    < class>=><intf~attr>
    Calling a static method <meth>:
    CALL METHOD <class>=><intf~meth>
        (Cannot use Interface method ).
    casting operator (?= )
    <cref> ?= <iref>
         For the casting to be successful, the object to which <iref> points must be an object of the same class as the type of the class variable <cref>.
    <b>sample program</b>
    report ysubdel .
    interface i1.
    data    : num type i .
    methods : meth1.
    endinterface.
    class c1 definition.
      public section.
      methods : meth1.
      interfaces : i1.
    endclass.
    class c1 implementation.
      method : meth1.
       write:/5 'I am meth1 in c1'.
      endmethod.
      method i1~meth1.
       write:/5 'I am meth1 from i1'.
      endmethod.
    endclass.
    start-of-selection.
      data : oref type ref to c1.  create object oref.
      write:/5 oref->i1~num.
      call method oref->meth1.
      call method oref->i1~meth1.
    Regards,
    Sowjanya.

  • REgarding link for NEW ABAP Editor

    Hi All,
              I wanted to install NEW ABAP EDITOR. CAn any one give me the link from where we need to install the new ABAP editor..
    Thanks,
    Suresh

    Hi kutam,
    it comes with support packages since 4.7 and GUI640 and is included in ECC600.
    Use tools->settings to switch to new editor.
    Regards,
    Clemens
    Message was edited by:
            Clemens Li

  • Regarding watch points in ABAP debugger

    Hi,
    Could u explain , why we use watch points, what is the use of it
    and how to use it.
    Thanks & regards,
    [email protected]

    Watch points
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/617cdce68c11d2b2ab080009b43351/content.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/14/6d1c370c468b7be10000009b38f936/frameset.htm
    Like a breakpoint, a watchpoint is an indicator in a program that tells the ABAP runtime processor to interrupt the program at a particular point. Unlike breakpoints, however, watchpoints are not activated until the contents of a specified field change. Watchpoints, like dynamic breakpoints, are user-specific, and so do not affect other users running the same program. You can only define watchpoints in the Debugger.
    Use
    You set watchpoints in the Debugger to monitor the contents of specific fields. They inform you when the value of a field changes. When the value changes, the Debugger interrupts the program.
    Features
    You can set up to five watchpoints in a program.
    See also Setting Watchpoints.
    You can also specify the conditions on which a watchpoint is to become active.
    You can specify logical conditions between up to five conditional watchpoints.
    See Specifying a Logical Expression.
    You can define watchpoints as either local or global. If you define a global watchpoint, it is active in all called programs. Local watchpoints are only active in the specified program.
    You can change and delete watchpoints.
    See Changing Watchpoints.
    You can use watchpoints to display changes to the references of strings, data and object references, and internal tables.
    See Memory Monitoring with Watchpoints
    If you want to interrupt a program when the contents of a field or structure change, use a watchpoint. You can set up to five watchpoints, including watchpoints for strings.
    A watchpoint can be either local or global. Local watchpoints are only valid in the specified program. Global watchpoints are valid in the specified program, and also in all the other programs it calls.
    Procedure
    To set a watchpoint, start the Debugger and proceed as follows:
    Choose Breakpoint ® Create watchpoint or the corresponding pushbutton. The Create Watchpoint dialog box appears:
    ashish
    Message was edited by:
            Ashish Gundawar

  • Regarding Other Pattern In ABAP Editior

    Hi,
    I have one doubt in ABAP. In ABAP editior we can call fuction module through pattern push button.Same way there i find other Pattern button also. So i want know what is purpose of other pattern and where we have create ? what is the Transaction?Kindly Help to me.
    Thanks & Regards,
    Ramya

    other pattern is used for  template purpose. u can create ur own templates there.
    goto  utilities->ptrn->edit pattern and  create a new pattern
    template means something like this
    $$*________________________________________
    FORMS name  start  with FS_
    $$*________________________________________

  • Regarding ALV Reporting in ABAP

    Hi All,
    I have some clarifications related to <b>ALV Reporting</b> in ABAP.
    <b>Actually i have to create ALV report with Structure Length/Each record length is around 300 characters.</b>
    Is it possible to create a ALV Report with <b>300</b> length for each record!
    If possible which is the best<b>[ALV]</b> method for the same!
    Can anybody give me the solution!
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Hai Prasad
    Check with the code
    *& Report  ZALV_PRAKASH_SAMP                                           *
    REPORT  ZALV_PRAKASH_SAMP .
    TABLES: MARA.
    TYPE-POOLS : SLIS.
    Data declaration
    DATA: BEGIN OF I_MARA OCCURS 0.
            INCLUDE STRUCTURE MARA.
    DATA: END OF I_MARA.
    DATA: V_REPID LIKE SY-REPID.
    selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
      SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
      PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
    SELECTION-SCREEN END OF BLOCK B1.
    initialisation
    INITIALIZATION.
    S_MATNR-LOW = '1400'.
    S_MATNR-HIGH = '1500'.
    APPEND S_MATNR.
    V_REPID = SY-REPID.
    start-of-selection
    START-OF-SELECTION.
    SELECT * FROM MARA
        INTO TABLE I_MARA
        WHERE MATNR IN S_MATNR AND
              MTART = P_MTART.
      CHECK SY-SUBRC = 0.
    end of selection
    END-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = ' '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
       I_STRUCTURE_NAME               = 'MARA'
      IS_LAYOUT                      =
      IT_FIELDCAT                    =
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = I_MARA
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at i_mara.
    write:/ i_mara.
    endloop.
    Thanks & Regards
    Sreenivasulu P

  • Regarding SMART Forms in ABAP

    Hi All,
    I want to learn <b>SMART</b> Forms in ABAP.
    Till now i have worked on <b>SAP Scripts</b> extensively.
    Can anybody tell me how can go about creating new <b>SMART Forms</b>!
    Can anybody tell me step-by-step procedure to create new <b>Smart Forms</b> in <b>ABAP</b>.
    If anybody have good material about the same can you post it to my personel id: <b>[email protected]</b>
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    HI
    GOOD
    GO THROUGH THESE LINKS , I HOPE YOU WILL GET SOME BEST IDEA OF CREATING THE SMARTFORMS.
    http://sap.niraj.tripod.com/id19.html
    http://www.planetsap.com/Userexit_List.htm
    http://www.allsaplinks.com/material.html
    http://www.sap-img.com/abap-function.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/840ad679-0601-0010-cd8e-9989fd650822
    SLDB-To find out the logical database details
    http://de.geocities.com/rafaelreichle/abapkeywords.html
    STMS-Transport Management System
    http://www.kabai.com/abaps/q.htm
    http://www.skytechnologies.com.au/default_files/job_scheduling.htm
    PZ04-TIME STATEMENT
    http://www.sapdevelopment.co.uk/fmodules/fmsfield.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/59/cd7daa07d711d5b66f006094192fe3/content.htm
    http://www.sapfriends.com/sapstuff.html
    http://www.sap4.com
    http://esnips.com/webfolder/59b7ad16-ec4c-4628-9677-0ed83278d97f
    THANKS
    MRUTYUN

  • Regarding a project in abap

    hi,
    I am a newbie in abap.Could anyone suggest me some projects in abap.I have competed some main topics in it like abap dictionary,abap editor,internal tables.So i a nutshell i have completed the basics of abap.
    I was wondering, based on my knowledge in abap, could anyone suggest me a project or a task, worthy to be submitted as a college project.
    thanks.

    Here is an easy way.  Simple move it to a numeric with a length of 5 and then move it back to ZIPCODE.
    data: n(5) type n.
    n = ZDCM-ZIPCODE.
    ZDCM-ZIPCODE = n.
    Regards,
    Rich Heilman

  • Question regarding multi processes in ABAP

    Hi
    We have written a ATC / Checkman Check Implementation.
    As we know the ATC / Checkman framework checks objects in object bundle of 50.
    Inside the check implementation we have to make a remote HTTP Call. That will be valid for all n instances.
    So the number n is determined by total number of objects / 50.
    Question
    In this multithreaded scenario how can we introduce a static variable which will be thread safe (making sure no two parallel threads write to this at a same time)
    Any suggestions / help.
    If you need more context i can explain more.
    Thanks & Regards,
    Piyush

    This could be answered in general thread concept in ABAP.
    As if we have to avoid parallel writes on a static variable how to do that?

  • Regarding Leading Zeros.

    Hello Friends,
    How can I remove leading zeros in an Internal Table Value. I am writing a BDC for User Defined Transaction. Here BDCDATA-Fval contains length of 132 chars. When I append a value to BDCDATA, it is appending as right justified. when we try to populate a value in to Screen field(CURRENCY FIELD), it is taking first 10 chars(from leftside) which are Zeros(leading zeros). for that, I would like to remove leading zeros for internal table BDCDATA. How can I do it?
    Thanks & Regards
    Sathish Kumar

    Hi Satish,
    To remove leading zeros and leading blanks
    Please use FM
    CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal
    CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

Maybe you are looking for

  • Badi and Business event( Urgent)

    Hi experts,       I am new to badi and business event 1120P. Please post how this business event exactly comes in to picture in this badi. also how to find this business event? And also Post the logic or code. The requirement is given below . Pls Pos

  • Keep getting error message about Dynamically-related files when trying to view in "Live" mode

    I'm very new to all of this, but I have been following Adobe tutorials to try and get everything working (Setting up a PHP development environment for Dreamweaver | Adobe Developer Connection) . The database connection test in this section goes throu

  • Save as PDF in Print / Fax / 10.3.9 Panther

    Hi all, I am stuck on a problem. I can't get my emac to show "save as PDF" in anything but Grey on my print window. I trashed com.apple.print.custompresets.plist from a forum I found, nice group by the way.I have also ran repair disc permissions in m

  • Mapping issue: Two different IDOC P19 segment to one flat file line

    Hello, Scenario: For each P01 segment (without uepos) in an order idoc I want to create one line in a plain text file. Problem: One P01 segment has two P19 segement with different qualifiers. I want to map both P19.IDNTR (with different qualifiers) f

  • Ipod Starts up, stops, resets, and does it all over again...

    Hey all, I tried searching but couldn't find anything like what I have. I recently purchased a new laptop, swapped my old library onto the new laptop, and then went to 'sync' on the new laptop. Things seemed to be working fine, unplugged the ipod, le