‎2008 Jun 19 11:18 PM
Hello,
I am trying to populate the custom table. Now after certain logic, I am using update statement as follows.
Loop.
:
:
WA_ZKEYSAP-KEYROLE = I_KEYROLE-KEYROLE.
WA_ZKEYSAP-ROLE = I_ROLE-ROLE.
UPDATE ZKEYSAPMAP FROM WA_ZKEYSAP.
:
:
ENDLOOP.
In every run the values of I_KEYROLE-KEYROLE and I_ROLE-ROLE but the table does not
get updated with a new line.
I want as following:
For example:
If in first loop run, the values of I_KEYROLE-KEYROLE = A and I_ROLE-ROLE =B,
then, table should have.
A...B
If in next run again the values are same as A and B for rescpective field then
no change in table
In third run if values are A and C, then table should get updated by A and C
Table will have final result like below.
A...B
A...C
Regards,
Rajesh.
‎2008 Jun 19 11:31 PM
‎2008 Jun 19 11:31 PM
‎2008 Jun 19 11:39 PM
It doesn't work. See the more simplified program below:
TABLES: ZKEYSAPMAP, ZROLEMAP.
DATA: WA_ZKEYSAP TYPE ZKEYSAPMAP.
DATA: BEGIN OF I_KEYROLE occurs 0,
KEYROLE LIKE ZROLEMAP-KEYROLE,
TCODE LIKE ZROLEMAP-TCODE,
OBJECT LIKE ZROLEMAP-OBJECT,
FIELD LIKE ZROLEMAP-FIELD,
VALUE LIKE ZROLEMAP-VALUE,
END OF I_KEYROLE.
Select KEYROLE TCODE OBJECT FIELD VALUE from ZROLEMAP into table
I_KEYROLE.
WA_ZKEYSAP-KEYROLE = 'KR001'.
WA_ZKEYSAP-ROLE = 'KIS09'.
MODIFY ZKEYSAPMAP FROM WA_ZKEYSAP.
WA_ZKEYSAP-KEYROLE = 'KR002'.
WA_ZKEYSAP-ROLE = 'KIS10'.
MODIFY ZKEYSAPMAP FROM WA_ZKEYSAP.
Still only one line getting updated and the ultimate result is:
KR002....KIS10
‎2008 Jun 19 11:50 PM
what is the key for this Ztable . Try making the two fields as key .
‎2008 Jun 20 5:54 AM
Hi..
The problem is the first field(KEYROLE) is the primary key..So it cant have duplicate entries...
Hence its modifying the existing entry...instead of appending a new entry....Try making the 2nd field the primary key...Or declare another field and make it primary key....Then u will get appending entries...as u want...
Reward points if the above ans is useful...
Edited by: Rudra Prasanna Mohapatra on Jun 20, 2008 6:55 AM
‎2008 Jun 20 6:06 AM
hi,
try to use clear statement after ur first modify statement.