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 itab not working

Former Member
0 Likes
2,286

Hi ,

I am trying to change a field value in itab using MODIFY statement.

The field is a char type and holding '0000000' initially. Now I am trying to change this value to other value. But the modify statement is not working.

like the code is,

data : value(32) type c,

wa-value = value.

wa-name = 'test'.

modify itab from wa transporting value name where id = '01'.

the Name field is getting updated properly with the new value, but the value field is not getting updated... this i sstill showing '0000000'.

Can any body help me on this.

Thanks,

Krishna

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,908

Well at least from your example, you are just declaring a variable called 'Value' and assigning it to the work area without assigning it any value. Are you sure this is not you are doing in your actual code?

Vikranth

9 REPLIES 9
Read only

Former Member
0 Likes
1,909

Well at least from your example, you are just declaring a variable called 'Value' and assigning it to the work area without assigning it any value. Are you sure this is not you are doing in your actual code?

Vikranth

Read only

Former Member
0 Likes
1,908

I am assigning the value to the field VALUE. still this is not updating the new value.

Read only

0 Likes
1,908

Can you show the relevant part of your actual coding? Also did you check the sy-subrc value after the modify statement?

Vikranth

Read only

Former Member
0 Likes
1,908

Hi..

Did you check by passing any hard coded value to the wa-value? May be the field 'value' was populated with the same '0000000' as it was before.

also try some manipulations while debugging.

Karthik

Read only

Former Member
0 Likes
1,908

data : ls_partner TYPE bbp_pds_partner.

data : et_partner type table of bbp_pds_partner.

SELECT SINGLE partner_guid FROM but000 INTO lv_guid WHERE partner = l_partner.

ls_partner-partner_id = l_partner.

ls_partner-partner_no = lv_guid.

MODIFY et_partner FROM ls_partner TRANSPORTING partner_no partner_id

WHERE p_guid EQ ls_item-guid

AND partner_fct EQ c_partner_fct1

AND del_ind EQ space.

Intially the field partner_no field have '0000000' value now I am changing it to '1111111'. for the same statment the field partner_id is getting updated properly.

Thanks

Krishna

Read only

0 Likes
1,908

Hi..

Just check this link once under the heading : Changing Several Lines Using a Condition. It says "Furthermore, you can only modify the key fields of the internal table if it is a standard table."

http://help.sap.com/saphelp_46c/helpdata/en/fc/eb35eb358411d1829f0000e829fbfe/content.htm

Karthik

Read only

Former Member
0 Likes
1,908

Hi,

1. Check for sy-subrc after the select. Whether data is flowing to lv_guid.

2. Check for the field datatype for ls_partner-partner_no and lv_guid. They should match. If not, you would have to use conversion exit to match the ls_partner-partner_no.

Hope it helps

Sujay

Read only

Former Member
0 Likes
1,908

TYPES : BEGIN OF y_trial,

value(32) TYPE c,

name(15) TYPE c,

END OF y_trial.

DATA : t_trial TYPE STANDARD TABLE OF y_trial,

w_trial TYPE y_trial.

FIELD-SYMBOLS : <fs_trial> TYPE y_trial.

CLEAR w_trial.

MOVE '01' TO w_trial-value.

MOVE 'ABC' TO w_trial-name.

APPEND w_trial TO t_trial.

CLEAR w_trial.

MOVE '02' TO w_trial-value.

MOVE 'XYZ' TO w_trial-name.

APPEND w_trial TO t_trial.

CLEAR w_trial.

MOVE '03' TO w_trial-value.

MOVE 'PQR' TO w_trial-name.

APPEND w_trial TO t_trial.

CLEAR w_trial.

MOVE '02' TO w_trial-value.

MOVE 'LMN' TO w_trial-name.

MODIFY t_trial FROM w_trial TRANSPORTING name WHERE value = '02'.

UNASSIGN : <fs_trial>.

LOOP AT t_trial ASSIGNING <fs_trial>.

WRITE 😕 <fs_trial>-value, <fs_trial>-name.

ENDLOOP.

Output is : 01 ABC

02 LMN

03 PQR

It has modifed the second row and the value has changed from "XYZ" to "LMN".

Regards,

Shekhar

Read only

0 Likes
1,908

Hi,

Check the datatype of both the variables only if they are the same the modification would take place.

Thanks & Regards,

Neela