Standard Table to be updated based on User action

Hi Friends ,
i have a requirement , its a report and in that based on the user action ( if the user checks a check box that is available in the output screen of the report and saves it)  the value should be updated in a standard table as 'X'. I have appended the field in the standard table and now i need to write a logic at user command to populate the zfield that i have added in the table based on the user's input. Can someone suggest me how to proceed further on this ? Kindly let me know if you have any sample piece of code related to this scenario...
thanks in advance.

HI,
Usually we can udpate the tables using UPDATE statement.
But SAP will not suggest to use these statements which will hit the table directly. We need to use the standard transactions to create or update the standard tables.
For eg: you are using a ztable.
then once your report is ready, then use the user_command form ( for ALV) .
fetch the records where the user have selected the records ( check box = 'X").
*&      Form  USER_COMMAND
FORM user_command USING g_ucomm     TYPE sy-ucomm
gs_selfield TYPE slis_selfield                                          .
  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      e_grid = ls_ref1.
  CALL METHOD ls_ref1->check_changed_data .
this will update the check box values in your internal table.
now you can use
loop at itab into wa where check eq 'X'.
fill your final internal table where you need to update the table.
endloop.
loop at newtable.
update ztable set value = 'X'
where keyfield = w_keyfield.
if sy-subrc eq 0.
message s000.
endif.
endloop.
endform.
regards,
Venkatesh

Similar Messages

  • How to set number of Rows of a table to be displayed based on user action?

    Hi Experts,
    I am getting data into the table. But only 5 records are displayed default. I want it to be a user selection.
    If user wishes to see 10 records, then first 10 records should get displayed. If user selects 'n' records then 'n' records should get displayed..
    How to achieve this?
    Regards,
    Yugesh A.

    hi Yugesh ,
    1 create  a input field UI
    2 bind its value property  to a attribute
    3 suppose ca_check attribute ( type string ) under node cn_check is binded
    read this in ur doinit of the view
      DATA lo_nd_cn_check TYPE REF TO if_wd_context_node.
      DATA lo_el_cn_check TYPE REF TO if_wd_context_element.
      DATA ls_cn_check TYPE wd_this->element_cn_check.
      DATA lv_ca_check LIKE ls_cn_check-ca_check.
    * navigate from <CONTEXT> to <CN_CHECK> via lead selection
      lo_nd_cn_check = wd_context->get_child_node( name = wd_this->wdctx_cn_check ).
    * get element via lead selection
      lo_el_cn_check = lo_nd_cn_check->get_element(  ).
    * get single attribute
      lo_el_cn_check->get_attribute(
        EXPORTING
          name =  `CA_CHECK`
        IMPORTING
          value = lv_ca_check ).
    4 nw for  ur table , make a another context attribute of type either string or I , say attr1
    bind its visiblerowcount property of table to attr1
    5 make a attribute in ATTRIBUTES tab of type string , say attribute
    set its value to lv_ca_check in doinit itself
    wd_this->attribute = lv_ca_Check
    6 nw in the method , where u need to validate how m,any rows user enter or doinit itself , set attr1 to the value of that attribute created under ATTRIBUTES tab ( named attribute)
    DATA : lv_count type string .
    lv_count = wd_this->attribute
    7 nw its very simple , set attr1 to lv_count , as it contains the count of the number which has entered in the input field
    DATA lo_nd_cn_check TYPE REF TO if_wd_context_node.
      DATA lo_el_cn_check TYPE REF TO if_wd_context_element.
      DATA ls_cn_check TYPE wd_this->element_cn_check.
      DATA attr1 LIKE ls_cn_check-ca_check.
    * navigate from <CONTEXT> to <CN_CHECK> via lead selection
      lo_nd_cn_check = wd_context->get_child_node( name = wd_this->wdctx_cn_check ).
    * get element via lead selection
      lo_el_cn_check = lo_nd_cn_check->get_element(  ).
    * set single attribute
      lo_el_cn_check->set_attribute(
        EXPORTING
          name =  `attr1`
          value = lv_count ).
    I hope it shud help
    proceed like these , u wud be able to achieve the desired functionality
    regards,
    amit
    Edited by: amit saini on Oct 20, 2009 1:12 PM

  • Server 2010 SP2 - New values in lookup table are not updated in the user client

    Hello,
    I added a value to a lookup table in the PWA.
    Most users see the new value in the field based on this lookup table.
    One user doesn't see the update for 2 weeks now. He did close and opened the application over these 2 weeks.
    Any Idea?
    Thanks,
    Barak

    Hi Barak,
    I am assuming the issue is with PWA? Has the user tried to access PWA from a different machine/browser?Other things you can try are:
    - Reset IE settings
    - CTRL+F5 (on the page)
    If it is MS Project that doesn't have the new value, try closing MS Project and re-open it
    Hope this helps
    Paul

  • Dynamically coloring a cell based on user action.

    Dear Gurus,
    I know that many a questions have been posted based on cell coloring. But sadly i couldn't find anything that suits my requirement. My requirement is like i want to color a cell when the user double clicks on that cell. I have captured the double click event and iam filling the required color in a field in final itab (name : color). After this iam calling refresh_table_display.
    But sadly no changes are visible. Any help would be greatly appreciated.
    Given below the code.
    gfl_color-fname = l_fname-fieldname.
              gfl_color-color-col = '6' .
              gfl_color-color-inv = '1'.
              APPEND gfl_color TO gfl_rfinal-color.
              MODIFY git_rfinal FROM gfl_rfinal INDEX l_index-row_id
                                                TRANSPORTING color.
              CLEAR gfl_rfinal.
              CALL METHOD r_grid1->refresh_table_display
                EXCEPTIONS
                  finished = 1
                  OTHERS   = 2.
    Thanks and Regards,
    Sandeep Sivan
    Edited by: sandeep sivan on Aug 5, 2010 10:51 AM
    Edited by: sandeep sivan on Aug 5, 2010 11:01 AM

    Issue Solved.

  • How to update standard table based on the custom table

    Hi,
    I have requirement , I have custom table whatever changes done to the custom table must be updated in the standard table
    i have tried the table maintenance events but unable to handle delimit , what is the base solution for this.
    1) create
    2) change
    3) delimit
    4) delete
    6)copy

    the table im updating is t710
    the custom table is same as the standard table except for one field . whatever the user maintains the values in custom table except for the one field everything should update back to the standard table. Im able to update when we create delele but the problem is delimition. when im delimiting the record in custom table its just changing the startdate and it is not actually delimiting the record itself .I want both records the latest one and previous one and should be update back into the standard table same as the custom table

  • Capturing User Action and populating Standard table

    Hi Friends ,
    I have a requirement , its a classical report and in that based on the user action ( if the user checks a check box that is available in the output screen of the report and saves it) the value should be updated in a standard table as 'X'. I have appended the field in the standard table and now i need to write a logic at user command to populate the zfield that i have added in the table based on the user's input.
    I need to capture the user's action into an internal table and then pass this value into a function module to update the standard table, Can someone suggest me how to proceed further on this issue ? Kindly let me know if you have any sample piece of code related to this scenario...
    thanks in advance.

    DATA: date TYPE d,
          flag TYPE c LENGTH 1,
          wa   TYPE c LENGTH 10.
    START-OF-SELECTION.
      date = sy-datum.
      DO 10 TIMES.
        date = date + sy-index.
        WRITE: / flag AS CHECKBOX, (10) date.
      ENDDO.
    AT LINE-SELECTION.
      DO.
        READ LINE sy-index FIELD VALUE flag
                                       date INTO wa.
        IF sy-subrc <> 0.
          EXIT.
        ELSEIF flag = 'X'.
          WRITE / wa.
        ENDIF.
      ENDDO.

  • OIM 11g r2  User  UDF fields  Updation based on AD ID

    Hi,
    We have to update the UDF fields created for the users in OIM using the data from a table.
    This table contains the AD ID, and other fields.
    OIM User (already available) will be updated based on AD ID ….i;e AD ID column will be used to find the user in OIM and then his UDF will be updated based on the respective data from other columns in the table .
    Please can you help me on this task?
    Thanks,

    Your requirement doesn't tell much like when you want to update your user. If it would be on daily basis then go for Schedule Task, if you want to at the time of provisioning then you can have one task and attach your code to bring AD ID in OIM..
    You may leverage Event Handlers as well if your use case requires that.

  • Reading dynamic table column based on user selection

    Hi there,
    I am having a problem of reading and manipulating the data stored in a standard SAP table. The following example simulates the table and what i am trying to do:
    Table: Storing sales data for sales person
    SALES_PERSON    REGION   YEAR   MTH_S1  MTH_S2  MTH_S3 MTH_S4...
    Richard  S               NORTH    2007     100          200         300        400
    John K                    SOUTH    2007      50           100         100        20
    Brad P                    NORTH    2007     300          100         100        50
    User have have the following selection option:
    1. Month.
    The program will calculate the sales based on the individual month selected
    Example, if user select Month = 3, then program take only MTH_S3 column value
    So total sales = 300100100=500
    2. Month range
    The program will calculate the sales based on the month range selected
    Example, if user select Month 2 to 4, then program take MTH 2 to MTH_S4 columns value
    So total sales = 400 (for MTH_S2) + 500 (for MTH_S3) + 470 (for MTH_S4) = 1370
    How should i write the logic or code for this requirement?
    Hope someone can help.
    Thanks,
    Pang HK

    Try something like this
    TABLES:
    t247.
    SELECT-OPTIONS:
      s_month FOR t247-mnr NO-EXTENSION.
    DATA:
      BEGIN OF fs_data,
        person(30),
        area(10),
        year(4),
        mon1 TYPE kbetr,
        mon2 TYPE kbetr,
        mon3 TYPE kbetr,
        mon4 TYPE kbetr,
        mon5 TYPE kbetr,
      END OF fs_data,
      t_data LIKE STANDARD TABLE OF fs_data,
      w_no_months TYPE i,
      w_kbetr TYPE kbetr,
      w_total TYPE kbetr.
      LOOP AT t_data INTO fs_data.
        CLEAR w_kbetr.
        DO 5 TIMES VARYING w_kbetr FROM fs_data-mon1
                                                          NEXT fs_data-mon2.
        IF sy-index IN s_month.
          w_total = w_total + w_kbetr.
        ENDIF.
        ENDDO.
      ENDLOOP.
    change the value 5, according to the no.of months in ur internal table

  • Updating a standard table from a custom tableq

    hi to all experts,
    My requirement is to update a standard table from the maintenance screens of the custom table whatever the data the user maintains in the custom table and save should automatically saved in the standard table
    for that i decided to use the table maintenance events (event 05 ) ( while saving data) how to capture the data from the screens to the form of the table maintenance events.

    Hi gautham,
    The requirement is like that actually user want to maintain value in z table ( with one extra field ) . the table updation of table is important

  • How to update/copy into the fields of standard table

    Hi all,
    I have a piece of code in user exit, in which i have to populate the field atwrt (cntry of origin) in EIPO-HERKL in a delivery document..
    but if i assign it directly to the field as i've shown in code, it wont take it.
    moreover, it looks be a standard table(EIPO), but it is not.. its  a work area..
    READ TABLE i_val_tab WITH KEY atnam = c_cntr.
    IF sy-subrc = 0.
    EIPO-HERKL = i_val_tab-atwrt.
    MODIFY EIPO.
    ENDIF.
    so kindly guide me how to do dat..do i have to populate it in some other standard table(for country of origin field) which will automatically put the field in EIPO-HERKL?

    Hello Pradeep,
                          Generally, in most of the User Exits, we'll find something called X and Y Structures. For example, XVBAK and YVBAK where the X Structure contains the Old Value and the Y Structure contains the New Value (meaning, the Value that is currently on the Screen before Saving). So, try to find out similar structures through which you can update the Value in the Standard Table.
    Thanks and Regards,
    Venkat Phani Prasad Konduri

  • Filter standard reports based on user login

    Hi All,
    Is there any way to filter standard form reports (not PLD), based on the user currently logged in. for example, if user 'sales1' has logged in,  he should be able to see the sales report(say sales analysis) for the documents made by him only. there does not seem to have any access on the query being passed to this report. so even customization does not seem to be the solution. kindly help if any one knows a better way or a way at all.
    thnks and regards,
    Binita Joshi

    Hi Petr,
    thanks for replying.
    Before posting, I had already searched in SAP B1 forum and there , for a similar problem, it was advised to use SDK so I posted here.
    I knew, SDK seems to be the way. but, again, As I wrote, I wanted to know, whether there exists a way to filter the standard reports based on the user login. I don't want authorization or setting rights, sort of things.
    but, suppose If user A wants to see the sales documents reports then, he should be able to see the reports of the documents made by him only. so we will have to filter the records based on the Usersign field in marketing documents' tables but, I am clueless on, where should I give this filter.  and I am afraid there is no way to do that. make your own reports and block the access of system reports.Pls right back if U have more to say.
    regards,
    Binita Joshi

  • Form based on a view -  FRM-40654: Record has been updated by another user.

    Hi All,
    I am hoping that somebody can help me with this problem that is occurring only when I try an update a record in forms.
    I have a block based on a join-view, I can insert no problems, but I can only update certain records within the block. If I come across a second record that is similar to the first except for primary key and a couple of other values and try and update that record forms gives me the following message FRM-40654: Record has been updated by another user. Re-query to see change.
    The first record I have no problems in updating and I have followed a number of suggestions to get this to work, like setting the key-mode of the block to updateable/non-updateable and setting the primary key to 'yes' for some of the database items. I have also created procedures within the database that are called by triggers on-insert, on-update etc.
    If anybody has any ideas how I can solve this I would be happy to hear your suggestions.
    Thanks in Advance.
    Regards,
    Scott.

    Scott,
    beside of
    1) In the block properties change the Key Mode property of the block to be Non-Updatable Primary Key
    2) Mark one or more columns as Primary Key in the item Property Palette - in this instance you would set the property for Empno.
    Enforce Primary Key = no
    Key Mode = Unique
    Update Changed Columns Only = Yes
    I found a bug entry that is supposed to be fixed in Patch 9 of Forms 6i (assuming you are running 6i). So if you could try with a more recent Patch set (e.g. 14) then probably the problem will go away.
    Fran

  • Any Bapi or function Module to update standard table

    Can u Plz let me know , is there any bapi or function module to update few fields of a standard table using an internable.

    I don't know if any FM exists for your requirement. But you may like to copy it into a custom table and modify it according to your enterprise needs.

  • Can we update oracle standard table Attributes column by custom trigger?

    Can we update the oracle Standard table's Attributes column using custom trigger? Is it allowed by oracle? Is this supported?
    Thanks

    ATTRIBUTE columns store DFF information and therefore custom code can be used to update their contents. Care must be taken that such updates do not cause "logical" corruption (an ATTRIBUTE column may be designed to store the color of a product, for example, but an incorrect SQL statement can update the value to a numeric one, thus causing corruption - Oracle does not have a means to check the validity of these update statements). Also, some localizations, such as Brazil and India, reserve some ATTRIBUTE columns for their use - updating such columns is not supported. More information may be found in the Flexfields Guide for your release at http://www.oracle.com/technology/documentation/applications.html
    HTH
    Srini

  • Correct way to handle updates of XMLtype columns in standard tables.

    Hello to whoever may read this,
    I am currently studying the XML functionality of oracle DB for a uni project.
    We have been asked to compare/contrast solutions to publishing product and price data for data stored in standard relational tables, and data stored in XML type tables. For extra marks, i am looking at a table containing an XMLType column for multiple items of data relating to the primarykey.
    I have managed to get my head around publishing the data - pretty straight forward, but we have also been asked to show how we can update data, which isn't a problem within the standard tables/columns, but when it comes to the XMLType columns/tables, i dont have a clue.
    At the moment i am working on trying to update an XMLtype column. The table itself is a "product" table, and contains product information, as well as an XMLType column containing multiple changes to the prices. In the relational tables, this "product" table has a one-to-many link to another table called price_history which contains details about past prices (which is populated by a trigger on update/insert of a new price). But in this table all the product changes are stored in XML format in the XML type column "prices".
    Table columns: id number(4), name varchar2(25), prices xmltype;
    example data: 1781, CDW 20/48/E, <product_prices><price_change>
    <change_id>1</change_id>
    <date_changed>2009-10-13</date_changed>
    <details>price increased</details>
    <new_value>234</new_value>
    </price_change>
    <price_change>
    <change_id>2</change_id>
    <date_changed>2009-10-13</date_changed>
    <details>price increased</details>
    <new_value>235</new_value>
    </price_change></product_prices>
    We need to give examples of an update. I have been looking around the net, and these forums for a solution now for about 4 hours. My own thoughts are that to update this with a new price change i need to, SELECT the current data INTO a variable, then concatenate that variable with the new price change info e.g.
    <price_change>
    <change_id>3</change_id>
    <date_changed>2009-10-13</date_changed>
    <details>price decreased</details>
    <new_value>230</new_value>
    </price_change>
    then insert that whole chunk of data again to overwrite the old data.
    Now im fairly certain there is some function somewhere which will allow me to do this update/insert operation without going through this process... After i am done with this update of XMLType column data, i need to tackle updating data in an XMLType Table with XQuery(? apparently), so if you have any pointers for that please let me know.
    Could one of you experts point me in the right direction for this? Any advice at this stage is a great help and will stop me losing my mind.
    p.s. im sorry about the lengthy description of the problem/solution required. How to describle something i dont understand? I ask myself.

    Hi,
    You really need to take a look at the XMLDB Developers guide.
    For updating XML with SQL/XML see UPDATEXML and for XQuery see [Using XQuery with Oracle XMLDB|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb_xquery.htm#sthref1673]
    HTH,
    Chris

Maybe you are looking for