06-29-2007 9:13 AM
Hi,
I have part of code:
loop at l_eket_obj .
read table itab with key werks = l_eket_obj-werks
matnr = l_eket_obj-matnr.
if sy-subrc = 0.
itab-zamowione = l_eket_obj-objednane.
modify itab transporting zamowione where werks = l_eket_obj-werks and
matnr = l_eket_obj-matnr.
endif.
endloop.
sy-subrc returns value 4. What does it mean? How solve this problem?
Regards,
Joanna
06-29-2007 11:04 AM
Hi,
If sy-subrc eq 4 after read statement, that particular data is not in itab.Here important thing you can have sy-subrc values for most of the statements.So you should be careful while debuggin that whether you are getting the sy-subrc = 4 immediately after read.
Before using read statement, it is always a good progrmaming practice to clear the workarea.
clear itab.
06-29-2007 9:22 AM
see the below sample code .... here from work area to INTERNAL TABLE .
so you should have and other internal table or the work area to modify your table ... and ofcus the internal table should be Unique also .
PARAMETERS: p_carrid TYPE sflight-carrid,
p_connid TYPE sflight-connid,
p_plane1 TYPE sflight-planetype,
p_plane2 TYPE sflight-planetype.
DATA sflight_tab TYPE SORTED TABLE OF sflight
WITH UNIQUE KEY carrid connid fldate.
DATA sflight_wa TYPE sflight.
SELECT *
FROM sflight
INTO TABLE sflight_tab
WHERE carrid = p_carrid AND
connid = p_connid.
sflight_wa-planetype = p_plane2.
MODIFY sflight_tab FROM sflight_wa
TRANSPORTING planetype WHERE planetype = p_plane1.
reward points if it is usefull ....
Girish
06-29-2007 9:23 AM
Hi,
It means:
Row not found. If the entry was determined with a binary search, then sy-tabix is set to the table index of the entry before which it would have to be inserted with INSERT ... INDEX ..., if you want to keep the sorting order. This is the case if the addition table_key or free_key was specified for a beginning part of the table key of sorted tables, or if the addition BINARY SEARCH was specified explicitly. Otherwise, sy-tabix is undefined.
What you can do is
loop at l_eket_obj .
loop at itab where werks = l_eket_obj-werks and matnr = l_eket_obj-matnr.
itab-zamowione = l_eket_obj-objednane.
modify itab transporting zamowione
endloop.
Regards,
Sesh
.
06-29-2007 11:00 AM
Hi
sy-subrc = 4 means there is no record found.
If you think the record is there then jus make sure that in the read stmt
where you u have put with key ..the fields shud be in same order as it is in internal table. if the order differs the o/p will be 4. fst sort itab by werks matnr.
then use binary serch with ur stmt.
then it will definately work.
Thanks
AZAD.
reward if helpful
06-29-2007 11:04 AM
Hi,
If sy-subrc eq 4 after read statement, that particular data is not in itab.Here important thing you can have sy-subrc values for most of the statements.So you should be careful while debuggin that whether you are getting the sy-subrc = 4 immediately after read.
Before using read statement, it is always a good progrmaming practice to clear the workarea.
clear itab.
06-29-2007 12:38 PM