‎2009 Aug 21 9:37 AM
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
‎2009 Aug 21 9:44 AM
try to use..
table lock before modifing the DB table.
ENQUEUE
DEQUEUE
‎2009 Aug 21 9:46 AM
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.
‎2009 Aug 21 9:49 AM
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.
‎2009 Aug 21 9:56 AM
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
‎2009 Aug 21 10:09 AM
Use WHERE condition with Modify Table statement .
This will surely resolve your issue.
‎2009 Aug 21 10:13 AM
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.
‎2009 Aug 21 10:35 AM
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
‎2009 Aug 21 10:59 AM
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.
‎2009 Aug 21 11:14 AM
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
‎2009 Aug 25 11:37 AM
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.'
‎2009 Aug 25 12:40 PM
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.
‎2010 Jan 08 5:25 AM