How to generate a Ref-number automatically ( System Generated) in ABAP

Hi,
     I have created a z-table where ref_number is the key field. I want to fill this table automatically by system so that whenever a new record by customer is entererd, this ref_number will be given to them with response.
So Could any one help me out,
Gud points will be rewar5ded for useful answers.
Thanks in advance,
Sunil

Hi Sonali,
                   Thanks for you kind reply, but I am not able to get the System generated REQ_NUM and fill the table with the same. The program is as follows,
Could you help me out,
INCLUDE MZFIRSTPAGETOP                          .    " global Data
TABLES: ZCHP_CUST_INFO.
*DATA: OKCODE LIKE SY-UCOMM.
DATA:   CNAME LIKE ZCHP_CUST_INFO-CREATED_BY,
        REQTYP LIKE ZCHP_CUST_INFO-REQUEST_TYPE,
        DESC LIKE ZCHP_CUST_INFO-SHORT_TEXT,
        PRIO_TYPE LIKE ZCHP_CUST_INFO-PRIORITY_TYPE,
        EFFECTIVE_DATE like ZCHP_CUST_INFO-REQUIRED_STR_DAT,
        COMM_TYP like ZCHP_CUST_INFO-MODE_OF_COMM,
        COMM like ZCHP_CUST_INFO-ADDRESS,
        REF_NUM LIKE ZCHP_CUST_INFO-REQ_NUM.
*&      Module  STATUS_0100  OUTPUT
      text
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'FOR1000'.
  SET TITLEBAR '1000'.
ENDMODULE.                 " STATUS_0100  OUTPUT
INCLUDE MZFIRSTPAGEO01                          .  " PBO-Modules     *
INCLUDE MZFIRSTPAGEI01                          .  " PAI-Modules     *
INCLUDE MZFIRSTPAGEF01                          .  " FORM-Routines   *
*&      Module  USER_COMMAND_1000  INPUT
      text
MODULE USER_COMMAND_1000 INPUT.
CASE SY-UCOMM.
  WHEN 'SUBMIT'.
        ZCHP_CUST_INFO-CREATED_BY = CNAME.
        ZCHP_CUST_INFO-REQUEST_TYPE = REQTYP.
        ZCHP_CUST_INFO-PRIORITY_TYPE = PRIO_TYPE.
        ZCHP_CUST_INFO-SHORT_TEXT = DESC.
        ZCHP_CUST_INFO-CREATED_ON = EFFECTIVE_DATE.
        ZCHP_CUST_INFO-MODE_OF_COMM = COMM_TYP.
        ZCHP_CUST_INFO-ADDRESS = COMM.
INSERT ZCHP_CUST_INFO.
COMMIT WORK.
*GENERATING A REF_NUMBER.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZCHP_CUST_INFO'
QUANTITY = '1'
SUBOBJECT = ' '
TOYEAR = '0000'
IGNORE_BUFFER = ' '
IMPORTING
number = ZCHP_CUST_INFO-REQ_NUM " specify ur wa field
QUANTITY =
RETURNCODE =
EXCEPTIONS
interval_not_found = 1
number_range_not_intern = 2
object_not_found = 3
quantity_is_0 = 4
quantity_is_not_1 = 5
interval_overflow = 6
buffer_overflow = 7
OTHERS = 8.
WHEN 'RESET'.
       CLEAR: CNAME,REQTYP,PRIO_TYPE,
DESC,EFFECTIVE_DATE,COMM_TYP,COMM.
  WHEN 'CANCEL'.
        LEAVE PROGRAM.
ENDCASE.
ENDMODULE.                 " USER_COMMAND_1000  INPUT
Thanks in advance,
Sunil K Shetty

Similar Messages

  • How to get WAS Installation Number and  System Id?

    Anyone knows how to get Netweaver WAS Installation number and system id using java? I need these numbers to generate a unique key.
    Any help would be much appreciated. Thanks.

    Hi Maksim,
    I'm trying to do the same thing in webdynpro, but every time I get the 'ClassCastException'.
    InitialContext initialCtx = new InitialContext();
    MBeanServer mbs = (MBeanServer)initialCtx.lookup("jmx");
    <property name="ServicesReference" value="sap.com/jmx"/>
    <property name="LibrariesReference" value="sap.com/tc~jmx"/>
    the JNDI look up has this entry -
    + jmx
    + [Class Name] : com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain
    + [Object Value] : NON Serializable Object
    J2EE Engine is 6.40.
    could you please tell me what I'm missing.
    Thanks in advance,
    Rajiv.

  • How enabled Single Sign-On with a System SAP WAS ABAP (Run application BSP)

    Hi.
    I need to run any application BSP from a System SAP WAS ABAP, without entering SAP user and password. Using the windows authentication and without SAP Enterprise Portal.
    What authentication methods I have to apply for enabled Single Sign-On with a System SAP WAS ABAP?.
    And How can I enabled this method?.
    Best regards.
    Luis Gomez.

    Hi Ticiano,
    SAP WebAS ABAP supports a number of authenticaiton mechanisms. See
    [http://help.sap.com/saphelp_nw04s/helpdata/en/02/d4d53aa8a9324de10000000a114084/frameset.htm]
    A number of these authentication mechanisms can be combined with Windows authentication (e.g. SNC, client certificates, ...).
    The decision what mechanism fits best depends on critieria like
    - SAP server platform
    - security requirements
    - extensibility (should same authentication mechanism be used for future SAP environments, which will be E-SOA based)
    - authentication from outside company domain
    - Use of SAP security library (SAPcryptolib)
    You may want to look at the SAP Software Solution Partner Catalog, if you look for certified SSO solution vendors for SAP.
    Best regards,
    Peter

  • How to go to footnote number automatically using Find or GREP

    Hello,
    I have been looking for how to search within footnotes. I have a Paragraph Style for my footnotes and can easily search anything within the citation but it won't take me straight to the number because I need to know what page it is at.
    For instance the client is reading off his Microsoft Word doc and wants to edit the footnote no. 55. I don't know which page this footnote is at in the Indesign file, unless I just use the basic ^F with the "Find/Change" and manually go through it from no.1 until I reach no.55.
    Isn't there a faster way to do this?
    Thanks a bunch!

    Here is a tiny Javascript that prompts you for a footnote number.
    Caveats: it only works with numbered footnotes, not with "a", "b", "c" or "*", "**", "***" or "i", "ii", "iii" or any of the other numbering styles. It simply enumerates the current footnotes starting from '1' -- even if you have it start at another number, or have it restart numbering on every new page or section.
    In addition, since every story (continuous thread of text) contains its own set of footnotes, you have to click the text cursor into your current story.
    var notenum = prompt ('Footnote', '1-'+String(app.selection[0].parentStory.footnotes.length));
    if (notenum && notenum.match(/^\d+$/))
    app.select(app.selection[0].parentStory.footnotes.item(Number(notenum)-1).insertionPoints[0]);
    app.layoutWindows[0].zoomPercentage = app.layoutWindows[0].zoomPercentage;
    (Edit: Added the allowed range in the prompt)

  • How to generate new perner number using Abap Code in pa0002. what is the fu

    how to generate new perner number using Abap Code in pa0002. what is the function Module used.

    hi
    define internal number ranges for ur implementation then when u run PA 40  do not input any employee number , system will generate the employee number automatically.
    Regards
    sameer

  • How to generate report with dynamic variable number of columns?

    How to generate report with dynamic variable number of columns?
    I need to generate a report with varying column names (state names) as follows:
    SELECT AK, AL, AR,... FROM States ;
    I get these column names from the result of another query.
    In order to clarify my question, Please consider following table:
    CREATE TABLE TIME_PERIODS (
    PERIOD     VARCHAR2 (50) PRIMARY KEY
    CREATE TABLE STATE_INCOME (
         NAME     VARCHAR2 (2),
         PERIOD     VARCHAR2 (50)     REFERENCES TIME_PERIODS (PERIOD) ,
         INCOME     NUMBER (12, 2)
    I like to generate a report as follows:
    AK CA DE FL ...
    PERIOD1 1222.23 2423.20 232.33 345.21
    PERIOD2
    PERIOD3
    Total 433242.23 56744.34 8872.21 2324.23 ...
    The TIME_PERIODS.Period and State.Name could change dynamically.
    So I can't specify the state name in Select query like
    SELECT AK, AL, AR,... FROM
    What is the best way to generate this report?

    SQL> -- test tables and test data:
    SQL> CREATE TABLE states
      2    (state VARCHAR2 (2))
      3  /
    Table created.
    SQL> INSERT INTO states
      2  VALUES ('AK')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AL')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AR')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('CA')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('DE')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('FL')
      3  /
    1 row created.
    SQL> CREATE TABLE TIME_PERIODS
      2    (PERIOD VARCHAR2 (50) PRIMARY KEY)
      3  /
    Table created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD1')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD2')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD3')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD4')
      3  /
    1 row created.
    SQL> CREATE TABLE STATE_INCOME
      2    (NAME   VARCHAR2 (2),
      3       PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
      4       INCOME NUMBER (12, 2))
      5  /
    Table created.
    SQL> INSERT INTO state_income
      2  VALUES ('AK', 'PERIOD1', 1222.23)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('CA', 'PERIOD1', 2423.20)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('DE', 'PERIOD1', 232.33)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('FL', 'PERIOD1', 345.21)
      3  /
    1 row created.
    SQL> -- the basic query:
    SQL> SELECT   SUBSTR (time_periods.period, 1, 10) period,
      2             SUM (DECODE (name, 'AK', income)) "AK",
      3             SUM (DECODE (name, 'CA', income)) "CA",
      4             SUM (DECODE (name, 'DE', income)) "DE",
      5             SUM (DECODE (name, 'FL', income)) "FL"
      6  FROM     state_income, time_periods
      7  WHERE    time_periods.period = state_income.period (+)
      8  AND      time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
      9  GROUP BY ROLLUP (time_periods.period)
    10  /
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> -- package that dynamically executes the query
    SQL> -- given variable numbers and values
    SQL> -- of states and periods:
    SQL> CREATE OR REPLACE PACKAGE package_name
      2  AS
      3    TYPE cursor_type IS REF CURSOR;
      4    PROCEDURE procedure_name
      5        (p_periods   IN     VARCHAR2,
      6         p_states    IN     VARCHAR2,
      7         cursor_name IN OUT cursor_type);
      8  END package_name;
      9  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY package_name
      2  AS
      3    PROCEDURE procedure_name
      4        (p_periods   IN     VARCHAR2,
      5         p_states    IN     VARCHAR2,
      6         cursor_name IN OUT cursor_type)
      7    IS
      8        v_periods          VARCHAR2 (1000);
      9        v_sql               VARCHAR2 (4000);
    10        v_states          VARCHAR2 (1000) := p_states;
    11    BEGIN
    12        v_periods := REPLACE (p_periods, ',', ''',''');
    13        v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
    14        WHILE LENGTH (v_states) > 1
    15        LOOP
    16          v_sql := v_sql
    17          || ',SUM(DECODE(name,'''
    18          || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
    19          || '"';
    20          v_states := LTRIM (SUBSTR (v_states, 3), ',');
    21        END LOOP;
    22        v_sql := v_sql
    23        || 'FROM     state_income, time_periods
    24            WHERE    time_periods.period = state_income.period (+)
    25            AND      time_periods.period IN (''' || v_periods || ''')
    26            GROUP BY ROLLUP (time_periods.period)';
    27        OPEN cursor_name FOR v_sql;
    28    END procedure_name;
    29  END package_name;
    30  /
    Package body created.
    SQL> -- sample executions from SQL:
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR                                                        
    PERIOD1       1222.23                                                                              
    PERIOD2                                                                                            
                  1222.23                                                                              
    SQL> -- sample execution from PL/SQL block
    SQL> -- using parameters derived from processing
    SQL> -- cursors containing results of other queries:
    SQL> DECLARE
      2    CURSOR c_period
      3    IS
      4    SELECT period
      5    FROM   time_periods;
      6    v_periods   VARCHAR2 (1000);
      7    v_delimiter VARCHAR2 (1) := NULL;
      8    CURSOR c_states
      9    IS
    10    SELECT state
    11    FROM   states;
    12    v_states    VARCHAR2 (1000);
    13  BEGIN
    14    FOR r_period IN c_period
    15    LOOP
    16        v_periods := v_periods || v_delimiter || r_period.period;
    17        v_delimiter := ',';
    18    END LOOP;
    19    v_delimiter := NULL;
    20    FOR r_states IN c_states
    21    LOOP
    22        v_states := v_states || v_delimiter || r_states.state;
    23        v_delimiter := ',';
    24    END LOOP;
    25    package_name.procedure_name (v_periods, v_states, :g_ref);
    26  END;
    27  /
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR         CA         DE         FL                       
    PERIOD1       1222.23                           2423.2     232.33     345.21                       
    PERIOD2                                                                                            
    PERIOD3                                                                                            
    PERIOD4                                                                                            
                  1222.23                           2423.2     232.33     345.21                       

  • How to make every account in the system login automatically?

    How to make every account in the system login automatically when Mac OS X startup?
    Thanks!

    I can see one way to do it. You'll need to install a script in each user account, and have it set as a login item for each user. Let's imagine you have three user accounts. Each user in Mac OS X has a UID number. Normally your first user has the UID of 501, the second one will be 502 and so on...
    You can determine the UID by running the following AppleScript while logged in on each user:
    do shell script ("ID")
    This'll return a long block of text, but right at the start you'll see the UID number. Let's assume your three users have the UIDs 501, 502 and 503. We begin with 501.
    Create the following script and save it as an application while logged in as 501. Note that the password you're entering is the password for UID 502. Also note that the forum system is creating line breaks where there shouldn't be any. The long "do shell script" line should be one line.
    delay 5 --This delay allows time for login to complete, but it may not be necessary.
    try
    do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID 502"
    delay 5 --This delay could be shorter or longer, depending on how fast your machine is.
    tell application "System Events"
    keystroke "password for 502" --the password for UID 502
    keystroke return
    delay 1
    end tell
    on error
    display dialog "Unable to switch user."
    end try
    Open System Preferences, go to Accounts, click "login items" and drag your script (saved as an application) to the login items window.
    You basically repeat this process for each user account, modifying the script so it switches to the next user.
    This isn't ideal, because your passwords will be stored in the scripts, and each user could open the scripts and learn the passwords of the other users on that machine.
    I picked some of this up from a discussion over at the Macworld forums:
    http://hints.macworld.com/article.php?story=20031102031045417
    Message was edited by: The Preacher
    Message was edited by: The Preacher
    Message was edited by: The Preacher

  • For sweden the employee number range is completed Eg:23000000 to 239999999 now how to generate next employee id

    For sweden the employee number range is completed Eg:23000000 to 239999999 now how to generate next employee id

    Hi Bharathi,
    If required no ranges are not there which you want to add then will not be problem and you can extend the 23999999 to your next limit like 39999999 check the overlapping.
    Check extended no rage are present in the system and then system would not except because of overlapping.
    Check and tell.
    Regards,
    Sankarsan

  • How to generat code numbers automatically?

    Dear members,
    i have 3 tables with code no which are primary key and char datatype.
    the first code number is 2 characters,
    then the 2nd code number is 5 characters
    then 3rd code number is 9 characters.
    the first table's code numbers are manually defined. 10, 20, 30 and so on.
    but the requirement is to generate the 2nd table's code number automatically by fixing the 1st tables 2 characters on the left and then 10001, 10002, 10003, 10004 and so on.
    and like this the 3rd table's code number to be generated by fixing the first 5 characters on the left from the 2nd table and the 4 characters on the right 100010001, 100010002, 100010003, 100010004 and so on.
    for example:
    FIRST TABLE 2ND TABLE 3RD TABLE
    10 10001 100010001
    10002 100020001
    20 20001 200010001
    20002 200020001
    30 30001 300010001
    30002 300020001
    How can do this job?
    i issue the following query.
    declare
    v_2nd_code_no char(5);
    begin
    select max(2nd_code)+1 into v_2nd_code_no from 2nd_table;
    select first_code_no||v_2nd_code_no into :blk.item from dual;
    end;
    it give the following error.
    ORA-06502: PL/SQL: numeric or value error string
    now how can i do this job.
    thanks in advance.
    Muhammad Nadeem
    [email protected]

    Muhammed,
    I think you should reconsider your design. Duplicating data into other columns will give you update headaches, uses extra storage, and fool the optimizer, and maybe others will point out more disadvantages.
    In my opinion your table should look like this:
    code1 number(2,0)
    code2 number(3,0)
    code3 number(4,0)
    Please note that they are numbers! Using numbers for numbers is the right way for not fooling the optimizer. Before executing a query, Oracle determines the access path to retrieve all information, based on statistical information on all the tables,columns and indexes involved. If you issue a query with a predicate like:
    code3 between '100019999' and '100020000'the optimizer will think there are numerous strings between the two "numbers" and will maybe head towards a full table scan, or at least think there are thousands of values between the two.
    Now, if in your application you want to get a nicely displayed number with leading zeros and all, you just use:
    rpad(to_char(code1),2,'0') || rpad(to_char(code2),3,'0') || rpad(to_char(code3),4,'0')Regards,
    Rob.

  • How to generater automatically getters and setters???

    Hi!!!
    Boys and Girls, how to generate automatically getters and setters like eclipse dialog or shortcut, using bea workshop(jpf file)?
    Best Regards,
    Pablo

    can anyone tell where i can find libraries for access/manipulate beans.
    and sample example to invoke getters and setter of the property but not like preparing String "setPropertyName" or "getPropertyName" and invoking the method i beleive there should be standard way
    and also setPropertyName may take different type parameters i cannot keep number of if conditions to check for different datatypes
    with regards
    satya

  • How to generate username automatically while user creation in OIM.

    Hi all,
    Could you please send me steps for how to generate user name automatically by using adapter while creating the user in OIM.

    Follow this link:
    [http://download.oracle.com/docs/cd/B32479_01/doc.903/b32457/creadp.htm|http://download.oracle.com/docs/cd/B32479_01/doc.903/b32457/creadp.htm]
    It will help you to make each adapter which you want but for this you'll have to create entity adapter.

  • How to make External Reference number and Ref Date Mandatory in Complaints

    Dear Experts,
    Greetings!!!.
    How to make External Reference number (EXT_REF_NUMBER ) and Ref Date ( EXT_REF_DATE ) Mandatory in Complaints.
    Regards,
    Sany

    HI,
    You can use Incompleteness Procedure to make those fields mandatory in complaint transaction.
    Regards,
    PP

  • How to generate serial number in group by sql

    I need the query output with record serial number by a group,
    Sr No by dept Dept Id Emp Name
    ========= ===== =======
    1 10 aaaaa
    1 11 abndddd
    2 11 sdfffffff
    3 11 s sdfe
    4 11 ggg
    1 12 dDEWQ
    1 13 xccc
    2 13 DSAFG
    How to generate the first column in the above output using sql?
    Thanks in advance
    Shrinivas

    use the analytic function ROW_NUMBER
    here is a small example
    SQL> select row_number() over(partition by deptno order by empno) rno, deptno, empno
      2    from emp
      3  /
           RNO     DEPTNO      EMPNO
             1         10       7782
             2         10       7839
             3         10       7934
             1         20       7566
             2         20       7788
             3         20       7876
             4         20       7902
             1         30       7499
             2         30       7521
             3         30       7654
             4         30       7698
           RNO     DEPTNO      EMPNO
             5         30       7844
             6         30       7900
    13 rows selected.

  • I'm running Mac OS X version 10.6.8 How come I get this error message "You are running an operating system that Photoshop no longer supports. Refer to the system requirements for a full list of supported platforms." When I Try to download a FREE trail?

    I'm running Mac OS X version 10.6.8 How come I get this error message "You are running an operating system that Photoshop no longer supports. Refer to the system requirements for a full list of supported platforms." When I Try to download a FREE trail?

    Hi Brizill,
    Please refer to the help document below to understand the technical specifications for the same:
    System requirements | Photoshop
    Regards,
    Sheena

  • How can i say yes to automatic updates when they stop my wireless dlink to Virgin home broadband from getting on the internet and then i have to do a system restore to the day before the update to get it back to normal?!? Frustrated

    how can i say yes to automatic updates when they stop my wireless dlink to Virgin home broadband from getting on the internet and then i have to do a system restore to the day before the update to get it back to normal?!? Frustrated
    == This happened ==
    Not sure how often
    == automatic updates go on my computer, say if i click yes to update when shutting down

    You have 10.6 on that machine, I suggest you stick with it for performance, third party hardware and software reasons as long as possible.
    Consider 10.8 (not 10.7) when it's released, because 10.7 and 10.8 will require a new investment in software and newer third party hardware as it requires newer drivers the old machines won't have. (forced upgrade because of software, really nice of them)
    http://roaringapps.com/apps:table
    Far as your Safari problem do these things until it's resolved:
    1: Software Update fully under the Apple menu.
    2: Check the status of your plug-ins and update (works for all browsers) also install Firefox and see if your problems continue. You should always have at least two browsers on the machine just in case one fails.
    https://www.mozilla.org/en-US/plugincheck/
    Flash install instructions/problem resolution here if you need it.
    How to install Flash, fix problems
    3: Install Safari again from Apple's web site
    https://www.apple.com/safari/
    4: Run through this list of fixes, stopping with #16 and report back before doing #17
    Step by Step to fix your Mac

Maybe you are looking for