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

Former Member
0 Likes
1,927

Hi all,

I am facing a problem.

Below is the code. In this, After Modify statement I am getting sy-subrc eq 4 also not updating table t_po_item_add_data



TYPES: tt_bapiekpoa  TYPE TABLE OF bapiekpoa.

DATA: wa_po_item_add_data LIKE LINE OF t_po_item_add_data,
           t_po_item_add_data           TYPE tt_bapiekpoa.

  IF S_PO_HEADER-PUR_GROUP = '284'.
    wa_po_item_add_data-GR_NON_VAL = 'X'.
    Modify Table t_po_item_add_data from wa_po_item_add_data
             Transporting GR_NON_VAL.
  ENDIF.

Please help.

Sachin

12 REPLIES 12
Read only

RahulKeshav
Active Contributor
0 Likes
1,369

try to use..

table lock before modifing the DB table.

ENQUEUE

DEQUEUE

Read only

Former Member
0 Likes
1,369

Hello


read table t_po_item_add_data into wa_po_item_add_data with key " <= set condition here
  IF S_PO_HEADER-PUR_GROUP = '284'.
    wa_po_item_add_data-GR_NON_VAL = 'X'.
    Modify t_po_item_add_data from wa_po_item_add_data Transporting GR_NON_VAL.
  ENDIF.

Read only

Former Member
0 Likes
1,369

Hi,

Try this



read table t_po_item_add_data into wa_po_item_add_data where field = some value.
IF S_PO_HEADER-PUR_GROUP = '284'.
    wa_po_item_add_data-GR_NON_VAL = 'X'.
    Modify Table t_po_item_add_data from wa_po_item_add_data
             Transporting GR_NON_VAL.
  ENDIF.

Read only

Former Member
0 Likes
1,369

Hi,

Modify Table t_po_item_add_data from wa_po_item_add_data

Transporting GR_NON_VAL.

remove that TABLE

Modify t_po_item_add_data from wa_po_item_add_data

Transporting GR_NON_VAL.

Edited by: Selva M on Aug 21, 2009 2:29 PM

Read only

Former Member
0 Likes
1,369

Use WHERE condition with Modify Table statement .

This will surely resolve your issue.

Read only

Former Member
0 Likes
1,369

The correct syntax is

Modify itab from ..............

so remove table statement from ur code

TYPES: tt_bapiekpoa TYPE TABLE OF bapiekpoa.

DATA: wa_po_item_add_data LIKE LINE OF t_po_item_add_data,

t_po_item_add_data TYPE tt_bapiekpoa.

IF S_PO_HEADER-PUR_GROUP = '284'.

wa_po_item_add_data-GR_NON_VAL = 'X'.

Modify Table t_po_item_add_data from wa_po_item_add_data "Remove table

Transporting GR_NON_VAL.

Modify t_po_item_add_data from wa_po_item_add_data "Correct statement

Transporting GR_NON_VAL.

ENDIF.

Hope this will solve ur problem.

Read only

0 Likes
1,369

hi,

for an internal table you can just use modify itab

its better if you just put F1 on modify. read the documentation and diff between modify itab and modify table

Read only

Former Member
0 Likes
1,369

Hi Sachin,

Modify Table t_po_item_add_data from wa_po_item_add_data

Transporting GR_NON_VAL.

The system searches the internal table for the line whose table key corresponds to the key fields in <wa>.

as thr is no keyfield for the structure BAPIEKPOA the statement is unable to find a line to modify...

use index or where condition to modify the line..

if only an entry in the table is found satisfying the 'where' condition , the table gets modified.

Modify t_po_item_add_data from wa_po_item_add_data

Transporting GR_NON_VAL

where GR_NON_VAL = ' '.

Regards.

Read only

former_member189420
Active Participant
0 Likes
1,369

Hello,

Instead of using MODIFY statement. You can go for using field symbols.

Read the particular record from the internal table assigning it to a field-symbol. Then make changed to the field-symbol, which automatically changes the particular record in the internal table. This is good way of modifying the internal table. Let me know if you want the code.

Hope this helps.

Regards,

Anand Patil

Read only

Former Member
0 Likes
1,369

hi

check F1 for modify

'If the change would lead to a double entry in a unique secondary index, then it is not executed and sy-subrc is set to 4.'

Read only

Former Member
0 Likes
1,369

Sachin,

Hope your table t_po_item_add_data is not empty! As that will also return sy-subrc = 4. check it once.

Thanks,

Augustin.

Read only

Former Member
0 Likes
1,369

.