‎2006 Jul 16 6:04 AM
HI friends,
I want to modify the data base table and need to modify only one field by checking another field in the same database table. However i need to modify through an internal table and my internal table has many fields.
Here is the code that i am using.
DATA : BEGIN OF t_period OCCURS 0,
bdatj TYPE bdatj,
bumon TYPE bumon,
butag TYPE butag,
poper TYPE poper,
END OF t_period.
t_period is the internal table.
UPDATE tvarvc-tvarv_val values t_period-poper
WHERE tvarvc-rvari_vnam = 'SAP_SCMA_PERIOD'.
here TVARVC is my database table
Thanks ,
Shejal.
‎2006 Jul 16 7:02 AM
Hi Shejal,
The update statement will be like
UPDATE tvarvc
SET tvarv_val = t_period-poper
WHERE rvari_vnam = 'SAP_SCMA_PERIOD'.
What i feel is, here the database table where condition is rvari_vnam = 'SAP_SCMA_PERIOD' , since internal table doesnt contain this field name, instead of using the internal table you can use data field then the update statement will be like
UPDATE tvarvc
SET tvarv_val = variable name
WHERE rvari_vnam = 'SAP_SCMA_PERIOD'.
Regards
Arun
‎2006 Jul 16 6:30 AM
Hi shejal,
loop at t_period into wa_period where rvari_vnam = 'SAP_SCMA_PERIOD'.
t_period-poper = tvarvc-tvarv_val .
modify t_period from wa_period.
endloop.
Regards,
Azaz Ali.
‎2006 Jul 16 6:31 AM
Hi,
Note: dont forget to declare work area wa_period for the above code.
‎2006 Jul 16 6:36 AM
‎2006 Jul 16 7:32 AM
Hi Shejal,
FYI..
The following statement in the above code,
<b>t_period-poper = tvarvc-tvarv_val .</b>
<b>tvarvc-tvarv_val</b> means the value which you want to pass to field <b>poper</b> declared in internal table t_period depending on your requirement.
Regards,
Azaz Ali.
‎2006 Jul 16 7:02 AM
Hi Shejal,
The update statement will be like
UPDATE tvarvc
SET tvarv_val = t_period-poper
WHERE rvari_vnam = 'SAP_SCMA_PERIOD'.
What i feel is, here the database table where condition is rvari_vnam = 'SAP_SCMA_PERIOD' , since internal table doesnt contain this field name, instead of using the internal table you can use data field then the update statement will be like
UPDATE tvarvc
SET tvarv_val = variable name
WHERE rvari_vnam = 'SAP_SCMA_PERIOD'.
Regards
Arun
‎2006 Jul 16 7:44 AM