08-08-2007 10:43 AM
HI Experts,
in my program, i dont know why its not getting inside the loop. below is my code. I have seen in the debugger mode that as the arror comes on Loop statement, after that it directly goes to next select statement. why it is not going inside the Loop. is there any thing missing in my code. plz help .its urgent.
IF SY-SUBRC = 0.
SORT IT_TRFRATE BY MATNR_TR.
LOOP AT IT_TRFRATE.
IF IT_EKKO-MATNR_LI = IT_TRFRATE-MATNR_TR AND N = 1.
IT_EKKO-TRFRATE = IT_TRFRATE-TRFRATE.
N = N + 1.
ENDIF.
ENDLOOP.
SELECT BEDAT RESWK INTO (IT_EKKO-BEDAT, IT_EKKO-RESWK)
FROM EKKO
WHERE EKKO~EBELN = IT_EKKO-EBELN.
ENDSELECT.
ELSE.
******************************************************************************************
Thanks.
Khan.
08-08-2007 10:45 AM
Hi,
As control is not going inside loop..endloop , there must be no data in the Internal table.
Regards,
Sankar
08-08-2007 10:45 AM
Hi,
As control is not going inside loop..endloop , there must be no data in the Internal table.
Regards,
Sankar
08-08-2007 11:02 AM
thanks alot for the help. now the control is going inside as I filled the IT_trfrate.
NOw I need to transfer the respective rates to it_ekko. it_trfrate table has MATNR AND TRFRATE fields. what ever material currently in it_ekko-matnr_li, I want to searche the whole table it_trfrate for that MATNR.
*************************************************************************************
WHAT DO i MAKE CHANGE IN MY CODE.
LOOP AT IT_TRFRATE.
IF IT_EKKO-MATNR_LI in IT_TRFRATE AND N = 1.
IT_EKKO-TRFRATE = IT_TRFRATE-TRFRATE.
N = N + 1.
ENDIF.
ENDLOOP.
**************************************************************************************
THANKS.
kHAN
08-08-2007 10:46 AM
Hi
Write like this and see
IF SY-SUBRC = 0.
SORT IT_TRFRATE BY MATNR_TR.
LOOP AT IT_TRFRATE.
<b>IF ( ( IT_EKKO-MATNR_LI = IT_TRFRATE-MATNR_TR ) AND N = 1 ).</b>
IT_EKKO-TRFRATE = IT_TRFRATE-TRFRATE.
N = N + 1.
ENDIF.
ENDLOOP.
SELECT BEDAT RESWK INTO (IT_EKKO-BEDAT, IT_EKKO-RESWK)
FROM EKKO
WHERE EKKO~EBELN = IT_EKKO-EBELN.
ENDSELECT.
<b>Reward points for useful Answers</b>
Regards
Anji
08-08-2007 10:46 AM
08-08-2007 10:47 AM
HI,
if the internal table IT_TRFRATE is empty it will not go inside the loop.
first check whether data is there in that are not.
rgds,
bharat.
08-08-2007 10:47 AM
possibilities:
1. check sort statement.
2. check no of entries in internal table.
still not solved revert me back
Sameer
08-08-2007 10:48 AM
hi
if sy-subrc =0 ur putting if the above query fails then how this loop will execute
so try to find what exactly problem with the above statement
reward if usefull
08-08-2007 10:50 AM
Hi,
as the control is not going inside the loop ,u need to check the internal table(IT_TRFRATE) has some values or not..plz check the initiality before loop .Also correct the statement after loop..
IF ( ( IT_EKKO-MATNR_LI = IT_TRFRATE-MATNR_TR ) AND N = 1 ).
Regards,
Nagaraj