Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Modify statement

Former Member
0 Likes
1,557

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,049

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

6 REPLIES 6
Read only

Former Member
0 Likes
1,049

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.

Read only

0 Likes
1,049

Hi,

Note: dont forget to declare work area wa_period for the above code.

Read only

0 Likes
1,049

Thanks Azaz,

I will try and would get back.

Shejal.

Read only

0 Likes
1,049

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.

Read only

Former Member
0 Likes
1,050

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

Read only

0 Likes
1,049

Thanks Friends,

Shejal.