2009 Mar 02 6:18 AM
Hi All ,
i am updating databese uisng update statment it is updating database table ,
after that i want to find how many records are updated i am using folloing coding but it is not working
very well
UPDATE lips SET brgew = itab-ausp1
WHERE vbeln = itab-vbeln AND
posnr = itab-posnr.
IF sy-subrc = 0.
itab-brgew = itab-ausp1.
MODIFY itab INDEX idx TRANSPORTING brgew.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
can anybody tell me how to do these
Thanks in advance
2009 Mar 02 6:34 AM
Hi,
The statement UPDATE sets sy-dbcnt to the number of changed lines.
Just needed to do a F1 on UPDATE......
2009 Mar 02 6:20 AM
Hi Paresh,
Never update standard tables with MODIFY,UPDATE or INSERT.
try to use the BDC, BAPIS or FM's.
Regards,
Phani.
2009 Mar 02 6:34 AM
Hi,
The statement UPDATE sets sy-dbcnt to the number of changed lines.
Just needed to do a F1 on UPDATE......
2009 Mar 02 6:38 AM
Hi,
Use Sy-dbcnt
check the code below:
Data: count type i.
UPDATE lips SET brgew = itab-ausp1
WHERE vbeln = itab-vbeln AND
posnr = itab-posnr.
IF sy-subrc = 0.
itab-brgew = itab-ausp1.
MODIFY itab INDEX idx TRANSPORTING brgew.
*count = sy-dbcnt.*
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
write:/ count.
thanks|
Mahesh
2009 Mar 02 6:43 AM
Hi
Good
The code you have mentioned below is to update the database table but no where you have mentioned the process you are following to know the number of record that has been updated through MODIFY statement.
If you want to see the records and you can use the select statement to select the brgew field, it will tell you the detail field updated using the modify method.
Thanks
nmrutyun^
2009 Mar 02 6:47 AM
If itu2019s not too late, I mean if your changes were not moved into PRD than stop your Work and post your requirement why you are tempting to Update DB manually?!?
2009 Mar 02 6:51 AM
Hi Paresh,
Its better to use a BDC insteat of UPDATE. Please refer the code given below:
send the data to be updated in BDC table & capture the meesage in message table as show below: then loop this message table to find which record have been updated & which are not updated.
* BDC table of call transaction
data:
t_bdcdata type
standard table
of bdcdata,
fs_bdcdata type bdcdata. " Work area for bdcdata
* Messages of call transaction
data:
t_messtab type
standard table
of bdcmsgcoll,
fs_messtab type bdcmsgcoll. " Work area for messtab
call transaction 'PA30' using t_bdcdata
mode 'A'
messages into t_messtab.
loop at t_messtab into fs_messtab.
call function 'FORMAT_MESSAGE'
exporting
id = fs_messtab-msgid
lang = sy-langu
no = fs_messtab-msgnr
v1 = fs_messtab-msgv1
v2 = fs_messtab-msgv2
v3 = fs_messtab-msgv3
v4 = fs_messtab-msgv4
importing
msg = lw_string
exceptions
not_found = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. " IF sy-subrc <> 0
endloop. " LOOP AT t_messtab into...
With luck,
Pritam.
2009 Mar 02 7:46 AM
thanks i got the answer
i used sy-dbcnt to find no of records updated