Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Not able to use Commit after the function module STATUS_OBJECT_CREATE

durgaprasanth_vemula
Participant
0 Likes
2,568

I am using function module   STATUS_OBJECT_CREATE

   CALL FUNCTION 'STATUS_OBJECT_CREATE'
          EXPORTING
           CHGKZ         = 'X'
           CLIENT        = SY-MANDT
            OBJNR         = LV_OBJNR3
            OBTYP         = 'IWE'
            STSMA         = 'ZS_RE_01'
          IMPORTING
            OBJNR         = LV_OBJNR3.
            STONR                        = LV_STONR.
        IF SY-SUBRC = 0.
            COMMIT WORK.
        ENDIF.

i am getting error after the COMMIT WORK .

I am not getting any issue in the function module .after the function module i am using the COMMIT WORK and i am getting the following error message

Category               ABAP Programming Error
Runtime Errors         SAPSQL_ARRAY_INSERT_DUPREC
Except.                CX_SY_OPEN_SQL_DB
ABAP Program           SAPLBSVU
Application Component  CA-GTF-TS-SMT
Date and Time          03/17/2014 07:01:29
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
|Short text                                                                                        |
|    The ABAP/4 Open SQL array insert results in duplicate database records.                       |
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
|What happened?                                                                                    |
|    Error in the ABAP Application Program                                                         |
|                                                                                                  |
|    The current ABAP program "SAPLBSVU" had to be terminated because it has                       |
|    come across a statement that unfortunately cannot be executed.                                |
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
|What can you do?                                                                                  |
|    Note down which actions and inputs caused the error.                                          |
|                                                                                                  |
|                                                                                                  |
|    To process the problem further, contact you SAP system                                        |
|    administrator.                                                                                |
|                                                                                                  |
|    Using Transaction ST22 for ABAP Dump Analysis, you can look                                   |
|    at and manage termination messages, and you can also                                          |
|    keep them for a long time.                                                                    |
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
|Error analysis                                                                                    |
|    An exception occurred that is explained in detail below.                                      |
|    The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught                 |
|     in                                                                                           |
|    procedure "STATUS_UPDATE" "(FUNCTION)", nor was it propagated by a RAISING                    |
|     clause.                                                                                      |
|    Since the caller of the procedure could not have anticipated that the                         |
|    exception would occur, the current program is terminated.                                     |
|    The reason for the exception is:                                                              |
|    If you use an ABAP/4 Open SQL array insert to insert a record in                              |
|    the database and that record already exists with the same key,                                |
|    this results in a termination.                                                                |
|                                                                                                  |
|    (With an ABAP/4 Open SQL single record insert in the same error                               |
|    situation, processing does not terminate, but SY-SUBRC is set to 4.)                          |
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
|How to correct the error                                                                          |
|    Use an ABAP/4 Open SQL array insert only if you are sure that none of                         |
|    the records passed already exists in the database.                                            |
|                                                                                                  |
|    If the error occures in a non-modified SAP program, you may be able to                        |
|    find an interim solution in an SAP Note.                                                      |
|    If you have access to SAP Notes, carry out a search with the following                        |
|    keywords:                                                                                     |
|                                                                                                  |
|    "SAPSQL_ARRAY_INSERT_DUPREC" "CX_SY_OPEN_SQL_DB"                                              |
|    "SAPLBSVU" or "LBSVUU01"                                                                      |
|    "STATUS_UPDATE"                                                                               |
|                                                                                                  |
|    If you cannot solve the problem yourself and want to send an error                            |
|    notification to SAP, include the following information:                                       |
|                                                                                                  |
|    1. The description of the current problem (short dump)                                        |
|                                                                                                  |
|       To save the description, choose "System->List->Save->Local File                            |
|    (Unconverted)".                                                                               |
|                                                                                                  |
|    2. Corresponding system log                                                                   |
|                                                                                                  |
|       Display the system log by calling transaction SM21.                                        |
|       Restrict the time interval to 10 minutes before and five minutes                           |
|    after the short dump. Then choose "System->List->Save->Local File                             |
|    (Unconverted)".                                                                               |
|                                                                                                  |
|    3. If the problem occurs in a problem of your own or a modified SAP                           |
|    program: The source code of the program                                                       |
|       In the editor, choose "Utilities->More                                                     |
|    Utilities->Upload/Download->Download".                                                        |
|                                                                                                  |
|    4. Details about the conditions under which the error occurred or which                       |
|    actions and input led to the error.                                                           |
|                                                                                                  |
|    The exception must either be prevented, caught within proedure                                |
|    "STATUS_UPDATE" "(FUNCTION)", or its possible occurrence must be declared in                  |
|     the                                                                                          |
|    RAISING clause of the procedure.                                                              |
|    To prevent the exception, note the following:                                                 |
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
|System environment                                                                                |
|    SAP Release..... 702                                                                          |
|    SAP Basis Level. 0010                                                                         |
|                                                                                                  |
|    Application server... "sds6ci"                                                                |
|    Network address...... "11.224.101.53"                                                         |
|    Operating system..... "Linux"                                                                 |
|    Release.............. "2.6.18-194.el5"                                                        |
|    Hardware type........ "x86_64"                                                                |
|    Character length.... 16 Bits                                                                  |
|    Pointer length....... 64 Bits                                                                 |
|    Work process number.. 17                                                                      |
|    Shortdump setting.... "full"                                                                  |
|                                                                                                  |
|    Database server... "gctsdb01lds.hsi.hugh"                                                     |
|    Database type..... "ORACLE"                                                                   |
|    Database name..... "DS6"                                                                      |
|    Database user ID.. "SAPDS4"                                                                   |
|                                                                                                  |
|    Terminal.......... "GCTEMP02VDI"                                                              |
|                                                                                                  |
|    Char.set.... "C"                                                                              |
|                                                                                                  |
|    SAP kernel....... 720                                                                         |
|    created (date)... "Sep 14 2013 05:28:14"                                                      |
|    create on........ "Linux GNU SLES-9 x86_64 cc4.1.2 use-pr130820"                              |
|    Database version. "OCI_102, 10.2.0.5.0, V2, default"                                          |
|                                                                                                  |
|    Patch level. 500                                                                              |
|    Patch text.. " "                                                                              |
|                                                                                                  |
|    Database............. "ORACLE 10.1.0.*.*, ORACLE 10.2.0.*.*, ORACLE 11.2.*.*.*"               |
|    SAP database version. 720                                                                     |
|    Operating system..... "Linux 2.6, Linux 3"                                                    |
|                                                                                                  |
|    Memory consumption                                                                            |
|    Roll.... 1317248                                                                              |
|    EM...... 0                                                                                    |
|    Heap.... 0                                                                                    |
|    Page.... 0                                                                                    |
|    MM Used. 1242912                                                                              |
|    MM Free. 53400                                                                                |
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
|User and Transaction                                                                              |
|    Client.............. 160                                                                      |
|    User................ "DV018458"                                                               |
|    Language key........ "E"                                                                      |
|    Transaction......... "SE38 "                                                                  |
|    Transaction ID...... "5323C30FC9364665E10000000BE06533"                                       |
|                                                                                                  |
|    EPP Whole Context ID.... "002655EE0F241ED3ABB7D81260A28C44"                                   |
|    EPP Connection ID....... 00000000000000000000000000000000                                     |
|    EPP Caller Counter...... 0                                                                    |
|                                                                                                  |
|    Program............. "SAPLBSVU"                                                               |
|    Screen.............. "RSM13000 3000"                                                          |
|    Screen Line......... 2                                                                        |
|    Debugger Active..... "none"                                                                   |
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
|Information on where terminated                                                                   |
|    Termination occurred in the ABAP program "SAPLBSVU" - in "STATUS_UPDATE".                     |
|    The main program was "RSM13000 ".                                                             |
|                                                                                                  |
|    In the source code you have the termination point in line 60                                  |
|    of the (Include) program "LBSVUU01".                                                          |
|    The program "SAPLBSVU" was started in the update system.                                      |
|    The termination is caused because exception "CX_SY_OPEN_SQL_DB" occurred in                   |
|    procedure "STATUS_UPDATE" "(FUNCTION)", but it was neither handled locally nor                |
|     declared                                                                                     |
|    in the RAISING clause of its signature.                                                       |
|                                                                                                  |
|    The procedure is in program "SAPLBSVU "; its source code begins in line                       |
|    1 of the (Include program "LBSVUU01 ".                                                        |
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
|Source Code Extract                                                                               |
----------------------------------------------------------------------------------------------------
|Line |SourceCde                                                                                   |
----------------------------------------------------------------------------------------------------
|   30|  LOOP AT jsto_upd WHERE chgkz = 'X'.                                                       |
|   31|    CHECK: jsto_upd-chgnr > '000',                                                          |
|   32|           jsto_upd-stsma NE jsto_upd-stsma_old.                                            |
|   33|    CLEAR jcdo_tab.                                                                         |
|   34|    MOVE-CORRESPONDING jsto_upd TO jcdo_tab.                                                |
|   35|    MOVE-CORRESPONDING chdat    TO jcdo_tab.                                                |
|   36|    jcdo_tab-stsma_new = jsto_upd-stsma.                                                    |
|   37|    APPEND jcdo_tab.                                                                        |
|   38|  ENDLOOP.                                                                                  |
|   39|* Änderungen zu Einzelstatus (Insert)                                                       |
|   40|  LOOP AT jest_ins WHERE chgkz = 'X'.                                                       |
|   41|    CHECK jest_ins-chgnr > '000'.                                                           |
|   42|    CLEAR jcds_tab.                                                                         |
|   43|    MOVE-CORRESPONDING jest_ins TO jcds_tab.                                                |
|   44|    MOVE-CORRESPONDING chdat    TO jcds_tab.                                                |
|   45|    jcds_tab-chind = 'I'.                                                                   |
|   46|    APPEND jcds_tab.                                                                        |
|   47|  ENDLOOP.                                                                                  |
|   48|* Änderungen zu Einzelstatus (Update)                                                       |
|   49|  LOOP AT jest_upd WHERE chgkz = 'X'.                                                       |
|   50|    CHECK jest_upd-chgnr > '000'.                                                           |
|   51|    CLEAR jcds_tab.                                                                         |
|   52|    MOVE-CORRESPONDING jest_upd TO jcds_tab.                                                |
|   53|    MOVE-CORRESPONDING chdat    TO jcds_tab.                                                |
|   54|    jcds_tab-chind = 'U'.                                                                   |
|   55|    APPEND jcds_tab.                                                                        |
|   56|  ENDLOOP.                                                                                  |
|   57|* Verbuchung Statusobjekte                                                                  |
|   58|  DESCRIBE TABLE jsto_ins LINES sy-tabix.                                                   |
|   59|  IF sy-tabix > 0.                                                                          |
|>>>>>|    INSERT jsto CLIENT SPECIFIED                                                            |
|   61|                FROM TABLE jsto_ins.                                                        |
|   62|  ENDIF.                                                                                    |
|   63|  DESCRIBE TABLE jsto_upd LINES sy-tabix.                                                   |
|   64|  IF sy-tabix > 0.                                                                          |
|   65|    field-symbols <fs_jsto_line> like jsto_upd.                                             |
|   66|    loop at jsto_upd assigning <fs_jsto_line>.                                              |
|   67|      IF <fs_jsto_line>-chgnr = '000'.                                                      |
|   68|        <fs_jsto_line>-chgnr = '999'.                                                       |
|   69|      ENDIF.                                                                                |
|   70|* on change of status profile delete user status related to old profile                     |
|   71|      IF <fs_jsto_line>-STSMA NE <fs_jsto_line>-STSMA_OLD.                                  |
|   72|        DELETE FROM JEST CLIENT SPECIFIED WHERE                                             |
|   73|               MANDT = <fs_jsto_line>-MANDT AND                                             |
|   74|               OBJNR = <fs_jsto_line>-OBJNR AND                                             |
|   75|               STAT  LIKE 'E%'.                                                             |
|   76|        DELETE FROM JCDS CLIENT SPECIFIED WHERE                                             |
|   77|               MANDT = <fs_jsto_line>-MANDT AND                                             |
|   78|               OBJNR = <fs_jsto_line>-OBJNR AND                                             |
|   79|               STAT  LIKE 'E%'.                                                             |
----------------------------------------------------------------------------------------------------

7 REPLIES 7
Read only

Former Member
0 Likes
1,541


Hi Durga,

You are trying to insert the duplicate records so it's giving dump i.e. you are trying create same records with primary key combination which  is alredaty in database.

You can also use FM BAPI_TRANSACTION_COMMIT.

Regards,

Pravin

Read only

PeterJonker
Active Contributor
0 Likes
1,541

Basically the rror says that the object you are trying to create already existst at that point. Did you try without a commit ?

If I see the runtime error description it looks to me you are using an exit in standard SAP. You Always need to be carefull when adjusting standard SAP with commits. Normally the SAP prgramm performs the commit.

I also see in the runtime error description that it is another function module that creates the error: STATUS_UPDATE.

Read only

0 Likes
1,541

i tried with out using commmit but it is not creating Status.

When i see the function module help and they are trying to COMMIT

FU STATUS_OBJECT_CREATE

____________________________________________________

Short Text

Create Status Object

Functionality

The function module generates a status object.

Take the object number from the object number management (function modules OBJECT_NUMNBER_GET_xx).

If no object number is given, the module takes a temporary object number that must be replaced later (function module STATUS_OBJECT_SWITCH_NUMBER).

Example

Creating an internal order with number 100123 (object type "ORC") for status profile "STATSCHEM" with final object number

call function 'OBJECT_NUMBER_GET_OR'

  exporting
    aufnr = '100123'
  importing objnr = objektnummer.
call function 'STATUS_OBJECT_CREATE'
  exporting
    objnr = objektnummer
    obtyp = 'ORC'
    stsma = 'STATSCHEM'.
commit work.

Creating the same order with a temporary object number

data: objectkey like ionra.

* TBO00-REFSTRUCT for object type 'OR' is 'IONRA'
objectkey-aufnr = '100123'.
call function 'STATUS_OBJECT_CREATE'
  exporting
    i_objectkey = objectkey
    obtyp       = 'ORC'
    stsma       = 'STATSCHEM'.
  importing
    objnr       = objektnummer.
call function 'OBJECT_NUMBER_GET_OR'
  exporting
    aufnr = '100123'
  importing objnr = objektnummer_neu.
call function 'STATUS_OBJECT_SWITCH_NUMBER'
  exporting
    objnr_old = objektnummer
    objnr_new = objektnummer_neu.
commit work.

Notes

Read only

durgaprasanth_vemula
Participant
0 Likes
1,541

When i see the function module help and they are using the COMMIT

FU STATUS_OBJECT_CREATE

____________________________________________________

Short Text

Create Status Object

Functionality

The function module generates a status object.

Take the object number from the object number management (function modules OBJECT_NUMNBER_GET_xx).

If no object number is given, the module takes a temporary object number that must be replaced later (function module STATUS_OBJECT_SWITCH_NUMBER).

Example

Creating an internal order with number 100123 (object type "ORC") for status profile "STATSCHEM" with final object number

call function 'OBJECT_NUMBER_GET_OR'

  exporting
    aufnr = '100123'
  importing objnr = objektnummer.
call function 'STATUS_OBJECT_CREATE'
  exporting
    objnr = objektnummer
    obtyp = 'ORC'
    stsma = 'STATSCHEM'.
commit work.

Creating the same order with a temporary object number

data: objectkey like ionra.

* TBO00-REFSTRUCT for object type 'OR' is 'IONRA'
objectkey-aufnr = '100123'.
call function 'STATUS_OBJECT_CREATE'
  exporting
    i_objectkey = objectkey
    obtyp       = 'ORC'
    stsma       = 'STATSCHEM'.
  importing
    objnr       = objektnummer.
call function 'OBJECT_NUMBER_GET_OR'
  exporting
    aufnr = '100123'
  importing objnr = objektnummer_neu.
call function 'STATUS_OBJECT_SWITCH_NUMBER'
  exporting
    objnr_old = objektnummer
    objnr_new = objektnummer_neu.
commit work.

Notes

Read only

0 Likes
1,541

That does not mean that you ALWAYS have to do the same. Are you calling this in a standard SAP program (user exit ?). Then you need to check if the program already has a commit. The function module moves the created object to a buffer.

So another option could be to call the FM STATUS_BUFFER_REFRESH after your commit to empty this buffer so the program will not try to update twice.

This al depends on the context in which this FM is called. And I cannot judge that since you have not supplied this information.

Read only

0 Likes
1,541

I am calling this funciton module in the Custom Report program

Read only

himanshu_gupta13
Product and Topic Expert
Product and Topic Expert
0 Likes
1,541

Dear Durga,

Instead of commit work, use the BAPI_TRANSACTION_COMMIT, and do Wait = 'X'.

Also Use exception from STATUS_OBJECT_CREATE, may be their some error.

Many Thanks / Himanshu gupta