Update a table Z using SM30 events

Hi experts,
I've been told to do the following:
I have a table ZYOPER that the user can modify through a SM30 (actually by another transaction that calls the SM30).
Now they want every time you update/create/delete a record in this table ZYOPER, save a log in another table ZYOPERLOG indicating the action completed and the data contained in these records.
I implemented the following events but it's not fine...
- 03 (new entry, field ZYOPERLG-action = 'INSERT')
- 05 (delete entry, field ZYOPERLG-action = 'DELETE')
- 02 (Modify the new table ZYOPERLOG)
The issue is that in the 02 event I have tables Total and Extract, which are all the records contained in ZYOPER even if they have been modified or not. Can I do it with import and export? Is it possible to declare a global internal table i_zyoperlog in order to keep the records updated/deleted/created ?
Thanks in advance...
Mary

Your requirement is a good use-case for [Event 01: Before Saving the Data in the Database|http://help.sap.com/saphelp_nw04s/helpdata/en/91/ca9f0ba9d111d1a5690000e82deaaa/content.htm].
Why do you need this custom table anyway? You can set the "log data change" setting & evaluate it via trxn SCU3.
BR,
Suhas

Similar Messages

  • Updating ARDT table without using direct update statement

    hi,
        can any one guide me how to update REMARK field in the ADRT table without using direct UPDATE statement. It would be helpful if any one can tell me the bapi or a function module with a sample code.

    Hi                                                                               
    <b>SZA0                           Business Address Services (w/o Dialog) </b> ADDR_PERSONAL_UPDATE                                                          
    ADDR_PERSON_UPDATE                                                            
    ADDR_PERS_COMP_UPDATE                                                         
    ADDR_UPDATE                                                                   
    these are the four function modules which will update the (Business Address Services) reward if usefull
    check these is there any  help ful for u or not

  • Update TVARV table entries using a Function Module or Program

    Hi Gurus,
    My requirement is that I have a entry in TVARV table which has a 'low'. We would like to change this value whenever we desire. We are unable to do it via sm30 and se16 as table maintenance access is not permitted in Production environment.
    Can you please provide any Function module or program code to do it?
    Requirement - User can enter a value into TVARV table by executing a function module or program
    Thank you all, will award points,
    Priyansh

    Hi Priyansh,
    Please refer to SAP Help for more information on variant maintenance and more specifically variable values in variants. You can use t/code STVARV for maintaining the variant variables in table TVARVC (Client-Specific Variant Variables).
    Note: I suggest to use the TVARVC table instead of TVARV.
    If you are looking for Function Modules in the area of Variant Maintenance, then please have a look at Function Group SVAR (t/code SE80).
    If you are looking for Function Modules in the area of User Variables in Variants, then please have a look at Function Group SVUV (t/code SE80).
    Furthermore, if you are looking for a program to update table TVARVC, please have a look at ABAP: Dynamic Variant Processing with STVARV.
    Best eregards,
    Sander

  • Update the table SCMG_T_CASE_ATTR using BAPI

    Hi Experts,
    I have query regarding bapi BAPI_DISPUTE_ATTRIBUTES_CHANGE.
    what are the values to be passed in attribute of tables section.
    I have pass field name as 'closed_by' (of table SCMG_T_CASE_ATTR) in parameter of bapi (ATTR_ID).
    And attr_value field with 'test'.
    Please help me to update a field value like 'closed_by' of SCMG_T_CASE_ATTR using this bapi.
    Thanks in advance,
    Sahil

    Hi Cristobal,
    Thanks for helping me, however the function does not give me any results, the problem is that this document is a linked object, and not an attachment.
    Thanks for your help.
    Best regards,
    Adriana

  • Problem in updating IMRG table when using MEASUREM_DOCUM_RFC_SINGLE_001

    Hi experts,
                   I am using MEASUREM_DOCUM_RFC_SINGLE_001 to create measuring documents for the equipment assigned to a functional location. But when i used this in ECC 5.0 the table IMRG  is updated rightly. Now i am using the same in ECC 6.0 , I observe that the following fields of IMRG table are not get updated when compared with 5.0:
    CNTRG
    CNTRR
    CNTRRI
    CDIFF
    CDIFFI
      IDIFF
    Can any one tell what could be the problem.

    Check for  Sap notes for Function module MEASUREM_DOCUM_RFC_SINGLE_001.
    And apply SAP notes correctly according to patch levels.

  • Problem with updating DB table in using BAPI

    HI,
    The code below does not update the DB table even if the commit work is executed... is there something wrong or missing??? Thanks a lot!
    Technically complete process Order
           CALL FUNCTION 'BAPI_PROCORD_COMPLETE_TECH'
             IMPORTING
               return = i_messages
             TABLES
               orders = i_orders.
             IF i_messages-type NE c_error.
               REFRESH i_messages3.
               CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                 EXPORTING
                   wait   = 'X'
                 IMPORTING
                   return = i_messages3.
            ENDIF.

    Hi this is your code right.
    You have to check the return table not messages.
    Check the return table is there any message type is there with 'E' .
    if it is there then the commit work won't give the result in fact the BAPI function is not executed successfully.
    If you got any Error message in return table please have a look into that table errors and take the necessary action.
    Pass the required paramaters for the BAPI function module.
    Regards,
    Madan.

  • 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

  • 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

  • Module pool - for updating Z table

    Moderator message: please using a more meaningful subject.  I've edited it for you this time.
    Hi i have a reuire ment like  this.
    i want to update Z table, by using report program.report is having selection screen ti select data from Z table and to disply in a screen like SM30, i am displying in table control using screen.and i am updating Z table.
    i want to display the selection screen data which ever i have given just above the table control which ever i am displaying now.
    can any body help me out pls.
    Regards
    naidu

    Hi palani thanks for reply.
    i tried in this way already but the problem is we dont know how many values user  will enter to define, suppose if user may enter 1000 entries in one selection field  or beyond that also.
    in this case again the problem.
    and one more thing suppose i ahve selection screen like this
    company code   parameter               mandatory
    sales org.          ranges
    division              ranges
    KUNNR               ranges
    if suppose user entered only mandatory value, and KUNNR we need to display only those two in output, but here in module pool by using screen table if we disable the screen two blank lines will come.
    ex
    cmpany code 0001
    KUNNR         from 1000 TO 2000.
    expected result for this is
    cmpany code 0001
    KUNNR         from 1000 TO 2000.
    i used scren-input for this but ididnt get,
    could you please help me in this.
    thanks and regards
    naidu

  • Error while executing the table statistics using Brtools

    Dear Team,
    We are getting ORA-01031: insufficient privileges error whenever we have tried to execute the update or table statistics using brtools on our SAP development server. I have checked the permissions of sapcheck directory and changed it to 775 still error remains the same. I have observed, it is failing to create the sta or chk files in sapcheck directory after executing update statistics using Brtools.
    BR0291I BRCONNECT will be started with options '-p initDEV.sap -l E -f stats -t  "USTUD" -p 1'
    BR0280I BRTOOLS time stamp: 2010-07-20 12.02.33
    BR0670I Enter 'c[ont]' to continue, 'b[ack]' to go back, 's[top]' to abort:
    c
    BR0280I BRTOOLS time stamp: 2010-07-20 12.02.34
    BR0257I Your reply: 'c'
    BR0259I Program execution will be continued...
    BR0801I BRCONNECT 6.40 (50)
    BR0280I BRCONNECT time stamp: 2010-07-20 12.02.42
    BR0301E SQL error -1031 at location BrLicCheck-12
    ORA-01031: insufficient privileges
    BR0806I End of BRCONNECT processing: cedsegpe.log 2010-07-20 12.02.42
    BR0280I BRCONNECT time stamp: 2010-07-20 12.02.42
    BR0804I BRCONNECT terminated with errors
    I have checked the owner for SAPUSER table and it is showing as OPS$DEVADM
    Please, advise me on the same.
    Thanks and Regards,
    Kedar

    Dear All,
    Thanks for your responses.
    Permissions are set as below for br* files.
    sap-dev:devadm 23> ls -ltr br*
    -rwxrwxr-x   1 oradev     sapsys     3437688 Oct 31  2008 brarchive
    -rwxrwxr-x   1 oradev     sapsys     3547760 Oct 31  2008 brbackup
    -rwxrwxr-x   1 oradev     sapsys     4632408 Oct 31  2008 brconnect
    -rwxrwxr-x   1 devadm     sapsys     3850224 Oct 31  2008 brrecover
    -rwxrwxr-x   1 devadm     sapsys     1480656 Oct 31  2008 brrestore
    -rwxrwxr-x   1 devadm     sapsys     4837672 Oct 31  2008 brspace
    -rwxrwxr-x   1 oradev     sapsys     2175208 Oct 31  2008 brtools
    I guess it is fine because with these set of permissions, it is working absolutely fine in my quality system.
    QAS Permissions are as belows for your information
    sap-qas:qa1adm 22> ls -ltr br*
    -rwsrwxr-x   1 oraqa1     sapsys     3437688 Oct 31  2008 brarchive
    -rwsrwxr-x   1 oraqa1     sapsys     3547760 Oct 31  2008 brbackup
    -rwsrwxr-x   1 oraqa1     sapsys     4632408 Oct 31  2008 brconnect
    -rwxrwxr-x   1 qa1adm     sapsys     3850224 Oct 31  2008 brrecover
    -rwxrwxr-x   1 qa1adm     sapsys     1480656 Oct 31  2008 brrestore
    -rwxrwxr-x   1 qa1adm     sapsys     4837672 Oct 31  2008 brspace
    -rwsrwxr-x   1 oraqa1     sapsys     2175208 Oct 31  2008 brtools
    So do you feel still it has something to do with permissions?
    Thanks and Regards,
    Kedar

  • Update enrolled table which has 6 composite primary key

    Hi Everyone,
    I am trying to update a grade column in table called enrolled which has 6 composite primary key column including SID, TERMYEAR, FACCODE, DEPCODE, COURSENO, SECNO and 2 extra column including GRADE, IDD all of them are of type VARCHAR2 as describe below:
    To update this table I used the command below:
    UPDATE enrolled
    SET grade = :COURSE_BLOCK.GRADE_TEXT
    WHERE IID = :GLOBAL.logUserid
    AND SID = :COURSE_BLOCK.SID_TEXT
    AND FACCODE = :COURSE_BLOCK.FACULTY_TEXT
    AND DEPCODE = :COURSE_BLOCK.DEPARTMENT_TEXT
    AND COURSENO = :COURSE_BLOCK.COURSE_TEXT
    AND SECNO = :COURSE_BLOCK.SECTION_TEXT;
    Note: the :GLOBAL.logUserid is a global variable that I assigned the user id when the user log on to the application.
    When I run the application and fill out the form in order to update the table this doesn't update the table and if I use SQL*PLUS as well with the values that I use for the form to update the table I get message: o rows updated
    Can Someone help please?

    Here is the solution.
    The problem:
    The problem was that the enrolled table was designed in a way that a student can enrolled in the lecture(LEC type column) and Laboratory(LAB type column). When a student is given a grade, it is given a grade for the course 100 (eg: 03-60-100) this course has a lecture and lab. this course belong to the faculty code 03(science) department 60 (computer Science) so when a student register to a course, will register to a lecture and a lab but he will receive a grade for the course 100 lec in this case Oracle couldn't update the table because there was two column with course 100 for that particular student Id
    The solution:
    There are many solution I believe but my quickest solution is when a student register to the course by default is given a grade 'I' means Incomplete then when the instructor add the grade, he can just update a grade from incomplete to the final grade (eg A) now the code will be to get only the course 100 that has grade and discard that doesn't have grade this means that I need only to make sure that the WHERE Clause grade is not null shown below.
    UPDATE enrolled
    SET grade = BLOCK_NAME.FIELD_NAME
    WHERE grade IS NOY NULL
    AND IID = BLOCK_NAME.FIELD
    AND faccode = BLOCK_NAME.FIELD
    AND depcode = BLOCK_NAME.FIELD
    AND courseno= BLOCK_NAME.FIELD_NAME
    NAD secno = BLOCK_NAME.FIELD_NAME
    AND SID = BLOCK_NAME.FIELD_NAME

  • Updation of table records having 5-6 primary key columns.

    I have a table structure having 12 primary composite keys.I have created report + form on this table.My requirement is to update the table by using form items fields.I am taking help of url option on report attribute page of application to fetch data on form page when we click on edit link of report page.Now i am having two problems which are as follows:-
    (i)I am unable to update data as requirement is to update 5 to 6 primary fields along with other non primary keys.I tried to create Pl/SQL process which will run update query but this process is not updating values.Is there any way that i could fetch data direct from database table in query rather then taking item values.Is there any other workaround?
    (ii)One of the primary key column contains records which have ' , ' in them .For ex:- cluth,bearing.So when i get navigated to edit page i am only getting text displayed as clutch i.e. text before ',' is getting displayed in text field while comma and the text after this is not getting displayed in text field of form page.
    Any solutions will be very helpful.
    Thanks
    Abhi

    Hello Abhi,
    >> I am unable to update data as requirement is to update 5 to 6 primary fields along with other non primary keys
    APEX wizards support a composite PK with up to 2 segments only. For every other scenario, you’ll have to manually create your DML code.
    If you have control over your data model, I would listen very carefully to Andre advices. Using a single segment PK is the best practice way. If you can’t add PK to your table, it seems that you’ll have to write your own DML code. The Object Browser option of creating a Package with methods on database table(s) can be a great help.
    >> … I am taking help of url option … One of the primary key column contains records which have ' , ' in them …
    Using the f?p notation, to pass a comma in an item value, you should enclose the characters with backslashes. For example,
    \cluth,bearing\In your case, it should be the item/column notation.
    http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/concept.htm#BCEDJBEH
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • Problem: Z table data updates using SM30

    Hi,
    I have a requirement, while updating records in a Z table
    using SM30 Transaction.
    The Structure of the table is below:
    APMOD    Primary Key   Char(3)
    KONST    Primary Key   Char(20)
    ENDDA    Primary Key   DATS
    BEGDA    Non Key       DATS   
    and some other non key fields....
    Problem:  This table should act something like Infotype in HR.  I mean Delimition of Records while creating or changeing the existing record.
    Say there is a record
    APMOD = OGMT
    KONST = Organization Management
    BEGDA = 01/01/2004
    ENDDA = 12/31/9999
    Whenever i am Inserting a new record with key
    APMOD = OGMT and KONST = 'Organization Management'
    and BEGDA = '01/01/2006'.
    First it should update the old record with
    BEGDA = 01/01/2004 and ENDDA = 12/31/2005
    Then the new record needs to be inserted with
    BEGDA = 01/01/2006 and ENDDA = 12/31/9999.
    How can I achieve this using SM30? Can we write our own code somewhere? If yes Where and How?  Or is there any settings available for this requirement?
    I can write a Z program to update this Table, but i should achieve this using SM30 only.
    Let me know if you need any additional info. 
    Regards,
    Sudhakar.

    Hi Sudhakar,
    1. I tried the same at my end. It works fantastic !
       In  SM30 it shows
       'Delimit' Button
       'Expand <--> Collapse' Button.
        and accordingly delmits the records.
    2. in SE11,
       Use the menu
       Utilities ---> Table Maintenance Generator
       and finally build a table maintenance
       to use in SM30.
    3. When u use in SM30,
       u will achieve what u want.
    4. Just make sure your field
       ENDDA has the data element ENDDA
       in table definition.
      It should also be key.
    5. After this ENDDA column,
       there should be no other key column
      ( not even BEGDA)
    I Hope it helps.
    Regards,
    Amit M.

  • Updating a table using a custom OM infotype

    Hey gurus,
    I have created a custom OM infotype HRP9608. I wish to use this infotype to update a table.
    I marked it as an external, country specific infotype and blanked out the Database table from SM30 (table T777D)
    I have also blanked out the FM. for tab name using SM30 (table T77ID) and added in Read Function and Primary Table.
    The infotype gets created correctly, but when i add it as an external infotype the screen changes. Can someone please provide me with a solution.
    Thanks.

    Hi,
    See the given link, It may help you.
    https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=64259392
    Regards,
    Shamma

  • I want to write condition while creating table/maintaining table using SM30

    Hello all,
    I am creating table Z_CUST with only 2 fields Client, Customer number using SE11 transcation then maintain using SM30 transcation.
    User should only be allowed to enter customer number that is in account group(KNA1-KTOKD) ‘Z011’. This  validation should be performed during data entry.

    Hi,
    Crete the table maintenance generator for your Ztable.
    below is the brief procedure to create table maintenance.
    Table maintenance generator is basically used to do table operations like (insert, delete, modify...).
    if you create table maintenance for your table it will build a module pool program, by using you do the above operations.
    below is the procedure to create table maintenance generator.
    1) Create one function group.
    2) after activating your Ztable, choose 'Utilities'----> 'Table maintenance genrator'.
    3) then give the authorization group and function group created abobe in the next screen.
    4) Then choose the "create" button in your application tool bar, which will creates the module pool program.
    5) then create one Tcode by chosing "Transaction with parameters( parameter transaction)".
    6) in transaction field give "SM30", select the check box "Skip initial screen".
    7) in the below of that screen you can find the "Default values" frame.
    8) there under the "name of screen field" select the "View name' and 'update".
    9) in value column against to "view name" give you table name, and against to "Update" put 'X' in capital letters.
    save it then you can straight away use this newly created Tcode to maintain your table.
    Note:- 1) make the modification while saving the data into your table using this newly generated program to carry out your validation (even though it looks like standard program; no need to enter the access key).
    2) if you do any changes to your table and press the activate button automatically the table maintenace generator will be goes off, you need to create this again.
    Reward if useful.
    Thanks,
    Sreeram.

Maybe you are looking for

  • Delta Download from ISU BP to CRM BP doesn't work

    Hi Experts, We are currently new implementing a CRM7.0 system which is connected to an existing ISU system. We now have an issue about the BP delta download from ISU -> CRM. Replication Scenario: ISU BP -> CRM BP, NOT SD Customer -> CRM BP. As ISU is

  • How to call a form by JfPreamble

    Hello, can i call a form with JfPreamble without call through files.dat I had inserted ^form module name.mdf in the jfPreamble but when i launch the test for presentment appear an error : Error '-14' from print module. Make sure the 'Output to' or 'P

  • Datagrid itemrenderer fails - data interchanged between cells

    Hi, I have the follwing datagrid, the 2nd column of which calls an itemrenderer... <mx:DataGrid x="10" y="10" width="478" height="209" headerHeight="0" id="dgFollowUp"  verticalAlign="top" variableRowHeight="true" wordWrap="true" borderStyle="none" b

  • Webdynpro standard app is failing to change description accord to sort code

    Hi Gurus, I have an issue in standard webdynpro application Personal Information->Bank Information-> If I change the sort code of the bank account it should display the bankname which is associated with the particular sortcode. but its not happening

  • RESTfull java Web Services....the best framework?

    Hi, I am currently working on Spring framework, ant build tool and Tomcat. I am planning to implement RESTful web services in my application. Any idea which framework is best to use and Can any one suggest me few good books? Your help is greatly appr