Updating a table using a to_char date

Dear all;
I have the following query and table below
create table t1
       cid varchar2(200),
       yearid varchar2(200),
       begin_date date
insert into t1
           (cid, yearid, begin_date)
         values
           ('A', '2010_1', sysdate);
  insert into t1
           (cid, yearid, begin_date)
         values
           ('B', '2010_1', to_date('03/04/2011', 'MM/DD/YYYY'));
insert into t1
           (cid, yearid, begin_date)
         values
           ('C', '2010_1', to_date('01/02/2011', 'MM/DD/YYYY'));and I have this update statement below
   update t1 t
       set t.yearid = '2011_1'
       where to_char(t.begin_date, 'YYYY') = substr(t.yearid, 1, 4);what i am trying to is basically update table t1 yearid which is a varchar2 where it has to_char begin date that are irregular...so in my sample case,
to_char of the begin date return a 2011
hence, the yearid should be 2011_1 instead.
However, my udate statement isnt working though

Hi,
user13328581 wrote:
Dear all;
I have the following query and table below
create table t1
cid varchar2(200),
yearid varchar2(200),
begin_date date
insert into t1
(cid, yearid, begin_date)
values
('A', '2010_1', sysdate);
insert into t1
(cid, yearid, begin_date)
values
('B', '2010_1', to_date('03/04/2011', 'MM/DD/YYYY'));
insert into t1
(cid, yearid, begin_date)
values
('C', '2010_1', to_date('01/02/2011', 'MM/DD/YYYY'));and I have this update statement below
update t1 t
set t.yearid = '2011_1'
where to_char(t.begin_date, 'YYYY') = substr(t.yearid, 1, 4);what i am trying to is basically update table t1 yearid which is a varchar2 where it has to_char begin date that are irregular...so in my sample case,
to_char of the begin date return a 2011
hence, the yearid should be 2011_1 instead.
However, my udate statement isnt working thoughWhat's wrong with it?
What are the results you want to get (that is, what should the table contain after the UPDATE? Post what you would like to see as the results of "SELECT * FROM t1" after the UPDATE.)
Point out where the UPDATE statement you posted is producing the wrong results.
Is it changing the wrong rows? Maybe the WHERE clause is wrong. Maybe you meant != instead of =.

Similar Messages

  • How to Update  crmd_customer_h TABLE Using CRMV_EVENT Through Funtion Module

    Hi
    How we can update customer_h table using the CRMV_EVENT Where i implemented logic below in the Funtion Module.
    data:     lt_doc_flow          TYPE crmt_doc_flow_wrkt,
              lw_cust_h_com        TYPE crmt_customer_h_com,
              lw_input_field_names TYPE crmt_input_field_names,
              lt_input_field_names TYPE crmt_input_field_names_tab,
              lt_objects_to_save TYPE crmt_object_guid_tab,
              lw_guid TYPE CRMT_OBJECT_GUID.
    DATA : lv_process_type TYPE crmt_process_type.
    data: wa_doc_flow type CRMT_DOC_FLOW_WRK.
    data: wa_customer_h type crmd_customer_h.
    *  Function module for retriving the Process type.
      CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'
        EXPORTING
          iv_orderadm_h_guid     = iv_header_guid
        IMPORTING
          ev_process_type        = lv_process_type
        EXCEPTIONS
          admin_header_not_found = 1
          OTHERS                 = 2.
    if lv_process_type eq 'ZG01'.
    CALL FUNCTION 'CRM_DOC_FLOW_READ_OB'
    EXPORTING
       IV_HEADER_GUID                 = iv_header_guid
    IMPORTING
       ET_DOC_FLOW_WRK                = lt_doc_flow.
    read table lt_doc_flow with key objtype_a = 'BUS2000116' INTO wa_doc_flow. "gc_object_type-service.
                if sy-subrc eq 0.                    "set flag for service order
                lw_cust_h_com-ref_guid       =  wa_doc_flow-objkey_a.
                lw_cust_h_com-ZZTRAIL_FLAG   = 'X'.
                 lw_cust_h_com-mode           = 'A'.
                lw_cust_h_com-ref_handle     = '0000000001'.
                lw_guid = wa_doc_flow-objkey_a.
                INSERT lw_guid INTO TABLE lt_objects_to_save.
         endif.
                  lw_input_field_names-fieldname = 'REF_GUID'.
                lw_input_field_names-fieldname = 'ZZTRAIL_FLAG'.
              lw_input_field_names-changeable = ' '.
               INSERT lw_input_field_names INTO TABLE lt_input_field_names.
    Maintain Customer H
             CALL FUNCTION 'CRM_CUSTOMER_H_MAINTAIN_OW'
                  EXPORTING
                    is_customer_h_com    = lw_cust_h_com
                  CHANGING
                    ct_input_field_names = lt_input_field_names
                  EXCEPTIONS
                    header_change_error  = 1
                    header_create_error  = 2
                   error_occurred       = 3.
    ENDIF.
    *endif.
    *Clearing local variables
      clear: lv_process_type,
             lw_cust_h_com,
             lw_input_field_names.
    *Free internal tables
      free: lt_doc_flow,
            lt_input_field_names.

    Hi Faisal
    I think your not clear with what i am saying anyhow i will again explain you my requirement
    As per my requirement
    1)in the service order search report i need to add a field called "Has trail order with No Follow up" with values "Yes" & "Blank"
    For above Field i added  using the structure CRMST_QUERY_SRVO_BTIL and through configuration i am able to display the field in webui as per (Attachement Pic 1)
    2)When i  search with search criteria as  "Has trail order with No Follow up" with  "Yes"
    Then in result list i need to show the service order those having follow up as trail orders(sales order) only.if for  next document trail order  having any follow up then those service orders dont want to show in result list.
    For above requirement i implemented F.M using CRMV_EVENT & I configured for BUS2000115 And BEFORE_SAVE The Order
    The FM Will get trigger when i save the service order and for that service order if create any follow up and try to save the trail order then This FM Will trigger and in this i am doing validations.
    3)Add one AET Trail Flag field is added under CUSTOMER_H Table.
    4)in the FM I am validating for if the trail order having the preceding document as service order then i need to make flag as "X" For that service order in customer_h
    if suppose when i delete trail order from the service order then that flag must need to be "unset" from the CUSTOMER_H.
    Why bcoz we are doing above process is do show records in result list based on Flag values
    these flag checks are validating in the BADI Which we implemented for search logic.
    Please refer below Login for my requirement:-
    Proposal to have a custom “flag” field (background at table level,
         crmd_customer_h) linked to service order which gets flagged whenever at
         least one Trial order is created and saved from the Service Order.
    The flag value should be cleared when all the trial orders created and
    saved as follow up transactions are deleted from the system.
    Similarly for Trial Orders will use the same custom “flag” field
         which gets activated when at least one follow up is created and saved from Trial Order.
    The flag value should be cleared when all the follow up transactions from
    the Trial Order are deleted from the system.
    When the above search criteria “Has Trial order with no follow up”
         “is” “Yes” is applied then the logic derives all the service
         orders which satisfy additional search criteria applied in the search and
         for these Service orders checks if the custom flag field is checked to
         derive all Service orders which have Trial order. The custom flag values
         values are derived from crmd_customer_h table in CRM.
    4 )Further for all the Trial Orders determined in Step 3
    check if the Trial Order has a follow up by checking if the custom flag field
    is checked. The custom flag values are derived from crmd_customer_h table in
    CRM.
    5) If step 4 is not met populate the preceding Service
    Orders in the Result list

  • Code to update a table using sqlldr

    Hi all,
    can anybody give the code to update a table using sqlldr with an example
    thank you

    You want add the new line and modified the existing line (based on empno) from file e:\scripts\sql\emp2_ext.dat into table emp2 :
    7782,CLARK,MANAGER,7839,09/06/81,80000,,10
    8000,ORACLE,DATABASE,,11/02/07,99999,,20Then :
    SQL> conn system/mypwd
    Connected.
    SQL>
    SQL> create directory my_dir as 'e:\scripts\sql';
    Directory created.
    SQL>
    SQL> grant read,write on directory my_dir to scott;
    Grant succeeded.
    SQL>
    SQL> conn scott/mypwd
    Connected.
    SQL> create table emp2_ext
      2  (EMPNO    NUMBER(4),
      3   ENAME    VARCHAR2(10),
      4   JOB      VARCHAR2(9),
      5   MGR      NUMBER(4),
      6   HIREDATE DATE,
      7   SAL      NUMBER(7,2),
      8   COMM     NUMBER(7,2),
      9   DEPTNO   NUMBER(2)
    10  )     
    11  ORGANIZATION EXTERNAL
    12  ( TYPE ORACLE_LOADER
    13    DEFAULT DIRECTORY my_dir
    14    ACCESS PARAMETERS
    15    ( records delimited by newline
    16      badfile my_dir:'emp2_ext.bad'
    17      logfile my_dir:'emp2_ext.log'
    18      fields terminated by ','
    19      missing field values are null
    20      ( empno, ename, job, mgr, hiredate char date_format date mask "dd/mm/yy",
    21        sal, comm, deptno
    22      )
    23    ) LOCATION ('emp2_ext.dat')
    24  ) ;
    Table created.
    SQL>
    SQL> select * from emp2_ext;
         EMPNO ENAME      JOB              MGR HIREDATE        SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09/06/81      80000                    10
          8000 ORACLE     DATABASE             11/02/07      99999                    20
    SQL> select * from emp2;
         EMPNO ENAME      JOB              MGR HIREDATE        SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09/06/81      24500                    10
          7839 KING       PRESIDENT            17/11/81      50000                    10
          7934 MILLER     CLERK           7782 23/01/82      13000                    10
    SQL> merge into emp2 a
      2  using (select * from emp2_ext) b
      3  on    (a.empno=b.empno)
      4  when matched then update set a.ename=b.ename,
      5                               a.job=b.job,
      6                               a.mgr=b.mgr,
      7                               a.hiredate=b.hiredate,
      8                               a.sal=b.sal,
      9                               a.comm=b.comm,
    10                               a.deptno=b.deptno
    11  when not matched then insert (a.empno, a.ename, a.job, a.mgr, a.hiredate, a.sal, a.comm, a.deptno)
    12                        values (b.empno, b.ename, b.job, b.mgr, b.hiredate, b.sal, b.comm, b.deptno);
    2 rows merged.
    SQL>
    SQL> select * from emp2;
         EMPNO ENAME      JOB              MGR HIREDATE        SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09/06/81      80000                    10 --modified line
          7839 KING       PRESIDENT            17/11/81      50000                    10
          7934 MILLER     CLERK           7782 23/01/82      13000                    10
          8000 ORACLE     DATABASE             11/02/07      99999                    20 --added line
    SQL> HTH,
    Nicolas.
    Well, Hans has already give good explanation with docs links...
    Message was edited by:
    N. Gasparotto

  • Updating EKKO table using E1BPPAREX

    Hi all,
    My requirement is to update ekko table using E1BPPAREX segement. I have gone through so many posts regarding this.
    In my case, PO number is not yet created. I am using BAPI_PO_CREATE1 for creating this . From PI side, if they pass the custom field value in the appropriate postion of VALUEPART field of E1BPPAREX, will it get updated to the ekko table automatically.
    Regards,
    Sajith

    Hi Sajith,
      you have to do is populate structure extensionin. You'll have to implement the fm DDIF_NAMETAB_GET to look for the right place (offset) in order to add the field on the structure extension in.
    Example:
      CALL FUNCTION 'DDIF_NAMETAB_GET'
        EXPORTING
          tabname   = c_ext_table   --> ''BAPI_TE_MEPOHEADER
        TABLES
          dfies_tab = lt_tab
        EXCEPTIONS
          not_found = 1
          OTHERS    = 2.
      CLEAR l_offset.
      LOOP AT lt_tab.
        CASE lt_tab-fieldname.
          WHEN c_yourfield.
            w_extin-valuepart1+l_offset = p_yourfield.
        ENDCASE.
        ADD lt_tab-leng TO l_offset.
      ENDLOOP.
      MOVE c_ext_table TO w_extin-structure.
      APPEND w_extin TO p_i_extin.
    Regards,
    Carlos.

  • Updating multiple tables using JDBC Adapter

    Hi,
    I am trying to insert/update multiple tables using one message via JDBC adapter. The following is the message being posted. However, only the first statement was executed. Anything wrong?
    Thanks in advance!
    Hart
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration"><DeliveryData><DelHeader action="UPDATE_INSERT"><table>DelHeader</table><access><DelNo>0080000230</DelNo><DelType>LF</DelType><XOverwrite>X</XOverwrite><ShipTo>0000000026</ShipTo><SoldTo>0000000026</SoldTo><Priority>00</Priority><DocDate>02/17/2007</DocDate><GText>CIF Test</GText><DelDate>02/20/2007</DelDate><PickDate>02/20/2007</PickDate><ShipPoint>NO02</ShipPoint><PackCount>00000</PackCount></access><key><DelNo>0080000230</DelNo></key></DelHeader>
    <DelItem action="INSERT"><table>DelItem</table><access><DelNo>0080000230</DelNo><ItemNo>000010</ItemNo><GText>10# GRAN-GREAT VALUE</GText><Material>G04410G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BL</UOM></access><access><DelNo>0080000230</DelNo><ItemNo>000020</ItemNo><GText>25# GRAN- GREAT VALUE</GText><Material>G04025G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BG</UOM></access></DelItem></DeliveryData></ns0:DeliveryDBUpdate>

    Hi,
    You need 2 STATEMENT level tags,
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration">
    <b><DeliveryData1></b>
    <DelHeader action="UPDATE_INSERT">
    <table>DelHeader</table>
    <access>
    <DelNo>0080000230</DelNo>
    <DelType>LF</DelType>
    <XOverwrite>X</XOverwrite>
    <ShipTo>0000000026</ShipTo>
    <SoldTo>0000000026</SoldTo>
    <Priority>00</Priority>
    <DocDate>02/17/2007</DocDate>
    <GText>CIF est</GText>
    <DelDate>02/20/2007</DelDate>
    <PickDate>02/20/2007</PickDate>
    <ShipPoint>NO02</ShipPoint>
    <PackCount>00000</PackCount>
    </access>
    <key>
    <DelNo>0080000230</DelNo>
    </key>
    </DelHeader>
    <b><DeliveryData1></b>
    <b><DeliveryData2></b>
    <DelItem action="INSERT">
    <table>DelItem</table>
    <access>
    <DelNo>0080000230</DelNo>
    <ItemNo>000010</ItemNo>
    <GText>10# GRAN-GREAT VALUE</GText>
    <Material>G04410G611</Material>
    <Plant>6005</Plant>
    <SLoc>6005</SLoc>
    <RefDoc>mmenon32</RefDoc>
    <RefItem>00000000</RefItem>
    <DelQty>5.000</DelQty>
    <UOM>BL</UOM>
    </access>
    <access>
    <DelNo>0080000230</DelNo>
    <ItemNo>000020</ItemNo>
    <GText>25# GRAN- GREAT VALUE</GText>
    <Material>G04025G611</Material>
    <Plant>6005</Plant>
    <SLoc>6005</SLoc>
    <RefDoc>mmenon32</RefDoc>
    <RefItem>00000000</RefItem>
    <DelQty>5.000</DelQty>
    <UOM>BG</UOM>
    </access>
    </DelItem>
    <b></DeliveryData2></b>
    </ns0:DeliveryDBUpdate>
    Try with such a strcuture and let us know if it works.
    Regards
    Bhavesh

  • Update a table using MODIFY

    Hi,
    We need your help.
    We want to update a table using the MODIFY command but it does not delete the previous entries instead it INSERTs a new entry.
    Scenario:
    1. Upon calling the Screen for Editing the entry, the previous entry must be deleted
    2. When SAVEd, the new entry must replace the previous entry.

    Make sure that in the definition or your table you have specified the key. Otherwise, the system may "think" that all the fields are part of the key, therefore all lines are different.
    This is a extract from SAP's documentation:
    "The line to be changed is determined by the fact that the content of the table key matches the content of the corresponding components in the wa work area. For tables with a key that is not unique, the first entry that is found is changed. "
    Regards.

  • Update Mseg Table using MB_MIGO_BADI

    Hi Experts
    I had a requirement to add an additional tabstrip at the item level of MIGO transaction .
    I have implmeented the same using MB_MIGO_BADI .
    I have also added a field quantity on this tab.
    The problem now is i'm not able to update this field in the MSEG table.
    I have extended the MSEG table using append structures.
    Regards,
    Sunitha.
    Edited by: sunitha j on Mar 1, 2009 2:34 PM

    check whehter the added field is getting the data that you enter in the trnasaction in debug mode and whether the move of the data is happening...
    Regards,
    Sravan.

  • Updating lookup table using merge query

    Hi Experts,
    My requirement is, we have total 4 tables called x,y,z and a_lookup table. join column between all these tables is deptno.
    I need to update a_lookup table based on below conditions
       condition1 :   Update a_lookup table with matched records of X and Y
       condition2:    If there is any record in X is not matching with Y, then we need to compare with Z and update the a_lookup table accordingly
    Here is the table scripts and my attempt as well.
    Only doubt is,  is my MERGE statement looks fine or is there any other better way to update the a_lookup table ?
    Please share your thoughts on this.
    create table x(empno number, deptno number);
      -- sample data
      insert into x
        select level, level * 10 from dual connect by level <= 10;
      create table y(empno number, deptno number);
      -- sample data
      insert into y
        select level, level * 10 from dual connect by level <= 5;
      create table z(empno number, deptno number);
      -- sample data
      insert into z
        select level, level * 10 from dual connect by level <= 10;
      create table a_lookup(empno number, deptno_lookup number);
      -- sample data
      insert into a_lookup
        select null, level * 10 from dual connect by level <= 10;
      -- Merging records into a_lookup based on X,Y,Z. Used right outer join on X and Y
    merge into a_lookup a
    using ( (select  x.deptno,x.empno   from x,y where x.deptno=y.deptno)
               union all
               (select z.deptno,z.empno from z, (select x.deptno from x,y where x.deptno=y.deptno and y.deptno is null)  res1
                  where z.deptno = res1.deptno)
               ) res
    on( a.deptno_lookup = res.deptno)
    when matched then
      update set a.empno = res.empno;
    Cheers,
    Suri ;-)

    Assuming empno is unique in X, Y and Z:
    merge
      into a_lookup a
      using (
             select  nvl(y.empno,z.empno) empno,
                     x.deptno
               from  x,
                     y,
                     z
               where y.deptno(+) = x.deptno
                 and z.deptno(+) = x.deptno
            ) b
      on (
              a.deptno_lookup = b.deptno
          and
              b.empno is not null
      when matched
        then
          update
             set a.empno = b.empno
    10 rows merged.
    SCOTT@orcl > select * from a_lookup;
         EMPNO DEPTNO_LOOKUP
             1            10
             2            20
             3            30
             4            40
             5            50
             6            60
             7            70
             8            80
             9            90
            10           100
    10 rows selected.
    SCOTT@orcl >
    SY.

  • Updating a Table using Spreadsheet

    Hi,
    There are a couple tables that I would like to update regularly, like once every week. Instead of adding new rows, how can I update the tables by uploading CSV files using the Upload Utilities?
    Thank you very much for your help in advance!

    Here is an easier solution..
    1) Have you DBA create an Oracle directory on the server (it is created in Oracle and maps to a operating system directory.
    2) Create a external table in that directory, have it have the same layout as your spreadsheet
    3) Now when you build the external table, give it the name of the spreadsheet file
    4) You can then copy the file to the directory
    5) Write a small pl/sql script to select from the external table and do a merge of the data selected into the existing table (See merge command syntax here: http://www.oracle.com/technology/products/oracle9i/daily/Aug24.html)
    Thank you,
    Tony Miller
    Webster, TX

  • Update sap table using a function module call by php code

    Hello,
    I m trying to update the table VBAP using a function module ZZ_SET_DISTANCE  call by a php code.
    But I have this problem:
    the saprfc seems to work well but when I look to the table VBAP the fields have not been update.
    I tried the function module in debug mode and it work good. The fields are update.
    I also handle the saprfc call function and the return SAPRFC_OK
    This are the function module ZZ_SET_DISTANCE, and the php code
    //PHP CODE
    $fce = saprfc_function_discover($sap,"ZZ_SET_DISTANCE");
                  if (! $fce ) {echo "Echec d'ouverture du module fonction "; exit;}
                   saprfc_import ($fce,"COMMANDE", '0000001998');
                   saprfc_table_init($fce,"TBLE_CMDE");
                        $val=array();
                        $val['NUM_POST']='000030';
                        $val['HN_EXP']='';
                        $val['ST_EXP']='';
                        $val['PC_EXP']='';
                        $val['CI_EXP']='';
                        $val['CO_EXP']='';
                        $val['HN_REC']='';
                        $val['ST_REC']='';
                        $val['PC_REC']='';
                        $val['CI_REC']='';
                        $val['CO_REC']='';
                        $val['DIST']='popo';
                        saprfc_table_append ($fce,"TBLE_CMDE", $val);
                 $rfc_rc = saprfc_call_and_receive ($fce);
                 echo "\n".$rfc_rc;
                 if ($rfc_rc != SAPRFC_OK) { if ($sap == SAPRFC_EXCEPTION ) echo ("Exception raised: ".saprfc_exception($fce)); else echo (saprfc_error($fce)); }else{echo '/execution de la function ;}
                 saprfc_function_free($fce);
    //FUNCTION MODULE ZZ_SET_DISTANCE
    FUNCTION ZZ_SET_DISTANCE.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(COMMANDE) TYPE  VBELN
    *"  TABLES
    *"      TBLE_CMDE STRUCTURE  ZADD_COM_LOXAN
    DATA : NUMC TYPE VBELN.
    NUMC = COMMANDE .
    WHILE STRLEN( NUMC ) < 10 .
      CONCATENATE '0' NUMC INTO NUMC .
    ENDWHILE .
    DATA tble_addrcomm LIKE LINE OF TBLE_CMDE .
    LOOP AT  TBLE_CMDE INTO  tble_addrcomm.
      DATA : NUMP TYPE POSNR.
      NUMP = tble_addrcomm-NUM_POST.
      WHILE STRLEN( NUMP ) < 6 .
      CONCATENATE '0' NUMP INTO NUMP .
      ENDWHILE .
      UPDATE VBAP SET ARKTX = tble_addrcomm-DIST
      WHERE VBELN EQ COMMANDE
      AND POSNR EQ NUMP.
    ENDLOOP.
    ENDFUNCTION.
    Is anybody can help me?
    thank.

    Marie, create a Blog please, about more details for dummies....
    1) how to connect to sap system?
    2) you run the php code where? in a webserver or where?
    3) wich is the url for run the FM: ZZ_SET_DISTANCE
    4) you placed some dlls files on the web server?
    please is interesting this...
    Thanks

  • 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.

  • Update a table using OWB

    Hi All,
    I have a unique requirement where the data comes from two different sources using the following cases in perspective
    - Table A and Table B have common ID's but different information regarding the same entity.
    - Table A has the commanding records going into the target table and table B fills in some other details not available in table A.
    so in essence I am merging data which can be accomplished by UPDATE/INSERT ....How ever I am constrained by the date element , data from table B merges in to the target table different for a given period of time , so what I have done is created a bunch of mappings just to update the table with the logic for the different years and I am using the UPDATE operator to update the records and mapping is taking a long time , just to update 122,360 records the mapping has been running for about 2 hours.
    Any suggestions on how to better approach this?
    Regards,
    Malam

    Hi Malam,
    there is no simple answer to your question. Maybe SQL tuning is the most complex subject for relational databases.
    For example of successful SQL tuning look at this thread Hanging deployment
    Regards,
    Oleg

  • Update a table using plsql procedure

    Can any one help me to write a plsql procedure to update a table with new records and changes;
    Table rtest1 contains following records:
    deptno(number) deptname(varchar2(10)
    10 EWP
    20 PWD
    30 EPF
    Table rtest2 contains follwing records:
    deptno(number) deptname(varchar2(10)
    10 prod
    40 ops
    how to write a plsql procedure to to update table rtest2 using rtest1 data .

    use a merge statement, like this:
    SQL> create table rtest1
      2  as
      3  select 10 deptno, 'EWP' deptname from dual union all
      4  select 20, 'PWD' from dual union all
      5  select 30, 'EPF' from dual
      6  /
    Tabel is aangemaakt.
    SQL> create table rtest2
      2  as
      3  select 10 deptno, 'prod' deptname from dual union all
      4  select 40, 'ops' from dual
      5  /
    Tabel is aangemaakt.
    SQL> create procedure my_merge
      2  is
      3  begin
      4    merge into rtest2 r2
      5    using (select deptno, deptname from rtest1) r1
      6       on (r2.deptno = r1.deptno)
      7     when matched then
      8          update set deptname = r1.deptname
      9     when not matched then
    10          insert (deptno,deptname) values (r1.deptno,r1.deptname)
    11    ;
    12  end;
    13  /
    Procedure is aangemaakt.
    SQL> exec my_merge
    PL/SQL-procedure is geslaagd.
    SQL> select * from rtest2 order by deptno
      2  /
                                    DEPTNO DEPT
                                        10 EWP
                                        20 PWD
                                        30 EPF
                                        40 ops
    4 rijen zijn geselecteerd.Regards,
    Rob.

  • Update a table using same variable name as the column

    I am not able to update a table column using a local variable which is having same name as the table column. Example of the function is as follows:
    create or replace function trial return integer as
    column1 integer:=99;
    BEGIN
    update firsttable set column1=column1 where column2='john';
    return 0;
    END;
    Existing data in firsttable:
    COLUMN1 COLUMN2
    123 xyz
    123 abcd
    101 john

    Unfortunately table aliasing won't help... Although specifying the procedure will. Somewhat academic I know, since if you can prefix the procedure name on the variable you can just as easily rename it, unless you happen to have a bunch of other code calling it using named notation possibly.
    SQL> select ename, comm from emp where empno = 7934;
    ENAME            COMM
    MILLER
    SQL> create or replace procedure new_comm
      2   (empno in number, comm in number)
      3  is
      4  begin
      5      update emp e
      6      set e.comm = new_comm.comm
      7      where e.empno = new_comm.empno;
      8      dbms_output.put_line('updated '||sql%rowcount||' rows!');
      9  end;
    10  /
    Procedure created.
    SQL> exec new_comm (7934, 100)
    updated 1 rows!
    PL/SQL procedure successfully completed.
    SQL> select ename, comm from emp where empno = 7934;
    ENAME            COMM
    MILLER            100Message was edited by:
    3360
    Colin beat me to it

  • Updating SAP  Table using JCO

    Dear All
                      How to update SAP Table (Any single or multiple tables) through Java code using JCO. Can any body provide sample code regarding this...
    Thanks&Regards
    mgreddy

    Hi,
    I think for that anyway you will have to use JCO as the middleware to connect to SAP R/3.
    So what you can to do is to write three RFCs and call them through JCO from your JAVA application.
    1. First BAPI for reading the dictionary information about an SAP table.
    2. Second to read data from the table.
    3. And, third to write data to that table.
    But if you want to edit any table (and not a specific table) then your program will become even more complex since then you will have to pass the table name and information dynamically to the BAPIs.
    Best regards,
    Guru.

Maybe you are looking for

  • Automatically Replacing Images Without Losing Previous Image's Action

    I've created updated versions of some images in a Keynote presentation, but the images they replace have actions assigned to them. Is it possible to update a pre-existing image so the updated version retains any actions?

  • 1st gen shuffle not recognized by windows, itunes, or reset utility

    Have had shuffle for just over a year (figures). Ran out of charge, tried to charge it, but computer didn't recognize. Have tried to reset and recharge. No lights come on when attached to computer. When I try to play it, green light comes on momentar

  • How do you get movies in iTunes from the iMovie app?

    When I want to export a movie from iMovie, I "Send project to - iTunes". .........the screen says "Send to iTunes complete, your project will appear in the File Sharing section of iTunes as: My Project" The problem is, is that I can't find where the

  • Translate codepage/number...format

    Hi all, I have querry like  TRANSLATE g_t_likp_download FROM CODE PAGE '1110' TO CODE PAGE '0100'. in 4.6b But the same is not working in ECC6.0. For the same need to use either of CL_ABAP_CONV_IN_CE, CL_ABAP_CONV_OUT_CE or CL_ABAP_CONV_X2X_CE  of th

  • Dashboard Prompt Issue

    hi all, I have taken four coulmns as prompts. Prompt coulmn names : Region, Start date, End Date, Meeting name. All the four columns are from the same table My Scenario: if the user selects the prompt 1[region], and then the prompt 2[start date] and