‎2007 Aug 02 6:13 AM
Dear Friends
Basically i had an tables
zhr_pr_m where perid is primary key
zhr_pr_m_sal where perid is again primary key
two fields a field names Inact is also their which is type dataelement j_inact
menas active or inactive
with a screen with transaction zaa
i insert the values in
zhr_pr_m and zhr_pr_m_sal
now with another screen i want to update the
inact field of both tables corresponding perid of zhr_pr_m_sal
that means i had inact field and 3 more fields from zhr_pr_m_sal
now i want for a particular perid wen i run that and save to database then
it should modify that table zhr_pr_m_sal and
automatically update the same value for inact that zhr_pr_m_sal had
Please tell me the solution
i had written modify comand but its inserting the value in othe rline not modifying the same
i m new to abap
With Best Regards
Ruby
‎2007 Aug 02 6:53 AM
Hello Ruby,
This is the syntax for updation of database tables
LOOP AT itab.
MOVE itab TO zdbtab.
UPDATE zdbtab.
ENDLOOP.or
LOOP AT itab INTO wa_itab.
UPDATE zdbtab FROM wa_itab.
ENDLOOP.
‎2007 Aug 02 7:00 AM
friend
itab type??/
zhr_pr_m_sal or zhr_pr_m
as i want to update value for inact first in zhr_pr_m_sal then corresponding value is to be inserted in zhr_pr_m
Hope u got will give me full answer
Thanks & Regards
Ruby
‎2007 Aug 02 7:18 AM
The itab should be of the same type of the table that you are updating
if the table structures are different, then you will have to use two internal tables to update data in both the database tables
so for zhr_pr_m_sal, you can use the update option
LOOP AT itab.
UPDATE zhr_pr_m_sal FROM itab.
ENDLOOP.then copy all that data to an internal table of zhr_pr_m_sal type (eg itab) to the internal table of zhr_pr_m type (eg itab2)
loop at itab.
move-corresponding itab to itab2.
append itab2.
endloop.then insert / modify the zhr_pr_m table from itab2 according to your requirement
‎2007 Aug 02 6:55 AM
Hi,
Do not write the Modify statment, Just change that to UPDATE then it will work
Regards
Sudheer
‎2007 Aug 02 7:08 AM
UPDATE Statement
The UPDATE statement allows updating the values of selected columns of rows of a database table.
Syntax
<update statement> ::= UPDATE <table name> SET <assignment list> ( <where clause> )?.
<assignment list> ::= <assignment> ( ',' <assignment> ).
<assignment> ::= <column name> '=' <update source>.
< update source > ::= <value expression>
| <dynamic parameter specification>
| NULL.
You cannot specify string literals as values for CLOB columns. Hex literals are not supported in Open SQL.
Example
UPDATE employees SET employee_name = 'Mary Jones'
WHERE employee_id = 23
‎2007 Aug 02 8:57 AM