Saving editable column contents in Std. Table using ALV

Hi All,
   I developed a ALV report which displays list of sales orders of particular customer, in this report created by name is editable column. Now i want to save the created by name after user changes the contents of this column and click on save button. I am getting all the data to be saved in field "RS_SELFIELD" (RS_SELFIELD TYPE SLIS_SELFIELD)  Kindly help me to get out of this issue.  
Advance thanks for your response.

Try this code.
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_ALV'
            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

Similar Messages

  • Multiple Column hiding in advance table using Switcher

    Hi All,
    I am having requirement of hiding multiple columns in advance table using swithers.
    Lets says I am searching for the the parties in party search page. If the party is of type person then two columns should be visible one is firstName and LastName.
    and If party is of type organization then firstName and lastName column shpould be hidden and only the PartyName column should be visible.
    Is this possible through switchers if yes please explain?
    Br, 903096

    Hi ,
    This can be done through switcher case , along with switcher you also need to use SPEL binding the each of those attribute
    that you wish to hide .
    Go through delete exercise to understand how to implement switchers case .
    Let me know if you need any help .
    --Keerthi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Download database table content into internal table using Function Module?

    HI,
    Experts,
    I need a function module which can download ddic table content into internal table.
    Thank u ,
    Shabeer Ahmed.

    >
    shabeer ahmed wrote:
    > HI,
    > Experts,
    >
    > I need a function module which can download ddic table content into internal table.
    >
    > Thank u ,
    > Shabeer Ahmed.
    Hi Shabeer,
      We don't require a function module to download ddic table content to an internal table. We can use the SELECT statement for the same. Example would be:-
    DATA: <INTERNAL TABLE> type table of <DATABASE>.
    SELECT * FROM <DATABASE> into corresponding fields of <INTERNAL TABLE>.
    Also, function module might be required when you need the data from a remote system, but then it is the developer's task create this function module and the function module should be remote enabled function module.
    This remote enable function module should have the above SELECT query as its code.
    Many Regards,
    Ravi.

  • List of STD table used for Ebydos Invoice Cockpit

    Hi Masters,
    Could you plese let me know the list of standard tables used for Ebydos Invoice Cockpit.
    Regards,
    Panneer

    When inside SE11 for MONI, lets say, press the where-used list button and select the option for FUNCTION MODULE INTERFACES to see a list of FMs that take a structure of type MONI as input/output parameter. Although this will not give an exhaustive list of FMs, it will assist you to a good extent.
    Additionally, you can try FM APPLICATION_DATA_GET.
    For STXL, take a look at FM READ_TEXT and associated include file LSTXDUXX for more functions in this function group SAPLSTXD.
    Regards
    Message was edited by: Shehryar Khan
    Message was edited by: Shehryar Khan

  • Column Contents in HSP_Audit_Records table

    Can anyone explain the columns of the HSP_Audit_Records table to me? I can make an educated guess at some, but I'm not exactly sure on a few (i.e. ID_2, etc).
    [TYPE]
    ,[ID_1]
    ,[ID_2]
    ,[USER_NAME]
    ,[TIME_POSTED]
    ,[ACTION]
    ,[PROPERTY]
    ,[OLD_VAL]
    ,[NEW_VAL]
    Thanks.
    Terri T.

    This is the definition from the data models document
    TYPE - Type of object being audited
    ID_1 - Dependent on object type ID_1 and ID_2 identifies specific object that was audited
    ID_2 - See ID_1, ID_1 and ID_2 may be null
    USER_NAME - User who triggered the modification event
    TIME_POSTED - Timestamp of when event occurred
    ACTION - Action performed (add, modify, delete, execute)
    PROPERTY - Name of a property of the object being audited.
    OLD_VAL - Old value prior to modification
    NEW_VAL - New value after modification
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Column contents separated by commas using a select

    Hi,
    My SQL query output looks like this
    Host Name IP Address List Primary Address
    IEGMEUDUB--01R     135.32.248.132          135.32.248.132
    IEGMEUDUB--01R     135.42.164.54          135.32.248.132
    IEGMEUDUB--01R     135.42.165.198     135.32.248.132
    IEGMEUDUB--01R     139.96.195.254     135.32.248.132
    But I want to have in below format.
    I want to see the output in single line.That is instead of repeating the same rows,I want to separate them with commas.When the host name is repeated ,I want to separate the IP Address List column by commas.
    Output should look like below.
    Host Name IP Address List Primary Adderss
    IEGMEUDUB--01R     135.32.248.132,135.42.164.54,135.42.165.198     135.32.248.132
    Is it possible? Please advise.
    Thanks in advance.
    Regards
    Jack

    Wrong forum; SQL Developer is a tool. You want SQL And PL/SQL...
    K.

  • Updating database table using ALV Grid class CL_ALV_CHANGED_DATA_PROTOCOL

    Hi,
    I am trying to use class CL_ALV_CHANGED_DATA_PROTOCOL to update a database table from an ALV grid.
    I have used program BCALV_EDIT_04 as an example.
    I am able to successfully processed inserted or deleted lines using the attributes
    MT_DELETED_ROWS
    MT_INSERTED_ROWS
    but I also want to process modified lines.
    I was just wondering whether anyone out there has some example code for this.
    I can see that there are the following attributes available
    MT_MOD_CELLS
    MP_MOD_ROWS.
    I would ideally like to use MP_MOD_ROWS rather than  MT_MOD_CELLS but it is not clear to me what type MP_MOD_ROWS is.
    If anyone has any example code for this sort of thing, please let me know.
    Thanks,
    Ruby

    hi Ruby,
    Yes we can use that *data reference variable *.
    It is a variable( something comparable to a pointer ) that points to a int table( table with changed contents )
    which ll be created at run-time based on the data type ot the internal table that we pass to the parameter it_outtab of method set_table_for_first_display ...
    assign er_data_changed->mp_mod_rows->* to a field-symbol and use it...
    Check the below code for example -> method refresh_changed_data
    screen flow logic.
    PROCESS BEFORE OUTPUT.
      MODULE pbo.
    PROCESS AFTER INPUT.
      MODULE pai.
    main program.
    *       CLASS lcl_event_responder DEFINITION                           *
    CLASS lcl_event_responder DEFINITION.
      PUBLIC SECTION.
        DATA  : ls_changed_cell TYPE  lvc_s_modi,
                lv_language     TYPE  spras..
        METHODS refresh_changed_data  FOR EVENT data_changed
                                      OF cl_gui_alv_grid
                                      IMPORTING er_data_changed
                                                e_ucomm.
    ENDCLASS.                    "event_responder DEFINITION
    TYPES tt_makt TYPE STANDARD TABLE OF makt.
    DATA: go_handler         TYPE REF TO lcl_event_responder,
          go_grid            TYPE REF TO cl_gui_alv_grid,
          gt_fieldcat        TYPE lvc_t_fcat,
          gv_language        TYPE spras VALUE 'E',
          gt_outtab          TYPE tt_makt,
          gs_tableline       TYPE LINE OF tt_makt.
    FIELD-SYMBOLS : <changed_rows> TYPE tt_makt.
    CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'BASIC'.
      PERFORM create_and_init_alv CHANGING gt_outtab[]
                                           gt_fieldcat.
    ENDMODULE.                    "pbo OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      LEAVE PROGRAM.
    ENDMODULE.                    "pai INPUT
    FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
                                      pt_fieldcat TYPE lvc_t_fcat.
      CHECK go_grid IS NOT BOUND.
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = cl_gui_container=>default_screen.
      PERFORM build_display_table.
      PERFORM build_fieldcat CHANGING pt_fieldcat.
      go_grid->set_table_for_first_display( CHANGING  it_fieldcatalog      = pt_fieldcat
                                                      it_outtab            = pt_outtab ).
      go_grid->set_ready_for_input( 1 ).
    * raises the 'data_changed' event when we select another cell/any action after changing the data
      go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter ).
      CREATE OBJECT go_handler.
      SET HANDLER go_handler->refresh_changed_data FOR go_grid.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    FORM build_display_table.
      FREE gt_outtab.
      SELECT * FROM makt UP TO 20 ROWS INTO TABLE gt_outtab WHERE spras EQ gv_language.
    ENDFORM.                               "build_display_table
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'MAKT'
        CHANGING
          ct_fieldcat      = pt_fieldcat.
      LOOP AT pt_fieldcat INTO ls_fcat.
        ls_fcat-edit       = abap_true.
        MODIFY pt_fieldcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                               "build_fieldcat
    *       CLASS event_responder IMPLEMENTATION                          *
    CLASS lcl_event_responder IMPLEMENTATION.
      METHOD refresh_changed_data.
        ASSIGN er_data_changed->mp_mod_rows->* TO <changed_rows>.
        LOOP AT <changed_rows> INTO gs_tableline.
          BREAK-POINT.
        ENDLOOP.
      ENDMETHOD.                    "click
    ENDCLASS.                    "event_responder IMPLEMENTATION
    Cheers,
    Jose.

  • How to create the Hierarchial table using ALV.in WD4A

    Hi All,
    I am struggling hard to make the hierarchial ALV,  But could not do it.
    Could you help me.
    Actually I want the column to be hierarchial. For this i am using
    if_salv_wd_column_hierarchy~set_hierarchy_column.
    Also i tried to display the whole table as Hierarchial
        lr_table_settings->set_display_type( if_salv_wd_c_table_settings=>display_type_hierarchy ).
    For both the possibilities the result is not as desired.
    Regards,
    Arti.

    Hi Aleem,
    The link u have provided gives the solution for the Table.
    I want the implementation for ALV.
    Also my requirement is that the first column of the ALV should be hierarchial.
    On expanding the table cell of first column one more table should open of same type.
    This way user can navigate to three diffierent database tables.
    The tree is populated at runtime with the data. So the depth of branches is unknown at design time.
    I hope the requirements are clear to u now.
    Thanks and Regards,
    Arti.

  • Subtotals in dynamic internal table using alv grid

    hi experts i have created one dynamic table.  The requirement is to display the subtotals in the output using reuse_alv_grid.
    Dynamic itab (field-symbols) and ALV event BEFORE_LINE_OUTPUT
    the above is the thread related and could any one please provide the sample code for this task.
    can any one post the solution for that.
    rewards points will be awarded.
    khazi

    * ASSINING STRUCTURE FOR FILD CATLOGS
    DATA: DYN_TABLE    TYPE REF TO DATA,
          DYN_LINE     TYPE REF TO DATA,
          LS_FIELDCAT TYPE LVC_S_FCAT,
          LT_FIELDCAT TYPE LVC_T_FCAT.
      LOOP AT LT_DMTAB INTO LS_DMTAB.
        CLEAR LS_FIELDCAT.
        LS_FIELDCAT-FIELDNAME = LS_DMTAB-SDATE .
        LS_FIELDCAT-DATATYPE  = 'DEC'.
        LS_FIELDCAT-INTTYPE   = 'P'.
        LS_FIELDCAT-INTLEN    = '16' .
        LS_FIELDCAT-DECIMALS  = '03'.
        LS_FIELDCAT-JUST      = 'C'.
        APPEND LS_FIELDCAT TO LT_FIELDCAT.
      ENDLOOP.
    *& For grouping the table rows for Under Line
      LS_FIELDCAT-FIELDNAME = 'ULFIELD' .
      LS_FIELDCAT-DATATYPE  = 'INT'.
      LS_FIELDCAT-INTTYPE   = 'P'.
      LS_FIELDCAT-INTLEN    = '2' .
      LS_FIELDCAT-DECIMALS  = ''.
      APPEND LS_FIELDCAT TO LT_FIELDCAT.
      "* Create dynamic internal table and assign to Field-Symbol
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = LT_FIELDCAT
        IMPORTING
          EP_TABLE        = DYN_TABLE.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ASSIGN DYN_TABLE->* TO <LT_AREA_F>.
      "* Create dynamic work area and assign to Field Symbol
      CREATE DATA DYN_LINE LIKE LINE OF <LT_AREA_F>.
      ASSIGN DYN_LINE->* TO <LS_AREA_F>.
    You check in Field cat level you will get  Check Sub total field will exist
    Thanks and regards
    Jogu

  • General Question: should Fact Table use virtual column?

    Hi,
    I have read several articles about 11g's Virtual Column feature and it all looks very good. But I just want to know
    - Whether virtual column is also good for Fact table or not?
    - Is it recommedated?
    - Is there a 'limit' or 'recommedation'regarding how many virtual columns I should use in a table?
    Thanks

    In an OLTP system, the number of virtual columns is self-limiting because there aren't that many simple ways to combine the columns in a single table using simple expressions. In a data warehouse, there are likely a lot more expressions that you might want to compute, so you would have to be careful as oracletune points out if expressions can change over time assuming that you want the version of the computation that was in force at the time the row was written to be used.
    There really isn't a rule of thumb. It's a lot like asking how many indexes a table should have-- the only answer is to do a cost-benefit analysis on each potential index/ virtual column to determine if the benefits outweigh the cost. A virtual column allows you to avoid computing an expression when you are inserting a value but requires that you compute it at query time. If a row is queried millions of times, written once, and never updated, that probably isn't a great trade-off. If a row is queried a few times and updated a bunch, avoiding the computations is probably worthwhile. If you need to store the value and you have an OLTP system, the ability to ensure that you never have stale computations is great.
    Justin

  • Move out of table using keyboard

    When editing the contents of a table in Design view, is it
    possible to move the insertion point out of the table using only
    the keyboard--that is,
    without having to click the mouse somewhere outside the
    table.

    This, from DW's F1 help, certainly works for me -
    To exit the table, press Control+A three times if the
    insertion point is in
    a cell, twice if the cell is selected, or once if the table
    is selected, and
    then press the Up, Left, or Right Arrow key.
    Murray
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Jeff Jansen" <[email protected]> wrote in
    message
    news:f7ggmt$g2i$[email protected]..
    > When editing the contents of a table in Design view, is
    it possible to
    > move the
    > insertion point out of the table using only the
    keyboard--that is,
    >
    without having to click the mouse somewhere outside the
    table.
    >

  • How to sum different column in the same table

    Hi everyone
    I would like to know how can I make the sum of different column in the same table using apex
    exple:
    TR_PROJ_BIL_TRIM.ENTPIDFISC as ENTPIDFISC,
        TR_PROJ_BIL_TRIM.EXEANNEE as EXEANNEE,
        TR_PROJ_BIL_TRIM.PROJBILTRIMT1PREV as PROJBILTRIMT1PREV,
        TR_PROJ_BIL_TRIM.PROJBILTRIMT2PREV as PROJBILTRIMT2PREV,
        trunc( TR_PROJ_BIL_TRIM.PROJBILTRIMT1PREV)+(TR_PROJ_BIL_TRIM.PROJBILTRIMT2PREV)
    from TR_PROJ_BIL_TRIM TR_PROJ_BIL_TRIM
    group by TR_PROJ_BIL_TRIM.ENTPIDFISC,TR_PROJ_BIL_TRIM.EXEANNEE
    but while trying to run this script i get this error message:"ORA-00979: not a GROUP BY expression"
    thanks for reading me and I hope to hear from you soon

    Hi,
    Your question do not have anything do with APEX.
    It is pure SQL question and you will get better answer this kind questions from SQL and PL/SQL forum
    You need have GROUP BY when you use aggregate functions like SUM.
    I assume you like just add two columns.
    Try
    SELECT ENTPIDFISC
        ,EXEANNEE
        ,PROJBILTRIMT1PREV
        ,PROJBILTRIMT2PREV
        ,trunc(PROJBILTRIMT1PREV) + (PROJBILTRIMT2PREV)
    FROM TR_PROJ_BIL_TRIM
    Regards,
    Jari

  • How to read XML message present in Table using PL/SQL?

    Hi,
    How to read XML content present in Table using PL/SQL .And is it possible to parse the xml uisng xslt and insert xml output in same table again ?
    Thanks!

    Late reply, but hopefully better late than never.
    You can possibly do it all via a single SQL statement, such as {message:id=4232077}
    XMLTable Syntax can be found at http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions228.htm#CIHGGHFB (for 10.2 users) else find your correct version at http://www.oracle.com/technology/documentation/index.html

  • Using ALV OM to UPDATE (Change) Data

    Hallo Dear Experts,
    Would you  give a Tip how to update Datas using ALV OM. Does any body now an Example program ?
    Thank a lot
    Fisseha

    Hi,
    new ALV object model (class CL_SALV_TABLE and so on) does not support editable columns. Yoe need to use class CL_GUI_ALV_GRID to implement editable ALV. More info can be found [here|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907].
    Cheers

  • How to use ALV  in web dynpro for ABAP?

    Hi,
    I am new to web dynpro. Now I want to create a table using ALV to display. I have no idea how to use it.
    I only know I need to add the SALV_WD_TABLE for component usage. Can anyone give me some hints
    or step-by-step procedure?
    Thanks.
    Awards will be provided.
    Best Regards,
    Chris Gu

    Hi,
    Please go thru this set of [tutuorials|https://www.sdn.sap.com/irj/sdn/webdynpro?rid=/webcontent/uuid/60ea94e5-0901-0010-c3bb-aad5ea9620d8].
    Its really good for ALV.
    I also used this as I am also new to WD ABAP.
    Revert back with issues.
    Regards,
    Sumit

Maybe you are looking for

  • How to store the Arraylist value in variables ?

    Hi Here i use arraylist and i like to store all the arraylist in different variables Please tell the way . ArrayList list = new ArrayList(); list.add("A"); list.add("B"); list.add("C"); list.add("D"); String a="" String b=""; String c="" String d="";

  • Smart Guides Turning Off - Can't Turn Back On!!

    I love the smart guides and use them all the time... unfortunately my smart guides have been turning off (I'm either inadvertently doing something, or this is a glitch or something going on) but after using smart guides on a document it all of sudden

  • Finding ligature text in PDF when produced from InDesign CS5

    Hi everybody, Can you please any one help me on the below issue. When searching the PDF, some words are not found. If I search the word "final", I find 19 occurences of the word "finally", but none whatsoever of "final". The word "final" is only foun

  • How to filter Key Figures - not using the GUIDs

    An example How to filter Key Figures may look like this: http://XXX.com:8000/sap/bw/BEx?sap-language=DE&bsplanguage=DE&CMD=LDOC&TEMPLATE_ID=XXX&FILTER_IOBJNM=41F68RV4ZB5VYSARODYU70CAQ&FILTER_VALUE=41F68SAI18DB01DO023IR49QA The GUIDs consume the space

  • Problems syncing contact list

    My iPhone 3GS running on 5.0.1 won't update my contact list while syncing to my iMac (10.6.8).  This just happened after a recent update. It syncs the calendar and other applications.