Maintaining log table

Hi Experts,
The below procedure is scheduled using DBMS_JOB.
I want to maintain log table for the actions performed by this procedure
and as well as the job information.
CREATE OR REPLACE PROCEDURE load_proc (P_ID IN NUMBER)
IS
   CURSOR C
   IS
      SELECT   GROUP_ID, tablename, target_table
        FROM   temp_table
       WHERE   GROUP_ID = p_id;
BEGIN
   FOR I IN C
   LOOP
      EXECUTE IMMEDIATE   'INSERT INTO '
                       || I.target_table
                       || '(SELECT * FROM '
                       || I.tablename
                       || ' WHERE '
                       || 'last_dt<=SYSDATE-500'
                       || ')';
     EXECUTE IMMEDIATE   'DELETE FROM '
                       || I.tablename
                       || ' WHERE '
                       || 'last_dt<=SYSDATE-500';
      COMMIT;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      ROLLBACK;
      DBMS_OUTPUT.PUT_LINE (
         'An error was encountered - ' || SQLCODE || ' -ERROR- ' || SQLERRM
END load_proc;
DECLARE
  X NUMBER;
BEGIN
  SYS.DBMS_JOB.SUBMIT
  ( job       => X
   ,what      => 'ARP.load_proc(1);'
   ,next_date => to_date('20/01/2013 00:00:00','dd/mm/yyyy hh24:mi:ss')
   ,interval  => 'TRUNC(SYSDATE+1)'
   ,no_parse  => FALSE
  SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
COMMIT;
END;
/I want to capture the below information in the log table.
SNO RECORDS_INSERTED               RECORDS_DELETED              JOBID   JOB_START_TIME         JOB_END_TIME          JOB_LAST_RAN_ON       JOB_STATUS  
1  2000 records inserted into     2000 records deleted from      1     20/01/2013 00:00:00    20/01/2013 02:30:00  20/01/2013 02:30:00   completed successfully
   table WEDB_EMPLOYEE            table WEDB_EMPLOYEE
2                                            1     21/01/2013 00:00:00     21/01/2013 01:00:00                   Failed: error message
3                                                                1                                     NULLIf the job is not started on the particular day NULL value has to be inserted in the JOB_LAST_RAN_ON column.
If the job is not failed in the middle on a particular day FAILED: ERROR MESSAGE value has to be inserted in the JOB_STATUS column.
Script for log table creation.
CREATE TABLE log_load_proc
(sno NUMBER,
records_inserted VARCHAR2(4000),
records_deleted VARCHAR2(4000),
jobid NUMBER,
job_start_time TIMESTAMP,
job_end_time TIMESTAMP,
job_last_ran_on TIMESTAMP,
job_status VARCHAR2(4000));Please help me on this.
Thanks in advance.

973205 wrote:
>If the job is not started on the particular day NULL value has to be inserted in the JOB_LAST_RAN_ON column.
If the job is not failed in the middle on a particular day FAILED: ERROR MESSAGE value has to be inserted in the JOB_STATUS column.
Thanks for posting the Procedure, Job and Table Details.
How do you want to represent the data in Log table, if you are processing Multiple Tables in a Single Job Run?
Certainly, to comply with your First requirement, you will have to setup another job that does the Logging for you.
Or, Calling of Job procedure has be modified like below
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job       => X
,what      => 'ARP.some_procedure(1);'           ----------> some_procedure will call Log Procedure, followed by load_proc(1) and further followed by Log procedure to indicate success/failure of Job;
,next_date => to_date('20/01/2013 00:00:00','dd/mm/yyyy hh24:mi:ss')
,interval  => 'TRUNC(SYSDATE+1)'
,no_parse  => FALSE
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
COMMIT;
END;
/Below is a sample code, which you can modify according to your requriements:
create or replace procedure log_load_job
  p_rec_inserted                varchar2,
  p_rec_deleted                 varchar2,
  p_job_id                      number,
  p_start_date                  date,
  p_end_date                    date,
  p_job_status                  varchar2
is
declare
  pragma autonomous_transaction;
begin
  insert into log_load_job (records_inserted, records_deleted, job_id, start_date, end_date, last_run_date, job_status)
  values (p_rec_inserted, p_rec_deleted, p_job_id, p_start_date, p_end_date, decode(instr(p_job_status, 'ERROR'), 0, p_end_date, null), p_job_status);
                                                           --> Decode to check if Job Status is Error, do not enter Last Run Date
  commit;
exception
  when others then
    null;             ---> Failure of LOGGER must not interrupt the normal execution.
end log_load_job;
CREATE OR REPLACE PROCEDURE load_proc (P_ID IN NUMBER)
is
  v_inserted        varchar2(4000);
  v_deleted         varchar2(4000);
  v_start_date      date;
   CURSOR C
   IS
      SELECT   GROUP_ID, tablename, target_table
        FROM   temp_table
       WHERE   GROUP_ID = p_id;
begin
  v_start_date := sysdate;
   FOR I IN C
   LOOP
      EXECUTE IMMEDIATE   'INSERT INTO '
                       || I.target_table
                       || '(SELECT * FROM '
                       || I.tablename
                       || ' WHERE '
                       || 'last_dt<=SYSDATE-500'
                       || ')';
      v_inserted := sql%rowcount || ' records inserted into ' || i.tablename;
     EXECUTE IMMEDIATE   'DELETE FROM '
                       || I.tablename
                       || ' WHERE '
                       || 'last_dt<=SYSDATE-500';
      v_deleted := sql%rowcount || ' records deleted from ' || i.tablename;
      log_load_job(v_inserted, v_deleted, p_id, v_start_date, sysdate, 'Completed');
      --COMMIT;
      v_inserted := null;
      v_deleted := null;
   end loop;
   commit;                ---> Commit After Entire Tables have been Deleted and Inserted.
EXCEPTION
   WHEN OTHERS
   then
    log_load_job(v_inserted, v_deleted, p_id, v_start_date, sysdate, 'Error :: ' || sqlerrm);
      ROLLBACK;
end load_proc;
/Untested piece of code.

Similar Messages

  • Insert a new row in log table when update on view object

    hi All,
    i have created approval System where i maintain log which is based on table(ApprovalLog) which contain attribute like (Agencycode,approve_status,approved_by,approved_date).
    and i have also create a view object which is based on (AgencyApproval) table. which is also contain field approval_status by default 'N'
    i create a jsf page using this view object and drag drop as adf table now i want when user change approve_status field and click on commit button then
    a new row created on to ApprovalLog table and values of column like (agencycode,approve_status,approved_by) comes from AgencyApproval table.
    How can i do this in ADF.
    Please Reply.
    manish

    hi Timo,
    i have done this as following and it is working.
    please tell me it is right approach or not.
            protected void prepareForDML(int i, TransactionEvent aTransactionEvent)
                if (i != EntityImpl.DML_DELETE)
                         ViewObjectImpl vo = (ViewObjectImpl)this.getDBTransaction().findViewObject("AdAgcrlimitAppLogView3"); // change it to the name of your VO
                           Row row = vo.createRow();
                           // set the values ...
                           row.setAttribute("AppDt",getAppDt() );
                           row.setAttribute("Publ",getPubl() );
                           row.setAttribute("GrpAgcode",getGrpAgcode() );
                           row.setAttribute("GrpAgsubcode",getGrpAgsubcode() );
                           row.setAttribute("StaticCrlimit",getStaticCrlimit() );
                           row.setAttribute("FixCrlimit",getFixCrlimit() );
                           row.setAttribute("VarcrLimit",getVarcrLimit() );
                           row.setAttribute("AdhocLimit",getAdhocLimit() );
                           row.setAttribute("AdhocFr",getAdhocFr() );
                           row.setAttribute("AdhocTo",getAdhocTo() );
                           row.setAttribute("CrAlertLimit",getCrAlertLimit() );
                           row.setAttribute("BillAmt",getBillAmt() );
                           row.setAttribute("AdjAmt",getAdjAmt() );
                           row.setAttribute("DbnAmt",getDbnAmt() );
                           row.setAttribute("PayAmt",getPayAmt() );
                           row.setAttribute("UnbillAmt",getUnbillAmt() );
                           row.setAttribute("Status",getStatus() );
                           row.setAttribute("AlertTag",getAlertTag() );
                        row.setAttribute("CrlimitTag",getCrlimitTag() );
                           row.setAttribute("Confirm",getConfirm() );
                           row.setAttribute("ApproveRemark",getApproveRemark() );
                           row.setAttribute("ApproveBy",getApproveBy() );
                           row.setAttribute("ApproveDt",getApproveDt() );
                           row.setAttribute("ApproveStatus",getApproveStatus() );
                           row.setAttribute("ApproveHier",getApproveHier() );
                           row.setAttribute("Usrname",getUsrname() );
                           row.setAttribute("Usrid",getUsrid() );
                           row.setAttribute("Usrdate",getUsrdate() );
                           row.setAttribute("Cuser",getCuser() );
                           vo.insertRow(row);
                       super.prepareForDML(i, aTransactionEvent);
            }

  • Where to see the images other than change log table

    Dear all,
                   How to view images for extraction's (example Generic )  in  DSO without using Change log table.
    With Regards,
    Baskaran

    Hi,
    There is no other option other than change log table to view the images.
    in PSA..we will get only raw data..i.e...its non other than the data how its posted in source sytem.we can say..this is only copy of source sytem data.
    after PSA,if the datasource is DELTA enabled(which can sustain NEW or CHANGED records-here only we get concept of IMAGES),we have to load this data only to DSO.from there after activation of the data,the data can be updated to further data targets only from CHANGE LOG table which can maintain images.
    Even further targets are also DSOs,we will have to load from this DSO only.so we can see images only in change log table.
    hope this is clear for you.
    Regards
    Ramsunder

  • Please help me how to maintain log for procedure execution

    Hi Experts,
    How to maintain the log for procedure execution
    I want to maintain the log for procedures as below.
    Once the procedure starts it should show status as RUNNING and PROC_END_TIME should be NULL.
    Once the procedure completes it should show status as COMPLETED and shold show the PROC_END_TIME.
    Once the MAIN_PROC completes then only the status of that procedure should show COMPLETED.
    STEP_ID RECORDS_INS_UPD  RECORDS_DELETED PROC_NAME PROC_START_TIME                PROC_END_TIME              JOB_STATUS ERROR_MSG
    1 500             0  MAIN_PROC 1/4/2014 5:47:38.000000 AM                         RUNNING
    2 100             0  SUB_PROC1 1/4/2014 5:49:30.000000 AM                         RUNNING
    3  0             0  SUB_PROC2 1/4/2014 5:47:38.000000 AM 1/4/2014 5:47:38.000000 AM COMPLETED
    I have tried the below code but it's not working properly.
    CREATE OR REPLACE PROCEDURE procedures_log
       p_seq                NUMBER,
       p_rec_ins_upd        NUMBER,
       p_rec_deleted        NUMBER,
       p_proc_name          VARCHAR2,
       p_start_time         TIMESTAMP,
       p_end_time           TIMESTAMP,
       p_job_status         VARCHAR2,
       p_error_msg          VARCHAR2
    IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
        IF p_seq = 0 THEN
            INSERT INTO proc_log
                STEP_ID,
                ORG_ID,
                TABLENAME,
                RECORDS_INS_UPD,
                RECORDS_DELETED,
                JOB_NAME,
                PROC_NAME,
                JOB_START_TIME,
                JOB_END_TIME,
                JOB_STATUS,
                ERROR_MSG
            VALUES
                p_seq,
                p_rec_ins_upd,
                p_rec_deleted,
                p_proc_name,
                p_start_time,
                p_end_time,
                p_job_status,
                p_error_msg
        ELSE
            UPDATE proc_log
            SET
                RECORDS_INS_UPD = p_rec_ins_upd,
                RECORDS_DELETED = p_rec_deleted,
                JOB_END_TIME = p_end_time,
                JOB_STATUS = p_job_status,
                STEP_ID = p_seq,
                ERROR_MSG = p_error_msg
            WHERE UPPER(TRIM(PROC_NAME)) = UPPER(TRIM(p_proc_name))
            AND STEP_ID = 0
            AND JOB_STATUS = 'RUNNING';
        END IF;
        COMMIT;
        EXCEPTION
            WHEN OTHERS
            THEN NULL;
    END;
    Please help me.
    Thanks.

    ramya_162 wrote:
    Hi,
    I don't want to maintain multiple records for one procedure.
    The log table will grow huge.
    Please help me.
    Thanks.
    You have two options.
    Either a running log, from which you periodically delete old records, or maintain a standing record  for each process you are tracking.
    Ok, let's take the second, since that seems to be your preferred method.
    Going back to your original post, you gave us code and said "I have tried the below code but it's not working properly."
    Please define "not working".  That statement is totally devoid of actionable or diagnostic information. 

  • Logging table for period open/close

    Dear all,
    does anybody know if the BCS maintains a logging table (history) or similar for the activity open/close periods within the Consolidation monitor.
    Thanks in advance!
    Jochen
    Edited by: Jochen Röhr on Aug 3, 2011 2:23 PM
    No ideas from our BCS-Experts?
    Must be a typical question for all BCS application!!!

    Look at /1SEM/UCS* and UCL* tables, you might find some information.

  • Error while maintaining a table in SM30

    Hi experts,
    Im getting the following error when trying to add entries (Maintain) in table T5ASRAUTHMETHOD  in SM30 transaction.
    The error is " The maintenance dialog foor T5ASRAUTHMETHOD is incomplete or not defined".
    Pls tell me how to correct this error.

    Hi Shanthi,
    the Delivery Class, and the existence of a tablemaintenance dialog,
    and the "recording routine" setting. All of this would
    be visible through SE11.
    Regards,
    Md Ziauddin

  • Need suggestion to get data from change log table of ODS.

    Hello,
    There is a case where i am loading opportunity header data from header ODS and opportunity item data from item ODS in the opportunity cube.
    Status (1= OPEN, 2= WON ETC) of the opportunity are available only in header ODS and not in item ODS.
    While loading data from header ODS to cube, I am loading it directly but while loading data from item ODS to cube i am using active data table of header ODS as a lookup in the update rule from item ODS to cube. I am selecting status from the active data table of header ODS while loading data from item ODS to cube.
    Since active data table will have only after image records, there is some data mismatch in the report as i am selecting data from active data table of header ODS while loading data from item ODS to cube.
    I need to select data from Change log in order to get before image also instead of active data table in order to overcome this issue. Is there any way by which i can do selection from Change log instead of active data table as change logs are generated at run time.
    Please let me know if you have any suggestions.
    Regards,
    Sanjay Chaurasia.

    Hi,
    You can use the changelog table of the DSO.
    Right click manage the Header DSO, go to the contents tab and click Change Log table. There you can see the technical name of the Change Log table.
    In the update rule Routine, give the tech name of Change log table instead of Active table name.
    Hope it helps.
    Krishna

  • How can I maintain two tables content at the same time with SM30

    Hi all,
    I created two customizing tables that I would like to link together for maintenance in SM30. Table 1 is the header and table 2 can have multiple detail records.
    They are linked via the ID key field. I would like to run the Table Maintenance Generator on the first table in SE11 and be able to maintain both table data at the same time in SM30.
    How can I do that without any ABAP programming? Should I use Append or Include structure or else?
    Thank you for giving as much detail as possible.
    Regards,
    Sylvain

    Hi,
    You cant do it w/t abap programing.
    You can code in "EVENT" to achive the same.
    Open table maintainance generator of first table through se56 or se11.
    follow the path: environment>Modification>Event.
    Select sutaible event from drop down like Before Save... and do coding.
    In this way data will be saved in second table automatically when you save in first table.
    In case of any query, please revert.
    regards,
    Dhan

  • Creating a new logging table in source

    Hi ,
    I have two relication setup , one is ECC to Ent hana and the other Ecc to BW on hana.
    For ECC to BW on hana , i want to create a seperate logging table in source  to diffrenciate from the two replication.
    Could you please let me know how to do this.
    Thanks,
    Rajiv

    Hi,
    this is unfortunately the wrong community, pls. have a look here: SAP LT Replication Server
    There you can post your question.
    Best,
    Heike

  • Deleting data from a very large log table (custom table in our namespace)

    Hello,
    I have been tasked with clearing a log table in our landscape to only include the most recent entries.  Is it possible to do this given that the table has already got 230 000 000 entries and will need to keep around 600 000 recent entries?
    Should I do this via ABAP and if so, how?  Thanks,
    Samir

    Hi,
    so you are going to keep 0,3 % of your data?
    If you should do it in ABAP or on the database is your decission.
    In my opinion doing things on the database directly should be done
    exceptional cases only e.g. for one time actions or actions that have to
    be done very rarely and with different parameters / options. Regular
    and similar tasks should be done in ABAP i think.
    In any case i would not delete the majority of the records but copy
    the records to keep in an empty table with the same structure, delete the
    table as a whole (check clients!) and "copy" the new table back in ABAP
    or rename the new table to the old table after droping the old table on the database.
    If you have only one client you can copy the data you need in a new
    table and truncate the old table (fast deletion for all clients). If you have
    data to keep  for other clients as well check how much data it is per client
    in comparison to the total number of lines (if only a small fraction, pefer copying
    them too).
    On the database you can use CTAS (create table as select) and drop table and
    rename table. Those commands shoudl be very efficient but work client independently.
    If you have to consider clients SELECT; INSERT; DELETE or TRUNCATE (depends on if you have
    copied all data considering clients) are
    your friends.
    Kind regards,
    Hermann

  • Error log table and output type

    Hi All,
    While creating an invoice(while saving billing document) is it poosible to capture the error in a log in table?
    And how is this error log table related to the output type?
    Thanks

    You seem to be confusing saving of the billing document with creation of the output. These are two independent updates (LUWs). A document may be saved without any output.
    If there are any errors in the billing document creation, the document just won't be created. Such errors should be captured in the log of the Blling Due list, if it's been run properly.
    To update the processing log for the output, use FM NAST_PROTOCOL_UPDATE.

  • How to find out the top ten Change log tables in BW

    I want to know the top ten change log tables in terms of size. Do we have a SAP standard table where we have the following fields : "changlog table name", "number of records" field or "data in size" field.
    Regards,
    Prashant M J

    Hi,
    Click on change log table in the ODS/DSO at the top you see the name as /bic* which is the name of the database table which could also be seen at SE11.
    If you wana see the requests in this change log use rstsodsrequest
    and if you wana see the size in terms of kb, mb DB02 or st04
    use the table name /bic* and click on tables and indexes option in history tab
    DB02 tells you the sizes of the tables present on database. Incase you are not able to your basis team would help you in that
    Thanks and regards
    Kiran

  • How to transfer data in change log table of dso to z-table using abap code

    Hi  can you please explain me how to transfer data in change log table of dso to z-table using abap code ,with out using Function module concept

    PROGRAM NAME:   ZBW_DELTA_TO_GSTAR                                 **
    report ZBW_DELTA_TO_GSTAR no standard page heading
                                     line-size 120
                                     line-count 75
                                     message-id ZBW_MSG_CLS.
    tables:   ZGIV_DLTA_EBV_BB,
              ZGIV_DLTA_EM2_BL,
              ZGIV_DLTA_EM2_BK.
    Selection Screen Definitions
    SELECTION-SCREEN: BEGIN OF BLOCK INNER WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN: SKIP 1.
    PARAMETERS:       EBVBB RADIOBUTTON GROUP ROLL,
                      EM2BL RADIOBUTTON GROUP ROLL,
                      EM2BK RADIOBUTTON GROUP ROLL.
    SELECTION-SCREEN: END OF BLOCK INNER.
    Data:  WS_UPDATE_FLAG  Type C,
           UCounter(9)      Type N,
           ICounter(9)      Type N.
    DATA:  T_ZGIV_DLTA_EBV_BB Type Standard Table of ZGIV_DLTA_EBV_BB,
           s_ZGIV_DLTA_EBV_BB LIKE line of T_ZGIV_DLTA_EBV_BB.
    DATA:  T_ZGIV_DLTA_EM2_BK Type Standard Table of ZGIV_DLTA_EM2_BK,
           s_ZGIV_DLTA_EM2_BK LIKE line of T_ZGIV_DLTA_EM2_BK.
    DATA:  T_ZGIV_DLTA_EM2_BL Type Standard Table of ZGIV_DLTA_EM2_BL,
           s_ZGIV_DLTA_EM2_BL LIKE line of T_ZGIV_DLTA_EM2_BL.
    Standard Internal Tables - Describe usage.
    data: begin of i_AEPSD_O0140 occurs 0.
            include structure /BIC/AEPSD_O0140.
    data: end of i_AEPSD_O0140.
    data: begin of i_AEPSD_O0240 occurs 0.
            include structure /BIC/AEPSD_O0240.
    data: end of i_AEPSD_O0240.
    data: begin of i_AEPSD_O0340 occurs 0.
            include structure /BIC/AEPSD_O0340.
    data: end of i_AEPSD_O0340.
    data: begin of i_GIV_DLTA_EBV_BB occurs 0.
            include structure ZGIV_DLTA_EBV_BB.
    data: end of i_GIV_DLTA_EBV_BB.
    data: begin of i_GIV_DLTA_EM2_BK occurs 0.
            include structure ZGIV_DLTA_EM2_BK.
    data: end of i_GIV_DLTA_EM2_BK.
    data: begin of i_GIV_DLTA_EM2_BL occurs 0.
            include structure ZGIV_DLTA_EM2_BL.
    data: end of i_GIV_DLTA_EM2_BL.
    Miscellaneous Program Variables and Constants.
    TOP-OF-PAGE
    top-of-page.
    START-OF-SELECTION
    start-of-selection.
      Clear: i_GIV_DLTA_EBV_BB,
             i_GIV_DLTA_EM2_BK,
             i_GIV_DLTA_EM2_BL,
             UCounter, ICounter.
      IF EBVBB = 'X'.
        PERFORM 100_EXTRACT_EBV_BB_DELTA_RECS.
      ELSEIF EM2BK = 'X'.
        PERFORM 100_EXTRACT_EM2_BK_DELTA_RECS.
      ELSE.
        PERFORM 100_EXTRACT_EM2_BL_DELTA_RECS.
      ENDIF.
    FORM 100_EXTRACT_EBV_BB_DELTA_RECS
    FORM 100_EXTRACT_EBV_BB_DELTA_RECS.
      Refresh:   i_AEPSD_O0140,
                 i_GIV_DLTA_EBV_BB.
      Clear:      UCounter, ICounter, s_ZGIV_DLTA_EBV_BB .
      Select * From /BIC/AEPSD_O0140
        Into TABLE i_AEPSD_O0140.
      IF SY-Subrc = 0.
        LOOP AT i_AEPSD_O0140.
          MOVE-CORRESPONDING i_AEPSD_O0140 TO s_ZGIV_DLTA_EBV_BB.
          MOVE SY-DATUM to s_ZGIV_DLTA_EBV_BB-create_dt.
          INSERT ZGIV_DLTA_EBV_BB FROM s_ZGIV_DLTA_EBV_BB.
          IF SY-Subrc = 0.
            ICounter = ICounter + 1.
          ELSE.
            UPDATE ZGIV_DLTA_EBV_BB FROM  s_ZGIV_DLTA_EBV_BB.
            IF SY-Subrc = 0.
              UCounter = UCounter + 1.
            ELSE.
              Message E067 with SY-DATUM ' ' SY-UZEIT ' '.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "100_EXTRACT_EBV_BB_DELTA_RECS
    FORM 100_EXTRACT_EM2_BK_DELTA_RECS
    FORM 100_EXTRACT_EM2_BK_DELTA_RECS.
    Refresh:   i_AEPSD_O0240,
               i_GIV_DLTA_EM2_BK.
      Clear:      UCounter, ICounter, s_ZGIV_DLTA_EM2_BK .
      Select * From /BIC/AEPSD_O0240
        Into TABLE i_AEPSD_O0240.
      IF SY-Subrc = 0.
        LOOP AT i_AEPSD_O0240.
          MOVE-CORRESPONDING i_AEPSD_O0240 TO s_ZGIV_DLTA_EM2_BK.
          MOVE SY-DATUM to s_ZGIV_DLTA_EM2_BK-create_dt.
            INSERT ZGIV_DLTA_EM2_BK FROM s_ZGIV_DLTA_EM2_BK.
          IF SY-Subrc = 0.
            ICounter = ICounter + 1.
          ELSE.
            UPDATE ZGIV_DLTA_EM2_BK FROM  s_ZGIV_DLTA_EM2_BK.
            IF SY-Subrc = 0.
              UCounter = UCounter + 1.
            ELSE.
              Message E067 with SY-DATUM ' ' SY-UZEIT ' '.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "100_EXTRACT_EM2_BK_DELTA_RECS
    FORM 100_EXTRACT_EM2_BL_DELTA_RECS
    FORM 100_EXTRACT_EM2_BL_DELTA_RECS.
    Refresh:   i_AEPSD_O0340,
               i_GIV_DLTA_EM2_BL.
      Clear:      UCounter, ICounter, s_ZGIV_DLTA_EM2_BL .
      Select * From /BIC/AEPSD_O0340
        Into TABLE i_AEPSD_O0340.
      IF SY-Subrc = 0.
        LOOP AT i_AEPSD_O0340.
          MOVE-CORRESPONDING i_AEPSD_O0340 TO s_ZGIV_DLTA_EM2_BL.
          MOVE SY-DATUM to s_ZGIV_DLTA_EM2_BL-create_dt.
            INSERT ZGIV_DLTA_EM2_BL FROM s_ZGIV_DLTA_EM2_BL.
          IF SY-Subrc = 0.
            ICounter = ICounter + 1.
          ELSE.
            UPDATE ZGIV_DLTA_EM2_BL FROM  s_ZGIV_DLTA_EM2_BL.
            IF SY-Subrc = 0.
              UCounter = UCounter + 1.
            ELSE.
              Message E067 with SY-DATUM ' ' SY-UZEIT ' '.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "100_EXTRACT_EM2_BL_DELTA_RECS
    END-OF-SELECTION
    end-of-selection.
      perform D1000_REPORT_DATA.
    D1000_REPORT_DATA
    form D1000_REPORT_DATA.
    *Display the title of the program
      write: /25 SY-TITLE.
      skip.
    Diaplay the details of the user and time
      write: /1 'Executed by', 15 SY-UNAME, 30 'Date',
      38 SY-DATUM, 53 'Time', 60 SY-UZEIT.
      skip 2.
      write: /  'Delta Records have been extracted  ',
             /   'Updates : ', UCounter,
             /   'Inserts : ', ICounter.
      skip.
      skip 3.
      write: /20 'End of the report'.
    endform.                                           "D1000_REPORT_DATA
    chgeck it out this also may hep you

  • In LSMW how to maintain Internal table?

    Hiii
      In lsmw data uploading.. it need to maintain internal table manually or it maintaind by SAP ?
    Thanks & Regards
    Arya

    HI
    how to update the existing entry in Ztable through LSMW
    /message/5906806#5906806 [original link is broken]
    Regards
    Pavan

  • DML Error logging table in Set base mode

    Hi all,
    In ETL data errors can be handled thru error logging table. Like this example given in the document-
    INSERT /*+ APPEND PARALLEL */
    INTO sales SELECT product_id, customer_id, TRUNC(sales_date), 3,
    promotion_id, quantity, amount
    FROM sales_activity_direct
    LOG ERRORS INTO sales_activity_errors('load_20040802')
    REJECT LIMIT UNLIMITED
    In this example bulk loading is possible even in the presence of errors. The data errors will go in table 'Sales_activity_errors'.
    I want to generate this kind of coding in OWB in set base mode. For that i have to create a error logging table in target schema. How can I reference this table in a mapping? can it be done by shadow table? It's a very important feature in ETL for bulk loading. Is it available in OWB in set based mode?
    Guyzz please check this out and help me..
    Regards,
    Sumanta

    Hi,
    I am not sure if the DML error logging method is avaliable to be used in OWB 10g R2. You can use the data rule method. Create the data rules on the target table. Deploy it from OWB. Create your mappings and then execute them. Two insert statements will be generated. One for loading the target table for loading records where no rules are violated. The other for loading the <target table>_ERR for loading records where one or more error rules are violated.
    Both these statements do a bulk loading. So your purpose will be solved.
    Again you can use the splitter method that has already been mentioned.
    Regards
    -AP

Maybe you are looking for