2008 Jun 20 12:51 PM
hi,
may i know why the read can map a record but why sy-subrc returns 4?
loop at int_tab.
if int_tab-blart <> 'DZ'.
read table int_t2 with key kunnr = int_tab-kunnr
gjahr = int_tab-gjahr.
if sy-subrc = 0.
move.....
endif.
endif.
endloop.
thanks
hi,
may i know why the read can map a record but why sy-subrc returns 4?
loop at int_tab.
if int_tab-blart <> 'DZ'.
read table int_t2 with key kunnr = int_tab-kunnr
gjahr = int_tab-gjahr.
if sy-subrc = 0.
move.....
endif.
endif.
endloop.
thanks
2008 Jun 20 1:01 PM
Hi,
In debugging check the int_tab values for int_tab-kunnr
int_tab-gjahr.
Regards
Adil
2008 Jun 20 1:03 PM
Hi,
In your code the sy-subrc checks for the assignment of gjahr as the sy-subrc value is placed after the assignment statement and hence inspite of read statement finding a record sy-subrc may return 4.
<REMOVED BY MODERATOR>
Regards.
Edited by: Alvaro Tejada Galindo on Jun 20, 2008 9:22 AM
2008 Jun 20 1:05 PM
hi,
i checked already and the read table parameter with value assigned but yet return 4.
why?
thanks
2008 Jun 20 1:07 PM
Hi,
Write gjahr = int_tab-gjahr after the if condition. The if condition should be after the read statement.
Thanks
Nayan
2008 Jun 20 1:09 PM
Are you sure it returns sy-subrc 4 inspite it reads a record.
Check once again, Clear your work area before the read statement. Check if it is getting filled after READ statement. It might be a case where the workarea already has some data and read actually fails.
Regards,
Lakshmi.
2008 Jun 20 1:06 PM
Before the
read table int_t2 with key kunnr = int_tab-kunnr
gjahr = int_tab-gjahr.
you are not clearing the header line
=> the first time your if condition is correct you happen to find an entry with your read statement, later on when the if is true again you don't happen to find anything but the header line of int_t2 is still filled with the previous value
So before doing the read, just add a
clear int_t2.
That should solve your problem.
Regards,
Michael
2008 Jun 20 1:08 PM
hiiii
if your sy-subrc NE 0 that means defenetly its not getting values as per your condition.if its so then it will not move values also.check for that.
<REMOVED BY MODERATOR>
thx
twinkal
Edited by: Alvaro Tejada Galindo on Jun 20, 2008 9:22 AM
2008 Jun 20 1:08 PM
Hi,
in the following code :
loop at int_tab.
if int_tab-blart eq 'DZ'.
read table int_t2 with key kunnr = int_tab-kunnr
gjahr = int_tab-gjahr.
if sy-subrc = 0.
move.....
endif.
endif.
endloop.
Try doing a clear int_t2 and then see.
As per my opinion the value placed in int_t2 is the previous record's one. The new record does not matches the criteria and hence sy-subrc = 4. But if a data is not found then the previous record's value is not cleared off..
Try using Clear statement and it should confirm ...
Hope it helps.
Regards,
Himanshu
2008 Jun 20 1:20 PM
Hi,
if possible paste ur code here, so we can check why sy-subrc is not equal to 0.
Regards
Adil
2008 Jun 20 1:37 PM
hi,
this is the code. why sy-subrc returns 4?
loop at hbsid where umskz = 'A' and blart <> 'DZ' and
rebzg <> space.
v_tabix = sy-tabix.
read table hbsid_ind with key rebzg = hbsid-belnr
kunnr = hbsid-kunnr
gjahr = hbsid-gjahr.
if sy-subrc = 0.
move hbsid_ind-budat to hbsid-budat.
move hbsid_ind-bldat to hbsid-bldat.
modify hbsid index v_tabix transporting budat bldat.
endif.
endloop.
thanks
2008 Jun 20 1:54 PM
Hi,
read table hbsid_ind with key rebzg = hbsid-belnr
kunnr = hbsid-kunnr
gjahr = hbsid-gjahr.
after this read statement, sy-subrc is not equal to 0,
hbsid-belnr
hbsid-kunnr
hbsid-gjahr
this three fields your getting from another internal table, check whether your getting the values for this three fields or not in debugging.
if possible paste full code.
Regards
Adil
2008 Jun 20 1:58 PM
hi,
these 3 fields
hbsid-belnr
hbsid-kunnr
hbsid-gjahr
having value during debug and also hbsid_ind has the same record which can match.
i post after the debug and testing. if due to no value, i will not ask here.
thanks
2008 Jun 20 2:18 PM
Hi
Something is wrong in your code, if SY-SUBRC is equal to 4 it means the matching is fails and so:
- or there isn't the record you're searching
- or the keys used for reading are wrong
- or the way you're using to read the table is wrong
read table hbsid_ind with key rebzg = hbsid-belnr
kunnr = hbsid-kunnr
gjahr = hbsid-gjahr.So now are u sure the code above is right? If you're looking for the document linked to the current document, it can be the documents belong to different fyscal years, I think the correct code should be:
read table hbsid_ind with key KUNNR = hbsid-kunnr
REBZG = hbsid-belnr
REBZJ = hbsid-gjahr.Max
2008 Jun 20 2:09 PM
Hi ,
Try by adding BINARY SEARCH in your read statement .
"Read table hbsid_ind with key rebzg = hbsid-belnr
kunnr = hbsid-kunnr
gjahr = hbsid-gjahr Binary search. "
2008 Jun 20 2:17 PM
Hi,
If iam not wrong your trying some thing like this
DATA:
i_sbook TYPE TABLE OF sbook,
w_sbook LIKE LINE OF i_sbook.
DATA:
i_sflight TYPE TABLE OF sflight,
w_sflight LIKE LINE OF i_sflight.
SELECT carrid connid
FROM sbook
INTO CORRESPONDING FIELDS OF TABLE i_sbook.
SELECT carrid connid fldate seatsmax seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE i_sflight.
LOOP AT i_sbook INTO w_sbook.
SORT i_sflight BY carrid connid.
READ TABLE i_sflight INTO w_sflight WITH KEY
carrid = w_sbook-carrid
connid = w_sbook-connid.
IF sy-subrc EQ 0.
*move.......
ENDIF.
ENDLOOP.if so run this code and check sy-subrc value.
Regards
Adil
2008 Jun 20 2:46 PM
2008 Jun 20 2:47 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |