Updated records using Dynamic FORMS_DDL

Hello everybody:
I need help for you guys. I'm working with Form9i and created a push button that when I press it, it should be updated some record depending of some conditions. I read that with dynamics FORMS_DDL, I can able to perform it, but when I put the below code in the “WHEN-BUTTON-PRESSED” trigger I get an “Error” that meaning that the forms was not success. Please, somebody tell me where is the error. Thanks.
if (:CONTROL_BTN.CHK_FINAL = 'N') then
     forms_ddl('update aapt_checklists
                                        set achk_reviewed_date = ' || :CONTROL_BTN.DATE_LETTER ||
' where achk_item in (select achk_item
                                        from aapt_checklists, aapt_reviews
                         where ' || :global.where_updated ||
' and achk_reviewed_date is null
and achk_1st_notification_date is null
and arev_seq = achk_arev_seq)     
and achk_1st_notification_date is null
and achk_reviewed_date is null');
end if;
if (form_success) then
     message('OK');
else     
message('Error');
end if;

You don't need dynamic SQL for that. Here is what you can do (Note the new v_fmt variable, and the update SQL below):
DECLARE
  def_where varchar2(500) := NULL;
  v_month varchar2(2)   := :CONTROL_BLOCK.Q_MONTH;
  v_day   varchar2(2)   := :CONTROL_BLOCK.Q_DAY;
  v_year  varchar2(4)   := :CONTROL_BLOCK.Q_YEAR;
  v_fmt   varchar2(10);
  v_date varchar2(20) := NULL;
PROCEDURE check_date (in_date IN varchar2) IS
  al_id     Alert;
  al_button Number;
  temp_date date := NULL;
BEGIN
  temp_date := to_date(in_date, 'MM/DD/YYYY');
EXCEPTION
  when others then
    al_id := Find_Alert('CFG_ERROR');
    Set_Alert_Property(al_id, alert_message_text, 'You have selected an Invalid Date');
    al_button := Show_Alert( al_id );
    raise FORM_TRIGGER_FAILURE;
END;
BEGIN
  -- Criteria entered as MM/DD/YYYY
  if (v_month <> '00') and (v_day <> '00') and (v_year <> '0000') then
    v_date := v_month||'/'||v_day||'/'||v_year;
    v_fmt  := 'MM/DD/YYYY';
    check_date (v_date);
  -- Criteria entered as MM/DD
  elsif (v_month <> '00') and (v_day <> '00') and (v_year = '0000') then
    v_date := v_month||'/'||v_day;
    v_fmt  := 'MM/DD';
    check_date (v_date||'/'||'2000'); -- Hardcoded 2000 to check all possible MM/DD combos including Leap Year
    def_where := ' to_char(arev_appl_received_date, ''MM/DD'') = ''' || v_date || '''';
  -- Criteria entered as MM/YYYY
  elsif (v_month <> '00') and (v_day = '00') and (v_year <> '0000') then
    v_date := v_month||'/'||v_year;
    v_fmt  := 'MM/YYYY';
    def_where := ' to_char(arev_appl_received_date, ''MM/YYYY'') = ''' || v_date || '''';
  -- Criteria entered as MM
  elsif (v_month <> '00') and (v_day = '00') and (v_year = '0000') then
    v_date := v_month;
    v_fmt  := 'MM';
    def_where := ' to_char(arev_appl_received_date, ''MM'') = ''' || v_date || '''';
  -- Criteria entered as DD/YYYY
  elsif (v_month = '00') and (v_day <> '00') and (v_year <> '0000') then
    v_date := v_day||'/'||v_year;
    v_fmt  := 'DD/YYYY';
    def_where := ' to_char(arev_appl_received_date, ''DD/YYYY'') = ''' || v_date || '''';
  -- Criteria entered as DD
  elsif (v_month = '00') and (v_day <> '00') and (v_year = '0000') then
    v_date := v_day;
    v_fmt  := 'DD';
    def_where := ' to_char(arev_appl_received_date, ''DD'') = ''' || v_date || '''';
  -- Criteria entered as YYYY
  elsif (v_month = '00') and (v_day = '00') and (v_year <> '0000') then
    v_date := v_year;
    v_fmt  := 'YYYY';
    def_where := ' to_char(arev_appl_received_date, ''YYYY'') = ''' || v_date || '''';
  end if;
  update aapt_checklists
    set achk_reviewed_date = :CONTROL_BTN.DATE_LETTER
    where achk_item in
    in (select achk_item
            from aapt_checklists, aapt_reviews
            where to_char(arev_appl_received_date,v_fmt) = v_date
                and achk_reviewed_date is null
                and achk_1st_notification_date is null
                and arev_seq = achk_arev_seq)
        and achk_1st_notification_date is null
        and achk_reviewed_date is null;
  --Condition for updated records in aapt.checklists table
  :global.where_updated := def_where;
  --Only when "INCOMPLETE - NEED ADD'L INFO" Status is selected
  def_where := def_where || ' and arev_status = 1427';
END;

Similar Messages

  • Sending mail of infotype record using dynamic actions

    Hi
    How can we send mail of info type record using dynamic actions if possible give me one example
    Mail to me: [email protected]
    Thanks & Regards
    santhosh reddy

    Hi..
    Already Standard Entries exists for the same.. pls check T588Z

  • Update record using SQL statement

    I have VB6.0 and Oracle 10G Express Edition in Windows 2000 Server. My procedure in VB 6.0 can't update record in the table using SQL statement, and the Error Message is " Missing SET keyword ".
    The SQL statement in VB6.0 look like this :
    General Declaration
    Dim conn as New ADODB.Connection
    Dim rs as New ADODB.Recordset
    Private Sub Command1_Click()
    dim sql as string
    sql = " UPDATE my_table " & _
    " SET Name = ' " & Text3.Text & " ' " & _
    " AND Unit = ' " & Text2.Text & " ' " & _
    " WHERE ID = ' " & Text1.Text & " ' "
    conn.Execute (sql)
    Private Sub Form Load()
    Set conn = New ADODB.Connection
    conn.Open "Provider=MSDASQL;" & "Data Source=my_table;"& "User ID =marketing;" & "Password=pass123;"
    I'm sorry about my language.
    What's wrong in my SQL statement, I need help ........ asap
    Best Regards,
    /Harso Adjie

    The syntax should be
    UPDATE TABLE XX
    SET FLD_1 = 'xxxx',
    FLD_2 = 'YYYY'
    WHERE ...
    'AND' is improperly placed in the SET.

  • Updating record using toplink

    Hi,
    By registering the populated java object with the unit of work will insert a new record in the database.How about updating an existing record using UOW?
    If any sample code, it will be very helpful.
    thanks
    vasu

    http://otn.oracle.com/products/ias/toplink/technical/unitOfWorkWP.pdf
    http://otn.oracle.com/products/ias/toplink/index.html
    http://download-west.oracle.com/docs/cd/B10464_01/index.htm

  • Modify IT0001 record using dynamic actions

    Hello Folks,
    I have a requirement to modify the data i.e., P0001-VDSK1=P0001-KOSTL+4(6),
    Whenever Coscenter data changes OrgKey also should be updated with same data.
    KOSTL     06     0           COST CENTER COPY TO VDSK1--
    KOSTL     06     5     P     T001P-MOLGA='21'
    KOSTL     06     10     I     MOD,0001/D
    KOSTL     06     20     W     P0001-VDSK1=P0001-KOSTL+4(6)
    Above code iam able to update Current record only, but it is not updating old records. Please suggest how to update all records also using PSAVE or ..
    Any sample code please.
    -Nishanth

    Hi Nishanth,
    If you are not able to solve it through dynamic actions, check with your technical people to implement user exit enhancement PBAS0001 component ZXPADU02.
    Br/Manas

  • UPDATE records using Database Conectivity toolset

    I´m using LabVIEW 8.5 & Database Connectivity toolset ver 1
    When I try to update a record of a MS ACCESS 2003 with the SQL UPDATE TablenName SET field1=newvalue, field2=newvalue........WHERE condition=x, I get the error -2147217900 Exception occurred in Microsoft Jet DataBase engine: Sintax error in the instruction UPDATE.vi ComExec (8.5 bug Workaround)vi.
    I ´dont think I have made a sintax error. If the field is an string I use the 'newvalue' following by a comma, in case of numeric field just the coma. For instance :
    UPDATE TableName SET Name='John', Age=22,Hair='blond' WHERE height=1.85
    I have discarded the reserved word´s problem, as I can insert records in the data base without any problem 
    Any idea to solve the problem
    Thanks
    Simbani

    Did you try it like this?
    UPDATE TableName SET TableName.Name='John', TableName.Age=22,TableName.Hair='blond' WHERE TableName.height=1.85

  • Updating record using table contorl

    hi ABAPers,
    i have a problem while updating the record to a database table from table control,
    please,check the code writtern,
    Code in Top include:
    Tables: MARA,
            MAKT.
    DATA: BEGIN OF ITAB OCCURS 0,
          MATNR LIKE MARA-MATNR,
          SPRAS LIKE MAKT-SPRAS,
          MAKTX LIKE MAKT-MAKTX,
          END OF ITAB.
    *data:ok_code(20).
    CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 2000.
    *DATA: cols LIKE LINE OF TC1-cols,
         lines TYPE i.
    Screen_1000:Code in PAI:
    module USER_COMMAND_1000 input.
    CASE SY-UCOMM.
    WHEN 'DISPLAY'.
    SELECT SPRAS MAKTX FROM MAKT INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR = MARA-MATNR.
    IF SY-DBCNT IS INITIAL.
    MESSAGE I127(ZKC_MSGCLS).
    ELSE.
    SET SCREEN 2000.
    ENDIF.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    SET SCREEN 0.
    ENDCASE.
    endmodule.                 " USER_COMMAND_1000  INPUT
    Screen_2000:Code in PBO:
    module ctrl_pai output.
    MOVE-CORRESPONDING ITAB TO MAKT.
    endmodule.                 " ctrl_pai  OUTPUT
    Screen_2000:Code in PAI:
    module USER_COMMAND_2000 input.
    CASE SY-UCOMM.
    WHEN 'UPDATE'.
       LOOP AT TC1-cols INTO cols WHERE index GT 2.
           IF  cols-screen-input = '0'.
             cols-screen-input = '1'.
           ELSEIF  cols-screen-input = '1'.
             cols-screen-input = '0'.
           ENDIF.
           MODIFY TC1-cols FROM cols INDEX sy-tabix.
         ENDLOOP.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    SET SCREEN 0.
    WHEN 'BACK'.
    SET SCREEN 1000.
    ENDCASE.
    endmodule.                 " USER_COMMAND_2000  INPUT
    Screen_2000:Code outside PBO
    LOOP AT itab WITH CONTROL TC1 CURSOR TC1-TOP_LINE.
      MODULE ctrl_pai.
    ENDLOOP.
    Screen_2000:Code outside PAI
    LOOP AT itab.
    ENDLOOP.
    regards,
    vinod

    Hi,
    Go thro' the coding in this link.It will help you.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
    Message was edited by:
            Jayanthi Jayaraman

  • How can I  delete and update records using where conditions?

    I want to delete and update the coherence records with some conditions, I describe it to use SQL as follows:
    delete from "contacts" where getStreet() = "dsada";
    update contacts set getStreet() = "dddd" where getCity() = "ssss";
    Can I use the filter like query to achieve this requirement as follows:
    ValueExtractor::View vHomeStateExtractor = ChainedExtractor::create(
    ChainedExtractor::createExtractors("getHomeAddress.getState"));
    Object::View voStateName = String::create("MA");
    Set::View setResults = hCache->entrySet(
    EqualsFilter::create(vHomeStateExtractor, voStateName));
    I know I can use get and put to achieve this requirement , but it Requires a two-interaction between the client and coherence server. Does it have And another way?
    Thanks very much, and please Forgive my English is not very good.

    Hi,
    You have a couple of options for updating or deleting using a Filter.
    For deleting you can use an Entry Processor and the cache invokeAll method. Using "out of the box" Coherence you can use the ConditionalRemove entry processor. I'm a Java person so the C++ below might not be exactly right but you should get the idea.
    ValueExtractor::View vHomeStateExtractor = ChainedExtractor::create(
    ChainedExtractor::createExtractors("getHomeAddress.getState"));
    Object::View voStateName = String::create("MA");
    hCache->invokeAll(EqualsFilter::create(vHomeStateExtractor, voStateName),
    ConditionalRemove::create(AlwaysFilter.getInstance());For update you would either need to write custom Entry Processor implementations that perform the updates you require or you can use out of the box POF or Reflection ValueUpdaters that update specific fields of the entries in the cache. These valueUpdaters would be wrapped in an UpdaterProcessor so the call would be very similar to the code above.
    JK

  • JDBC- How Update record using preparedStatement() into  MS Access?

    Actually i got an error when i update the record,The setString() Parameter are stored in terms of arrays .
    The Error is
    ErrorSQL3.java.sql.SQLException:[Microsoft][ODBC Microsft Access Driver] Syntax Error in UPDATE Statement

    Actually i got an error when i update the record,The
    setString() Parameter are stored in terms of arrays
    The Error is
    ErrorSQL3.java.sql.SQLException:[Microsoft][ODBC
    Microsft Access Driver] Syntax Error in UPDATE
    Statement
    Believe the error message - your SQL syntax is wrong.
    Either fix it or post what you have and get some advice.
    %

  • Update records using Pl/Sql procedure

    Hi
    I have wriitten a stored procedure to update the Organisation_Name in a table based on the Full_Org_Nm of an another table.
    Though the procodure got executed sucessfully but it is not updating the records.
    I even tried executing the procedure by writing Execute <Procedure name>,the database got hanged.
    Please find my procedure below.
    Create or Replace
    PROCEDURE UPDT_ISSUE_USR_ROLE
    As
    Cursor cur_user_role Is
    Select a.org_id,a.user_id
    from prts_user a,issue_user_role b
    where a.user_id=b.user_id;
    v_rows_processed Number:=0;
    Begin
    For rec in cur_user_role Loop
    update Issue_user_role
    set User_org_nm=(Select full_org_nm from VW_Org where org_id=rec.org_id)
    Where Issue_User_Role.rowid in
    (select issue_user_role.rowid
    FROM issue_user_role,issue,issue_workflow,Issue_step_dtl_wrkflw
    Where Issue_User_Role.Issue_Id=Issue.Issue_id
    And Issue_User_Role.Issue_id=issue_workflow.issue_id
    And Issue_User_Role.Workflow_compnt_id=Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID
    And Issue_User_Role.Workflow_compnt_id=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
    And Issue_User_Role.Issue_id=Issue_Step_Dtl_wrkflw.Issue_Id
    And Issue.Issue_id=Issue_workflow.Issue_Id
    And Issue.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
    And Issue_workflow.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
    And Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
    And issue_workflow.primry_workflow_flag='Y'
    And issue_user_role.user_id = rec.user_id
    And issue.issue_status_id in (1636,50738,275,50737,2090)
    And issue_step_dtl_wrkflw.Issue_step_status_id in (61248,61249,61250));
    v_rows_processed :=v_rows_processed + SQL%ROWCOUNT;
    End Loop;
    COMMIT;
    dbms_output.enable;
    dbms_output.put_line('There were '||v_rows_processed||' rows updated');
    End;
    Please let me know where i am wrong.
    Thanks in advance.
    Cheers

    Hi Blushadow
    Now if i want to update say only 10 records at a time what should i put into my Proc?
    Please go thru my Proc below..
    CREATE OR REPLACE PROCEDURE PRTS.UPDT_ISSUE_USR_ROLE
    As
    Cursor cur_user_role Is
    Select a.org_id,a.user_id
    from prts_user a,issue_user_role b
    where a.user_id=b.user_id;
    upd_rec cur_user_role%rowtype;
    v_rows_processed Number:=0;
    Begin
    Open cur_user_role;
    Loop
    Fetch cur_user_role into upd_rec;
    If cur_user_role%NOTFOUND
    Then
    Exit;
    Else
    update Issue_user_role
    set User_org_nm=(Select full_org_nm from VW_Org where org_id=upd_rec.org_id)
    Where Issue_User_Role.rowid in
    (select issue_user_role.rowid
    FROM issue_user_role,issue,issue_workflow,Issue_step_dtl_wrkflw
    Where Issue_User_Role.Issue_Id=Issue.Issue_id
    And Issue_User_Role.Issue_id=issue_workflow.issue_id
    And Issue_User_Role.Workflow_compnt_id=Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID
    And Issue_User_Role.Workflow_compnt_id=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
    And Issue_User_Role.Issue_id=Issue_Step_Dtl_wrkflw.Issue_Id
    And Issue.Issue_id=Issue_workflow.Issue_Id
    And Issue.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
    And Issue_workflow.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
    And Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
    And issue_workflow.primry_workflow_flag='Y'
    And issue_user_role.user_id = upd_rec.user_id
    And issue.issue_status_id in (1636,50738,275,50737,2090)
    And issue_step_dtl_wrkflw.Issue_step_status_id in (61248,61249,61250));
    v_rows_processed :=v_rows_processed + SQL%ROWCOUNT;
    If Mod (v_rows_processed,v_rows_processed)=10
    then
    COMMIT;
    End if;END IF;
    End Loop;
    Commit;
    dbms_output.enable(1000000);
    dbms_output.put_line('There were '||v_rows_processed||' rows updated');
    Close cur_user_role;
    End;
    I would appreciate if you can let me know any other alternative way to meet this requirment.
    Cheers
    Vineet

  • Updating records using self join or row number function

    IF OBJECT_ID('tempdb..#Temp') IS NOT NULL DROP TABLE #Temp
    GO
    CREATE TABLE #Temp
    ID INT
    , CYear INT
    , Val INT
    , Descrp Varchar(10) NULL
    , Cd INT
    , ToBeUpdated Varchar(5) NULL
    INSERT INTO #Temp
    ID
    , CYear
    , Val
    , Descrp
    , Cd
    , ToBeUpdated
    SELECT 2014, 2013, 111, 'ABC', 2, NULL
    UNION
    SELECT 2014, 2014, 111, 'XYZ', 2, NULL
    UNION
    SELECT 2014, 2014, 222, 'TTT', 3, NULL
    UNION
    SELECT 2014, 2013, 333, 'ZZZ', 4, NULL
    UNION
    SELECT 2014, 2014, 333, 'VVV', 5, NULL
    SELECT * FROM #Temp
    ORDER BY Val, CYear
    All, I have the above #table. You'll notice that there are duplicate values in "Cd" column i.e. "Cd=2".
    If the values in ID, Val and Cd are same then, I want to update the "CodeFlag" column for those records with "Descrp" column of
    the recent CYear. So, my "ToBeUpdated" column would have a value of "XYZ" for both the records where Cd=2 (Since, XYZ is the Descrp for CYear 2014(the latest one))
    Also, if the values in ID and Val column are same but values in "Cd" is different, then ToBeUpdated = Descrp of that particular record. In my case the "ToBeUpdated" value for Cd=4 would be "ZZZ" and for Cd=5, it would be "VVV"
    since the ID and Val column values are same for those records. Let me know if you have any questions.

    IF OBJECT_ID('tempdb..#Temp') IS NOT NULL DROP TABLE #Temp
    GO
    CREATE TABLE #Temp
    ID INT , CYear INT , Val INT , Descrp Varchar(10) NULL , Cd INT , ToBeUpdated Varchar(5) NULL)
    INSERT INTO #Temp
    ID , CYear , Val , Descrp , Cd , ToBeUpdated)
    SELECT 2014, 2013, 111, 'ABC', 2, NULL
    UNION
    SELECT 2014, 2014, 111, 'XYZ', 2, NULL
    UNION
    SELECT 2014, 2014, 222, 'TTT', 3, NULL
    UNION
    SELECT 2014, 2013, 333, 'ZZZ', 4, NULL
    UNION
    SELECT 2014, 2014, 333, 'VVV', 5, NULL
    ;with mycte as (SELECT *, row_number() Over(partition By ID, Val , Cd order by CYear DESC) rn
    , row_number() Over(partition By ID, Val order by Descrp) rn1
    FROM #Temp)
    SELECT m1.ID ,m1.CYear,m1.Val,m1.Descrp , ToBeUpdated=d.descrp from mycte m1
    Cross apply (Select Top 1 descrp from mycte m2 WHERE m2.id=m1.ID AND m1.Val=M2.Val AND m1.cd=m2.cd AND m1.rn>=m2.rn) d(descrp)

  • Updating records using a view

    Hello,
    I have two tables, ROAD and ROAD_PARSED. I have created a view ROAD_V that contains the fields from ROAD and ROAD_PARSED that I want to to update in ROAD.
    CREATE VIEW ROAD_V AS SELECT A.ID, A.PREF, A.NAME, A.TYPE, A.DIR,  B.PREF "BPREFIX", B.NAME "BNAME",  B.TYPE "BTYPE", B.DIR "BDIR"
    FROM ROAD A, ROAD_PARSED B
    WHERE A.ID=B.ID;
    Then I entered my update statement: UPDATE ROAD_V SET PREF=BPREFIX, NAME=BNAME, TYPE=BTYPE, DIR=BDIR;
    I got this error: +"ORA-01779: cannot modify a column which maps to a non key-preserved table".+ ROAD has a spatial index on ID and ROAD_PARSED has a unique on ID, and there are not other unique fields in my table. How do I go about adding a unique index to ROAD when i have already indexed ID?
    The only thing I can think of to work around it is to create a new field in ROAD, populate it with a sequence starting at 1 and assign a unique index to it, insert those values into ROAD_PARSED, and then run the update. This sounds unnecessary...but is it the right way?

    Hi Beaver,
    You can find examples and explanations regarding your error here:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:548422757486
    and/or
    http://asktom.oracle.com/pls/asktom/asktom.search?p_string=%22ORA-01779%22

  • How to add a new record in updatable report using apex_item

    Hi,
    i am using an updatable report using the following select
    select
    aPEX_ITEM.POPUP_FROM_QUERY(2,emp_code,
    ' SELECT emp_surname, emp_code FROM hrm_employee ' ,null,null,null,null,null,'onchange="f_set_multi_items_tabular(this.value ''#ROWNUM#'''
    || ')"',null,null,null) PF_No,
    apex_item.text (32,
    NULL,
    80,
    100,
    'style="width:190px" ',
    'f11_' || '#ROWNUM#'
    ) Name,
    " REST_DATE",
    "REMARKS",
    from "roster"
    when i click on the button add row , only the column rest_date and the remarks are enable.
    why is the apex_item.text and apex_item_popup_from_query is disable ? and how i can make it enable.
    thanks
    regards
    jerry

    I could see that you are using the addRow() function to generate new blank row.
    I guess, this function(used by the builtin tabular form s) , identifies editable columns when they are marked so at the report column attributes.
    When you use apex_item API, it expects the columns to be standard report column and hence render the new rows as such.
    Some one from the development team might be able to give a better answer on that.
    As for avoiding this issue
    <li>One method , would be to define the columns editable(and display types) in report column attributes.
    <li> You can duplicate the last row using jQuery( *$('tr.highlight-row:last).after( $('tr.highlight-row:last).clone() )* ) and removing the field values, but events(for example datepicker) would remain attached to the original row , so it isn't very straightforward either.
    <li>If you want to use apex_item you would have to use a pseudo union to DUAL for generating a blank row and re-render the report either by a page load or a Dynamic Action. Sounds like a nice idea for a plugin.
    Now , if you want to add rows multiple times without saving them, then you would need to store the values in a collection at load and update the collection before adding the row.

  • Shot Dump while updating record in ETTIFN using the FM ISU_DB_ETTIFN_UPDATE

    Hi All,
    Am getting shot dump while trying to update an entry in ETTIFN database table using the FM ISU_DB_ETTIFN_UPDATE.
    If this FM fails to update then it tries to  raise error message using the macro 
    MAC_MSG_PUTX CO_MSG_PROGRAMMING_ERROR '016' 'E9'
           'ETTIFN' SPACE SPACE SPACE
           SPACE .
    Runtime Errors         MESSAGE_TYPE_X
    Error analysis
        Short text of error message:
        Error in changing table ETTIFN
        Long text of error message:
         Diagnosis
             An error occurred when one or more table entries were being
             changed. This error was reported by the database system.
         System Response
             The system does not permit changes to one or more table entries.
             It is possible that an SAP short dump has been written from the SAP
             basis system.
         Procedure
             Find out if the SAP short dump provides additional information.
             You can view SAP short dumps using Transaction SM21.
        Technical information about the message:
        Message class....... "E9"
        Number.............. 016
        Variable 1.......... "ETTIFN"
        Variable 2.......... " "
        Variable 3.......... " "
        Variable 4.......... " "
    Please advice inorder to fix the same.
    Regards,
    Deepthi

    Hi Deepthi,
    Updating database using statement update can give dumps because of below issues:
    "At least one line was not able to be changed, either because no appropriate line was found, or because the change would generate a line that leads to double entries in the primary key or a unique secondary index in the database table."
    I would rather suggest you to call the FM in Mode 'M', i.e. Modify so if entry in table is not there to update, it will insert that record and also won't give dump.
    Thanks.
    Ravi

  • Updating a record using pay element using the API (Almost Done)

    Hi Everyone,
    I have a question about updating a record using the PAY_ELEMENT_ENTRY_API.update_element_entry
    I have process that doesn't error out, but its doesn't seem to update the record. So my question is, is the query below the correct way to get the element name and object version number when using this API? If not, what do I need to do?
    BEGIN
    SELECT MAX(pee.element_entry_id)
    INTO x_element_id_mgr
    FROM pay_element_types_f pet,
    pay_element_links_f pel,
    pay_element_entries_f pee,
    per_all_assignments_f paaf,
    per_all_people_f papf
    WHERE pee.element_link_id = pel.element_link_id
    AND pel.element_type_id = pet.element_type_id
    AND paaf.assignment_id = pee.assignment_id
    AND papf.person_id = paaf.person_id
    AND pet.element_name = 'Mgr Rec Pct'
    AND sysdate BETWEEN pee.effective_start_date AND pee.effective_end_date
    AND sysdate BETWEEN pel.effective_start_date AND pel.effective_end_date
    AND sysdate BETWEEN pet.effective_start_date AND pet.effective_end_date
    AND sysdate BETWEEN paaf.effective_start_date AND paaf.effective_end_date
    AND sysdate BETWEEN papf.effective_start_date AND papf.effective_end_date
    AND paaf.assignment_id = c_staging.assignment_id
    AND papf.person_id = c_staging.person_id;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    --ROLLBACK TO s1;
    v_error_message := 'For employee number '||c_staging.employee_number||' No data found for element name Mgr Rec Pct' || SUBSTR(sqlerrm, 1, 200);
    DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
    WHEN OTHERS THEN
    --ROLLBACK TO s1;
    v_error_message := 'For employee number '||c_staging.employee_number||' Error found for element name Mgr Rec Pct' || SUBSTR(sqlerrm, 1, 200);
    DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
    END;
    --- Get OVN
    BEGIN
    SELECT MAX(Object_version_number)
    INTO x_ele_object_version_number
    FROM pay_element_entries_f
    WHERE element_entry_id = x_element_id_mgr;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    v_error_message := 'For employee number '||c_staging.employee_number||' Error in getting the OVN for Mgr Rec Pct ' || SUBSTR(sqlerrm, 1, 200);
    DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
    WHEN OTHERS THEN
    v_error_message := 'For employee number '||c_staging.employee_number||' Error in getting the OVN for Mgr Rec Pct' || SUBSTR(sqlerrm, 1, 200);
    DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
    END;

    Your SQL isn't bad, although you're including loads of tables you don't need to so it's probably not as fast as it could be. I'm not sure you know what element entry to update so let's look at an example:
    -- | Element Entry Id | OVN | Start Date | End Date    | Pay Value |
    -- +------------------+-----+------------+-------------+-----------+
    -- | 123                2    1-Jan-2009   31-Jan-2011   USD 400
    -- | 123                1    1-Feb-2009   18-Jun-2011   USD 500
    -- | 123                1    19-Jun-2011  25-Jun-2011   USD 600
    -- | 123                5    26-Jun-2011  31-Dec-4712   USD 700Here the one element entry (Id 123) has 4 effective rows. The employee gets $400 in Jan 2009, $500 from Feb 2009 to mid-June 2011, $600 for a few days later in June 2011 and then $700 from 26th June 2011 onwards.
    So your question to the forum is which one do I update. Well, that depends which one you want to update. If you want to update the 1st Jan 2009 to 31st Jan 2011 you'd pass element_entry_id => 123, ovn => 2, effective_date => to_date('1-Jan-2009', 'DD-MON-YYYY') and datetrack_mode => 'CORRECTION'.
    If you wanted to update the $700 row you'd pass OVN 5 and an effective date of 26th June 2011. And so-on.
    Now in your SQL you're filtering based on sysdate, which means you'd be updating the $500 row (ovn=1). Is that what you want?
    I have simplified your SQL as follows:
    SELECT pee.element_entry_id
          ,pee.object_version_number
    INTO   x_element_id_mgr
          ,x_ele_object_version_number
    FROM   pay_element_entries_f pee
          ,pay_element_types_f pet
    WHERE  pee.assignment_id = c_staging.assignment_id
    AND    pee.element_type_id = pet.element_type_id
    AND    pet.element_name = 'Mgr Rec Pct'
    AND    trunc(sysdate) BETWEEN
           pee.effective_start_date AND pee.effective_end_date
    AND    trunc(sysdate) BETWEEN
           pet.effective_start_date AND pet.effective_end_date;This selects both the entry Id and OVN in one go; there's no need to have 2 SQL statements. If multiple entries are allowed, this SQL could return more than one row so just watch out for that. If you don't want the row as of sysdate change the two sysdate joins accordingly.
    I hope that helps.

Maybe you are looking for

  • If I move my iTunes media folder to the Shared folder....

    Hello I'd like to share my music libary with my wife's user account on our MacBook Pro so she can get some of my music onto her iPhone. I've read the article on the Apple site as well as similar articles from other reputable Mac user websites and it

  • How do I set the default welcome page for PUBLIC user

    gurus, i'm using - Oracle 9i Database Oracle 9ias Portal Release 2 QUESTION => how do I set the default welcome page for the PUBLIC user. i did the following to achieve this - 1. logged into portal 2. clicked on builder 3. clicked on administer tab 4

  • Calling a method in BPM Object from jsp page

    hi all, I try to call a method from BPM Object using <f:invokeUrl > I change server side method properties to yes. and then how can i get request and response object inside the BPM method. Thanks.

  • Mac Mini and Samsung 42" Plasmas

    I'll be purchasing a Samsung HP-T4234 plasma soon and have noticed it will handle a PC signal of 1024x768. I realize it's not a very sharp resolution, but will it fill the entire widescreen? IT won't need to be stretched, will it? I'm not too sure of

  • On cell action in webdynpro

    Hello all, i have a requirement in webdynpro where i have a table with three fields UID,First name and lastname. there is a f4 help for UID if i select the uid its respective firdt name and last name should appera in the next two fields of the table.