Reorder upd.,ins. records after pressing commit (forms 6i) is it possible=

Hello, looking for simple way or is it possible to reorder saving of records in a block.
(FORMS 6i)
Something like this:
1)I have detail block DB table (after Database query the data is) :
abc_fk , abc_order, abc_text
001 01 some text1
001 02 some text2
001 03 some text3
001 04 some text4
2)Now the user, wants to add new text after 1st line. I reorder the abc_order fields to
001 01 some text1
*001 02 NEW RECORD <-- new user input.*
001 03 some text2
001 04 some text3
001 05 some text4
After pressing commit button i get constrain error (uniqe key: abc_fk , abc_order).
Commiting process is going from top down , is it possible from buttom-up?
Now what happans is: forms put UPDATE on new record: 001 03 some text2 /when in database allready exsists record with same (sq, and order) that's: 001 03 some text3, so i get constrain error. (both record have same values: 001,03)
If forms could save records starting with
update 001 05 some text4,
update 001 04 some text3,
update 001 03 some text2,
insert *001 02 NEW RECORD <-- new user input.*
the problem is solved. Is this possible, to change order of saving?
Thank you for any help. :)

Hey, your update kind'a work :)
If user inserts and updates (in between) more then one row.. the order changes...(not the way it shows on the screen)
picture this DB table:
001 01
<-------- insert here (new record 2)
001 02
001 03
001 04
<-------- insert here (new record 6)
001 05
001 06
AFTER COMMIT WE GET:
001 01
<-------- insert here (new record 2) ok 001 08
001 03
001 04
001 05
001 06
<-------- insert here (new record 6) not ok 001 07
001 08
So in pre-insert trigger how can i/we/you/program know that it should do :)
UPDATE TABLE_NAME
     SET abc_order = abc_order + 1
     WHERE abc_fk >= '002'
     AND abc_order >= '05' and not ... AND abc_order >= '06' (which is the current new value of newly 2nd inserted statment
I changed pre-insert to:
     UPDATE abc
     SET abc_sq =:abc.abc_sq + 1
     WHERE abc_id = :abc.abc_id
     AND abc_sq >= :abc.abc_sq;
So i am still asking if it's possible, to change order of FORMS commitng from top-down to buttom - up. :)
I still want to know if there si a chance to change forms order of saving to save records starting with:
update 001 05 some text4,
update 001 04 some text3,
update 001 03 some text2,
insert 001 02 NEW RECORD <-- new user input.
Abut datatype you are right. We all use pading, and it's old database/table..

Similar Messages

  • Updating status of multiple records after saving the form

    Hi all
    I have a tabular form
    It has a column status (new,good ,very good ,excellent are the list options)
    The user goes and modifies a number of records on the detail block and saves the records
    what i want to do is that when the user clicks the save button after updating any number of records
    the status field should be updated with the value (new)
    the status field of those records should be updated with the new value which the user has modified not all the records
    Please let me know how to go about it
    thanks
    Edited by: bindok mulga on May 11, 2009 3:48 PM
    Edited by: bindok mulga on May 11, 2009 3:50 PM

    Hi
    actually my earlier post was incorrect
    i have edited my post
    Actually
    i want to update only those records that the user has modified
    eg
    col1 col2 status
    1 ABC good
    2 PQR good
    3 xyz good
    4 lmn excellent
    5 abcz excellent
    is the table before the user modifies
    the user goes and modifies multiple records as following
    col1 col2 status
    1 aaa good
    2 PQR good
    3 xxx good
    4 sss excellent
    5 abcz excellent
    and the user saves the form
    now i want the following output
    col1 col2 status
    1 aaa new
    2 PQR good
    3 xxx new
    4 sss new
    5 abcz excellent
    only the modified record's status should be updated
    sorry for the earlier lapse

  • Problem displaying drill down STANDARD ALV for a particular record after pressing back button

    I have a simple interactive ALV grid report. NOT 'OO'. It display correctly on initial execution. AT the moment, 6 records. I want it to work such that if i click record '1', a drill-down version of that ALV with only that one record clicked is displayed. This currently occurs correctly. The problem arises when i click the back button and want to click on a new record, say in the 2nd row..this new 2nd row record is not displayed. The first one is displayed again. I tried clearing and fiddling around but then the last record is displayed. I have used the 'ID' field as a 'hotspot' getting picked up by sy-tabindex. Maybe it could be that i shouldn't loop and use  a work area e.g in my select statement. i'm not so sure i've looked around, and tried a few things. I can't get it right yet. My code is below:
    *& Report  ZALV
    REPORT  ZALV.
    TABLES: ZCONTACT.
    TYPE-POOLS: slis. "slis contains all of the ALV data types.
    TYPES: BEGIN OF ty_zcontact.
             INCLUDE STRUCTURE zcontact.
    TYPES: icon TYPE char4, "field holding traffic light value- adding a column to internal table to hold the traffic light
             END OF ty_zcontact.
    DATA: "fieldcatALOG TYPE slis_t_fieldcat_alv WITH HEADER LINE,
           it_zcontact TYPE TABLE OF ty_zcontact,"declares an internal table of type ZCONTACT
           wa_zcontact TYPE ty_zcontact,
           gd_layout TYPE slis_layout_alv,
           gd_repid LIKE sy-repid,
           g_variant TYPE disvariant,
           gx_variant TYPE disvariant,
           g_save TYPE c VALUE 'X',
           it_fieldcat TYPE slis_t_fieldcat_alv,"declares field catalog table of line type alv
           wa_fieldcat TYPE slis_fieldcat_alv, "declares the work area of the field catalog
           it_list_top_of_page TYPE slis_t_listheader.
    DATA: it_fieldcat1 TYPE slis_t_fieldcat_alv,
           wa_fieldcat1 TYPE slis_fieldcat_alv.
    DATA: V_FIELD(30) TYPE C,
    V_VALUE(10) TYPE C.
           "izontact TYPE TABLE OF zcontact.
            "i_logo TYPE OT.
           "ls_layout TYPE slis_layout_alv.
    **Selection Screen details
    *SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    *PARAMETERS: variant like disvariant-variant.
    *SELECTION-SCREEN END OF BLOCK B1.
    SELECT-OPTIONS:
    age FOR wa_zcontact-age,
    lastnme FOR wa_zcontact-lastname.
    **Getting default variant
    *  AT SELECTION-SCREEN ON age.
    *    SELECT SINGLE age FROM zcontact INTO wa_zcontact-age WHERE age = age.
    *  IF sy-subrc NE 0.
    *    MESSAGE:'That age does not exist mate, Please enter another age' TYPE 'E'.
    *    ENDIF.
    INITIALIZATION.
    *gx_variant-report = sy-repid.
    *CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    *EXPORTING
    *  I_SAVE = G_SAVE
    *  CHANGING
    *    CS_VARIANT = GX_VARIANT
    *  EXCEPTIONS
    *    NOT_FOUND = 2.
    *IF SY-SUBRC = 0.
    *  VARIANT = GX_VARIANT-VARIANT.
    *  ENDIF.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_FIELDCATALOG.
      PERFORM DISPLAY_ALV_REPORT.
      PERFORM top_of_page.
    "g_repid = sy-repid.
    *Fetch data from the database
    FORM DATA_RETRIEVAL.
    SELECT * FROM zcontact INTO TABLE it_zcontact WHERE age IN age AND lastname IN lastnme.
    "assigning traffic light colour to each row based on a condition
    *  IF wa_zcontact-age GE 65.
    *   wa_zcontact-icon = 1. "Red Traffic Light
    *   ELSEIF wa_zcontact-age BETWEEN 40 AND 64.
    *     wa_zcontact-icon = 2. "Yellow traffic light
    *     ELSE.
    *       wa_zcontact-icon = 3." Green traffic light
    *       ENDIF.
    *       MODIFY it_zcontact FROM wa_zcontact TRANSPORTING icon.
    *       CLEAR wa_zcontact.
    ENDFORM.
    FORM BUILD_FIELDCATALOG.
    *Build field catalog
    wa_fieldcat-fieldname = 'ID'.
    "wa_fieldcat-seltext_m = 'The Contact ID'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'LASTNAME'.
    "wa_fieldcat-seltext_m = 'Contact Lastname'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'FIRSTNAME'.
    "wa_fieldcat-seltext_m = 'Contact Firstname'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'DOB'.
    "wa_fieldcat-seltext_m = 'Date Of Birth'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'TEL'.
    "wa_fieldcat-seltext_m = 'Telephone Number'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'ADDRESS'.
    "wa_fieldcat-seltext_m = 'The Address'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'OCCUPATION'.
    "wa_fieldcat-seltext_m = 'The Occupation'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'WEIGHT'.
    "wa_fieldcat-seltext_m = 'WEIGHT'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'AGE'.
    "wa_fieldcat-seltext_m = 'AGE OF THE CONTACT'.
    wa_fieldcat-do_sum   = 'X'.        "Display column total
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'SALARY'.
    "wa_fieldcat-seltext_m = 'SALARY'.
    wa_fieldcat-do_sum   = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.
    gd_layout-lights_fieldname = 'ICON'.
    ENDFORM.
    FORM DISPLAY_ALV_REPORT.
    gd_repid = sy-repid.
    *Pass data and field catalog to ALV function module to display ALV list
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
           it_fieldcat            = it_fieldcat
           i_callback_program     = gd_repid
           i_callback_top_of_page =  'TOP_OF_PAGE'
           i_callback_user_command =  'USER_COMMAND'
           i_structure_name       =  'ZCONTACT'
           i_save                 = 'X'
           is_variant             = g_variant
           is_layout     = gd_layout
    TABLES
           t_outtab      = it_zcontact
    EXCEPTIONS
           program_error = 1
           OTHERS        = 2.
    ENDFORM.
    FORM top_of_page.
    *ALV Header declarations
       DATA: it_listheader TYPE slis_t_listheader,
             wa_listheader TYPE slis_listheader,
             t_line like wa_listheader-info,
             ld_lines TYPE I,
             ld_linesc(10) TYPE C.
    wa_listheader-typ = 'H'.
    wa_listheader-info = 'Contact Details'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-info = sy-repid.
    wa_listheader-key = 'Program Name:'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-info = sy-uname.
    wa_listheader-key = 'User Name:'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-key = 'Run Date :'.
    CONCATENATE sy-datum+6(2)
                 sy-datum+4(2)
                 sy-datum(4)
                 INTO wa_listheader-info
                 SEPARATED BY '/'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-key = 'Time :'.
    CONCATENATE sy-uzeit(2)
                 sy-uzeit+2(2)
                 sy-uzeit+4(2)
                 INTO wa_listheader-info
                 SEPARATED BY ':'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
       CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
         EXPORTING
           it_list_commentary = it_listheader
           i_logo = 'KLOGO'.
    ENDFORM. "top_of_page
    *& Form sub_user_command
    FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
    P_SELTAB TYPE SLIS_SELFIELD.
    CASE P_UCOMM.
       WHEN '&IC1'.
    CASE p_seltab-fieldname.
       WHEN 'ID'.
       READ TABLE it_zcontact INTO wa_zcontact INDEX p_seltab-tabindex.
       PERFORM DATA_RETRIEVAL1.
       PERFORM BUILD_FIELDCATALOG1.
       PERFORM SECOND_GRID.
       ENDCASE.
       ENDCASE.
    ENDFORM. "
    FORM DATA_RETRIEVAL1.
    SELECT * FROM zcontact INTO TABLE it_zcontact WHERE id EQ wa_zcontact-id.
    ENDFORM.
    FORM BUILD_FIELDCATALOG1.
    *Build field catalog
    CLEAR: wa_fieldcat, it_fieldcat.
    wa_fieldcat-fieldname = 'ID'.
    "wa_fieldcat-seltext_m = 'The Contact ID'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'LASTNAME'.
    "wa_fieldcat-seltext_m = 'Contact Lastname'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'FIRSTNAME'.
    "wa_fieldcat-seltext_m = 'Contact Firstname'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    ENDFORM.
    FORM SECOND_GRID.
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM = SY-REPID
         IT_FIELDCAT = IT_FIELDCAT
         i_structure_name       =  'ZCONTACT'
         i_callback_user_command =  'USER_COMMAND'
         TABLES
           T_OUTTAB = IT_ZCONTACT.
       ENDFORM.

    Hi Ten Mariga,
                     I wonder why the second select Query is needed at all instead you can use
    ---> Not Needed
    FORM DATA_RETRIEVAL1.
    SELECT * FROM zcontact INTO TABLE it_zcontact WHERE id EQ wa_zcontact-id.
    ENDFORM.
    ----> Instead you can do
       READ TABLE it_zcontact INTO wa_zcontact INDEX p_seltab-tabindex.
      Append wa_zcontact to Second_table.
    And you can use the Second_table to display the second ALV. The second Select Query will affect the performance too.
    Cheers,
    Krishnakumar B.

  • Screen recording, how to press record after pressing stop?

    When I do a Quicktime screen recording, I can pause the recording by use the "alt" key to make the stop button become a pause button.
    However, when I click the stop button the recording is considered finished and recording cannot be re-started.
    Is there a way to click "record" again after clicking "stop" to add more recording to the end of the video?

    Please help with the above question...

  • Save Records by using F10 and after pressing F10 it display another form?

    hello all
    is it possible to save records by pressing f10 key and after commit it display another form? if yes then help me
    sarah

    Hi,
    In the KEY-COMMIT trigger of the form write the code,
         COMMIT;
         NEW_FORM('<form_name>'); -- Or any other form opening built-ins like OPEN_FORM, CALL_FORM etc.Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • Getting message for every record while pressing down arrow key:apps form

    Hi,
    when i query the form and when I am going through the records by pressing the down arrow of the keyboard I am getting the message 'Do you want to Save the records' for every record even though i did not update any record
    How to avoid the message?
    I developed the form in oracle applications and it is a master detail form which have a header block and lines block.
    thanks & regards
    Deekshit

    Hello,
    You can review the following;
    https://metalink.oracle.com/metalink/plsql/f?p=200:27:627127677634310554::::p27_id,p27_show_header,p27_show_help:173383.995,1,1
    Hope it helps.
    Adith

  • Problem (implicit commit) after calling  POP UP in f-43 after pressing SAVE

    Hi all ,
    I have done an enhancement for F-43 after pressing SAVE a pop up will be given to enter amount after entering the amount the user will press enter then i check the amount entered if the value is incorrect then i through an error message so the document should not be posted.
    But the issue is the document no is generated or fetched from number range before my enhancement but not commited in NRIV, and when the popup is called , the DOCUMENT no is commited as after the call screen a new LUW is started.
    Iam thinking calling the popup before the DOCUMENT NO is generated or fetch from number range.
    Any solution to resolve this .
    Regards,
    Madhukar Shetty

    Hi Madhukar Shetty,
    For your requirement you can use interface BTE 1020 which gets triggered just before save. Keep your condition based on SY-UCOMM as it will get triggered for Simulate & Save modes. At this point of time system will not have any document number and you can raise any error as well, coz system has not saved anything.
    Thanks & Regards,
    Faheem.

  • Refresh table and display the records after insertion of data from back end

    Hi Experts,
    JDEV 11.1.2.1
    I have a useacase which needs data to be inserted from oracle back end procedure and displayed in a ADF Table Component, when a button is pressed.
    is this possible?..if yes , how?
    Is view object will automatically refreshed and fetches newly created(from back end) rows?
    thankz in advance
    PMS

    Hi user707,
    thankz for ur reply....
    i think after executing a procedure you want to call commit operation. better you can perform this.getDbtransaction().commit In Application Module;yes i want to commit transaction after executing back end procedure using preparedStatement.Procedure is for inserting data into same table , which used for creating VO and Read only ADF Table.Procedure is executed fine, but newly created records are not getting into ADF table.Once i did commit opeartion inside back end procedure, whole records are getting into ADF Table.
    Is there any way to get whole records without doing Commit operation inside Back end procedure?
    PMS

  • Reflecting changes after closing the form..

    Hi all
    I have a procedure
    in that procedure i have used go_block
    i want to call the procedure when the user is exiting
    let me give u a senario
    scene 1)
    the user is inserting a record after the insertion that procedure is to be called to adjust the values on the form.
    after the user enters the values for the new record and clicks save button it works fine
    i have called the procedure in key-commit
    scene 2)
    the user enters a new record and instead of clicking save closes the form
    oracle asks if the user wants to save the changes
    the user clicks yes
    the record is saved
    but the procedure does not fire as the code is written in key comit
    and hence when the user opens the form the next time the changes are not reflected.
    to overcome this i have tried writing the procedure in pre-commit,post_form_commit but it seems that because there is go_block in the procedure it says illegal rescricted procedure go_block in the triger.
    i also tried using the times
    but the timer wont fire as i am closing the form..
    please can any one help me in this situation ..
    thanks
    mandar

    Hello,
    Write your code in a stored unit, then call it from the KEY-COMMIT and KEY-EXIT trigger.
    Francois

  • How to enable Multi-record select in Oracle Forms

    Hi
    we recently upgraded to R12 -- 12.1.3.
    we have a requirement in which I should let the users select multiple records in a tabular Form (custom form).
    Currently we have a custom form that displays Open sales orders with credit holds. After selecting the record, the user can release the hold on the order by clicking on a button. The requirement is for enabling selection of multiple records and release.
    We have a similary functionality in 'Quick Sales Orders' form. In this form, multiple lines can be selected by pressing 'CTL' and clicking on the records.
    I read about using APP_MULTI for this. But I couldnt figure out how to enable the multiple selection.
    If someone could throw some light on this, it would be greatly helpful

    See http://stackoverflow.com/questions/3291758/how-do-i-use-the-app-multi-package-to-support-multi-selection-in-my-oracle-form for steps/sample code.
    Sandeep Gandhi

  • Which trigger fires after pressing 'Save' button on toolbar.

    hi,
    I wanted to know which triggers get fired after pressing 'save' button on toolbar, and in which sequence it get's fired.

    When you press 'save' it tries to do a commit_form.
    Before commiting the form, it checks for any errors which might occur at form level, block level or item level and does the commit only when it doesn't find one.

  • Edit a selected row in an alv report after pressing a push button ?

    hi all ,
    I want to edit a selected row in an alv report but that too after i press a push button . After pressing the push button , a pop up shud *** showing all the entries of the selected row which shud be editable and after editing it shud be saved into the database table.
    How can i do this please help asap ???

    May this prog. of mine can solve your requirement.
    REPORT z_demo_alv_jg.
    TYPE-POOLS                                                          *
    TYPE-POOLS: slis.
    INTERNAL TABLES/WORK AREAS/VARIABLES                                *
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
          i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
          w_field TYPE slis_fieldcat_alv,
          p_table LIKE dd02l-tabname,
          dy_table TYPE REF TO data,
          dy_tab TYPE REF TO data,
          dy_line TYPE REF TO data.
    FIELD-SYMBOLS                                                       *
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa> TYPE ANY,
                   <dyn_field> TYPE ANY,
                   <dyn_tab_temp> TYPE STANDARD TABLE.
    SELECTION SCREEN                                                    *
    PARAMETERS: tabname(30) TYPE c,
                lines(5)  TYPE n.
    START-OF-SELECTION                                                  *
    START-OF-SELECTION.
    Storing table name
      p_table = tabname.
    Create internal table dynamically with the stucture of table name
    entered in the selection screen
      CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_table->* TO <dyn_table>.
      IF sy-subrc <> 0.
        MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
        LEAVE TO LIST-PROCESSING.
      ENDIF.
    Create workarea for the table
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    Create another temp. table
      CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_tab->* TO <dyn_tab_temp>.
      SORT i_fieldcat BY col_pos.
    Select data from table
      SELECT * FROM (p_table)
      INTO TABLE <dyn_table>
      UP TO lines ROWS.
      REFRESH <dyn_tab_temp>.
    Display report
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_structure_name         = p_table
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'SET_PF_STATUS'
        TABLES
          t_outtab                 = <dyn_table>
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
      ENDIF.
    *&      Form  SET_PF_STATUS
          Setting custom PF-Status
         -->RT_EXTAB   Excluding table
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'Z_STANDARD'.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  user_command
          Handling custom function codes
         -->R_UCOMM      Function code value
         -->RS_SELFIELD  Info. of cursor position in ALV
    FORM user_command  USING    r_ucomm LIKE sy-ucomm
                               rs_selfield TYPE slis_selfield.
    Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.
    Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.
    Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.
    Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.
      CASE r_ucomm.
      When a record is selected
        WHEN '&IC1'.
        Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.
          IF sy-subrc = 0.
          Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.
          Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_PDF_JG'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
            IF sy-subrc = 0.
            Make all the fields input enabled except key fields
              w_field-input = 'X'.
              MODIFY i_fieldcat FROM w_field TRANSPORTING input
              WHERE key IS INITIAL.
            ENDIF.
          Display the record for editing purpose
            CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
              EXPORTING
                i_callback_program    = sy-repid
                i_structure_name      = p_table
                it_fieldcat           = i_fieldcat
                i_screen_start_column = 10
                i_screen_start_line   = 15
                i_screen_end_column   = 200
                i_screen_end_line     = 20
              TABLES
                t_outtab              = <l_tab>
              EXCEPTIONS
                program_error         = 1
                OTHERS                = 2.
            IF sy-subrc = 0.
            Read the modified data
              READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
            If the record is changed then track its index no.
            and populate it in an internal table for future
            action
              IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
                <dyn_wa> = <l_wa>.
                i_index = rs_selfield-tabindex.
                APPEND i_index.
              ENDIF.
            ENDIF.
          ENDIF.
      When save button is pressed
        WHEN 'SAVE'.
        Sort the index table
          SORT i_index.
        Delete all duplicate records
          DELETE ADJACENT DUPLICATES FROM i_index.
          LOOP AT i_index.
          Find out the changes in the internal table
          and populate these changes in another internal table
            READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
            IF sy-subrc = 0.
              APPEND <dyn_wa> TO <dyn_tab_temp>.
            ENDIF.
          ENDLOOP.
        Lock the table
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              mode_rstable   = 'E'
              tabname        = p_table
            EXCEPTIONS
              foreign_lock   = 1
              system_failure = 2
              OTHERS         = 3.
          IF sy-subrc = 0.
          Modify the database table with these changes
            MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
            REFRESH <dyn_tab_temp>.
          Unlock the table
            CALL FUNCTION 'DEQUEUE_E_TABLE'
              EXPORTING
                mode_rstable = 'E'
                tabname      = p_table.
          ENDIF.
      ENDCASE.
      rs_selfield-refresh = 'X'.
    ENDFORM.                    "user_command
    Regards,
    Joy.

  • Querying a multi-record block within my form

    I have a form where I perform validations of items entered on my main block. I compare the item value entered to an expected value and if they are different then an exception record must be created in a separate, multi-record block within my application. One record on my main block may end up with multiple different exception records in the multi-record block. As a result, part of my validation must include determining whether the user has already created an exception record for the item that I'm validating in the multi-record block.
    Is there a way for me to query and uncomitted, multi-record block in my form? Help would be greatly appreciated!

    Andreas' method is good.
    Only several changes:
      LOOP... EXIT WHEN :SYSTEM.RECORD_STATUS='NEW';
    (Use NEW, not TRUE)
    And just before the Raise Form_Trigger_Failure, I would Go_Item to either the item in error, or to a new line in the exceptions block. And also issue an error message.
    ....By the way...
    If your exceptions block has more rows than will fit on the screen, then your search loop function will may cause the rows to jump up or down when the user tries to commit. There is a way to reset the view after the function completes its search -- you just need to store the value of the block's Top_Record property before the First_Record command, and then Go_Record(Top_Rec_value); after the function completes its loop.
    Also, there is a way to prompt the user to enter the exception record when you first validate the item in a when-validate-item trigger. But the user might ignore the prompt, so you still need to re-check everything from the key-commit process. To use the WVI prompting, in the WVI trigger you check if an exception is required. If it is, store the item name in a package variable, then start a non-repeating timer. When the timer expires, save the :System.cursor_item value (so you can go_item back to it after calling the function), and then call the function to check for the exception for the item named in the package variable. If not found, prompt the user. If found, go_item back to the cursor_item_value.

  • How to show the new table record after creating

    I have a table form. After creating a new record to the table, the page go back to the same page. I wanta know how to show the new record after click 'Create' button. Right now, all the items will be cleared.
    Thanks.

    The button submits the page so just create a branch that directs to a new page (which you'll have to create if you have not already done so) after submission which directs to a new page and uses the newly generate PK to display the row you've generated. You'll need to make the branch conditional on that press of the Create button.
    Phil

  • After call commit sql , data can not flush to disk

    I use berkey db which support sql . It's version is db-5.1.19.
    1, Open a database.
    2. Create a table.
    3. exec "begin;" sql
    4. exec sql which is insert record into table
    5. exec "commit;" sql
    6. copy database file (SourceDB_912_1.db and SourceDB_912_1.db-journal) to Local Disk of D, then use a tool of dbsql to open the database.
    7. use select sql to check data, there is no record in table.
    1
    sqlite3 * m_pDB;
    int nRet = sqlite3_open_v2(strDBName.c_str(), & m_pDB,SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,NULL);
    2
    string strSQL="CREATE TABLE [TBLClientAccount] ( [ClientId] CHAR (36), [AccountId] CHAR (36) );";
    char * errors;
    nRet = sqlite3_exec(m_pDB, strSQL.c_str(), NULL, NULL, &errors);
    3
    nRet = sqlite3_exec(m_pDB, "begin;", NULL, NULL, &errors);
    4
    nRet = sqlite3_exec(m_pDB, "INSERT INTO TBLClientAccount (ClientId,AccountId) VALUES('dd','ddd'); ", NULL, NULL, &errors);
    5
    nRet = sqlite3_exec(m_pDB, "commit;", NULL, NULL, &errors);
    Edited by: 887973 on Sep 27, 2011 11:15 PM

    Hi,
    Here is a simple test case program I used based on your description:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include "sqlite3.h"
    int error_handler(sqlite3*);
    int main()
         sqlite3 *m_pDB;
         const char *strDBName = "C:/SRs/OTN Core 2290838 - after call commit sql , data can not flush to disk/SourceDB_912_1.db";
         char * errors;
         sqlite3_open_v2(strDBName, &m_pDB, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
         error_handler(m_pDB);
         sqlite3_exec(m_pDB, "CREATE TABLE [TBLClientAccount] ( [ClientId] CHAR (36), [AccountId] CHAR (36) );", NULL, NULL, &errors);
         error_handler(m_pDB);
         sqlite3_exec(m_pDB, "begin;", NULL, NULL, &errors);
         error_handler(m_pDB);
         sqlite3_exec(m_pDB, "INSERT INTO TBLClientAccount (ClientId,AccountId) VALUES('dd','ddd'); ", NULL, NULL, &errors);
         error_handler(m_pDB);
         sqlite3_exec(m_pDB, "commit;", NULL, NULL, &errors);
         error_handler(m_pDB);
         //sqlite3_close(m_pDB);
         //error_handler(m_pDB);
    int error_handler(sqlite3 *db)
         int err_code = sqlite3_errcode(db);
         switch(err_code) {
         case SQLITE_OK:
         case SQLITE_DONE:
         case SQLITE_ROW:
              break;
         default:
              fprintf(stderr, "ERROR: %s. ERRCODE: %d.\n", sqlite3_errmsg(db), err_code);
              exit(err_code);
         return err_code;
    }Than I copied the SourceDB_912_1.db database and the SourceDB_912_1.db-journal directory containing the environment files (region files, log files) to D:\, opened the database using the "dbsql" command line tool, and queried the table; the data is there:
    D:\bdbsql-dir>ls -al
    -rw-rw-rw-   1 acostach 0 32768 2011-10-12 12:51 SourceDB_912_1.db
    drw-rw-rw-   2 acostach 0     0 2011-10-12 12:51 SourceDB_912_1.db-journal
    D:\bdbsql-dir>C:\BerkeleyDB\db-5.1.19\build_windows\Win32\Debug\dbsql SourceDB_912_1.db
    Berkeley DB 11g Release 2, library version 11.2.5.1.19: (August 27, 2010)
    Enter ".help" for instructions
    Enter SQL statements terminated with a ";"
    dbsql> .tables
    TBLClientAccount
    dbsql> .schema TBLClientAccount
    CREATE TABLE [TBLClientAccount] ( [ClientId] CHAR (36), [AccountId] CHAR (36) );
    dbsql> select * from TBLClientAccount;
    dd|dddI do not see where the issue is. The data can be successfully retrieved, it is present in the database.
    Could you try putting in the sqlite3_close() call and see if you still get the error?
    Did you remove the __db.* files from the SourceDB_912_1.db-journal directory?
    Did you use PRAGMA synchronous, and if so, what is the value you set?
    If this is still an issue for you, please describe in more detail the exact steps needed to get this reproduced and provide a simple stand-alone test case program that reproduces it.
    Regards,
    Andrei

Maybe you are looking for

  • If i buy itunes match will i be able to listen to my music without data or internet for free?

    i only have an 8 gb iphone 4 and i have over 1000 songs in my itunes library. if i subscribe itunes match will i be able to have all my songs on my phone and be able to listen to it all for free without using my data or internet?

  • SQL Developer Cart Deployment Losing Time on Date Columns

    I tried using the SQL Developer cart feature to migrate from AWS to Oracle Cloud and I found that the time element of any date attributes is not migrated. I checked the deployment file contents and found that both the SQL*Loader control file and the

  • Cumulative probability function

    Hi! The condition is I have a packet of datas (sample pictures shown in the attachment). Say the desire class size is 100 with min value of 0 to max value of 0.008. Total sampling is 150 (instead of using 1500000).  Graph1 From there I would want to

  • Messages beta can't be installed on this disk.

    Whenever I try to install on a iMac 10.7.4 I get this error Messages beta can't be installed on this disk.An error occured while evavaluating javaScript for the package. I have redownloaded the install files and I get the same error.

  • Will Apple release any iOS6 Guided Access video tutorials?

    Hi, I am a Developmental Therapist that uses the iPad with families affected by autism and sensory processing disorder. After exploring many features this morning, I think families and individuals affected by disability really need a series of video