‎2008 Mar 25 9:02 AM
hi all,
Please check the below code
MOVE p_wa_vbap_kkunnr TO p_wa_ygvdebireg-zkunnr.
MOVE p_wa_vbap_yygfkto TO p_wa_ygvdebireg-zfktov.
MOVE '0101' TO p_wa_ygvdebireg-zvkoku.
MOVE '72' TO p_wa_ygvdebireg-zvtwku.
MOVE '01' TO p_wa_ygvdebireg-zspaku.
MOVE p_wa_vbap_kunnr TO p_wa_ygvdebireg-zregu3.
MODIFY ygvdebireg FROM p_wa_ygvdebireg.
IF t_modus EQ 'X'.
IF sy-subrc = 0.
WRITE:/ 'YGVDEBIREG',text-005,'ZKUNNR:',wa_ygvdebireg-zkunnr,'ZREGU3:',wa_ygvdebireg-zregu3.
ELSE.
WRITE:/ 'YGVDEBIREG',text-008,'ZKUNNR:',wa_ygvdebireg-zkunnr,'ZREGU3:',wa_ygvdebireg-zregu3.
ENDIF.
ENDIF.
here the modify alwys gives a sy-subrc 0 even when the primary keys are not changing .
whts the problem?
i dnt know if this is possible?
Please let me know?
‎2008 Mar 25 9:07 AM
Hi,
Modify always results in sy-subrc eq 0 if the record is there.
If the record is not there,modify will lead to abap dump error.
if the primary key changes,the records can only be appended and cannot be modified.
Reward if helpful
Regards
Vodka.
‎2008 Mar 25 9:11 AM
Also check for other fields if they are changing and not only
primary keys.
or check if any record is inserted ...
‎2008 Mar 25 9:16 AM
Hi,
Modify always gives sy-subrc = 0.
If a record is found in the table with the same key it modifies the same record else it will insert a new record. So there will be no option of sy-subrc ne 0.
In your case check if the record data has been changing for every execution or not, dont only rely on key field values also check non-key values.
Regards
Sunil Kumar P
‎2008 Mar 25 9:17 AM
Hi
if you use modify statement, then it wont allow you to change the primary keys
only non numeriic fields will updated
so get all the data of the corresponding record change
then use INsert command
regards
Shiva