ā2014 Mar 24 5:07 AM
hi all,
Please advice how to update database table with certain cndition needs to be checked.
Please consider below scenario.
have used enqueu and dequeue function to lock entries and also i have used BAPI so considering that return parameter . i want to update table
/tdk/st0027.
1. I want to update database table
2. there are certain condition needs to be checked like ,
loop at it_final into wa_final.
th_return-type = 'S'.
*********************************************************************
if th_final-vbeln = /tdk/st0027-vbeln and
th_final-posnr = /tdk/st0027-posnr and
th_final-etenr = /tdk/st0027-sdslno.
above condition which i need to check .and need to append below system fields need to be appended in table.
th_final-prstsind = '20'.
th_final-chgdate = g_date.
th_final-chgtime = g_uzeit.
th_final-chgprog = g_cprog.
th_final-chguser = g_uname.
append th_final to td_final.
update /tdk/st0027 FROM th_final.
endif.
endloop.
but i am getting error saying that "The type od database table and work area (TH_FINAL) are not unicode convertible"?
I am not able to understandwhat would be the solution for this ?
Thanks and regards,
Prasad K. NAralkar
ā2014 Mar 24 5:12 AM
Hi,
The work area is not type compatible with the DB.
Check how you have declared the work area TH_FINAL.
It should be DATA: work area TYPE database table.
Regards
Sree
ā2014 Mar 24 5:54 AM
yes have declared the same .but still its not allowing me to write modify or update query ?
ā2014 Mar 24 6:03 AM
Prasad
Can you please paste declaration of TH_FINAL and TD_FINAL
ā2014 Mar 24 6:53 AM
please find above details as i am restrict to copy paste the perticular code .
ā2014 Mar 24 6:54 AM
ā2014 Mar 24 6:56 AM
Prasad
Please compare structure of typ_final with database table /tdk/st00027. These both are different. Please create a local internal table of same type as database table. append data into that table and update
Nabheet
ā2014 Mar 24 9:28 AM
Hi but i want to update only some of fields of them .. have declared another structure with same fields still i am getting same error. ??
ā2014 Mar 24 6:30 AM
hi,
plz check the data type of your inter table th_final.
your table type must be same .
ā2014 Mar 24 7:09 AM
i think the structure of both table is not same. first declare a local internal table as same as structure of that db table. then move corresponding value of th_final to that local internal table. then, update it.
ā2014 Mar 24 7:54 AM
The error occurs in the UPDATE statement included in the code. In this statement it is seen that there is a mismatch of structure defined for the DDIC table /tdk/st0027 and that of your work area th_final.
try to create a structure w.r.t the DDIC table.
Eg: DATA: wa_temp TYPE /tdk/st0027.
MOVE-CORRESPONDING th_final TO wa_temp.
Then try to UPDATE using the temporary work area i.e wa_temp which has structure similar to that of the database table.
ā2014 Mar 24 12:58 PM