‎2006 Aug 29 7:29 AM
Hello experts,
I was wondering why does my loop statement with a where clause does not get any records.
I am sure there is an existing record in my itab since I checked it. Anyway, below is my
code guys.
LOOP AT it_finaltab ASSIGNING <fs_finaltab>.
IF <fs_finaltab>-asset_dum IS INITIAL AND
<fs_finaltab>-parent IS INITIAL.
CLEAR wa_output.
MOVE-CORRESPONDING <fs_finaltab> TO wa_output.
APPEND wa_output TO it_output.
ELSEIF NOT <fs_finaltab>-asset_dum IS INITIAL
AND <fs_finaltab>-parent IS INITIAL.
READ TABLE it_output2 WITH KEY funcloc = <fs_finaltab>-funcloc
asset_dum = <fs_finaltab>-asset_dum
asset = <fs_finaltab>-asset
parent = <fs_finaltab>-parent
INTO wa_output2.
IF sy-subrc <> 0.
CLEAR wa_output2.
MOVE-CORRESPONDING <fs_finaltab> TO wa_output2.
APPEND wa_output2 TO it_output2.
LOOP AT it_finaltab ASSIGNING <wa_finaltab> -
> does not get any records
WHERE parent = <fs_finaltab>-asset.
IF sy-subrc = 0.
MOVE-CORRESPONDING <wa_finaltab> TO wa_output2.
APPEND wa_output2 TO it_output2.
ENDIF.
ENDLOOP.
CLEAR wa_output2.
ELSE.
CONTINUE.
ENDIF.
ELSEIF NOT <fs_finaltab>-asset_dum IS INITIAL
AND NOT <fs_finaltab>-parent IS INITIAL.
READ TABLE it_finaltab WITH KEY asset = <fs_finaltab>-parent
ASSIGNING <wa_finaltab>.
IF sy-subrc = 0.
READ TABLE it_output2 WITH KEY funcloc = <fs_finaltab>-funcloc
asset_dum = <fs_finaltab>-asset_dum
asset = <fs_finaltab>-asset
parent = <fs_finaltab>-parent
INTO wa_output2.
IF sy-subrc <> 0.
MOVE-CORRESPONDING <wa_finaltab> TO wa_output2.
APPEND wa_output2 TO it_output2.
LOOP AT it_finaltab ASSIGNING <wa_finaltab> -
> does not get any records
WHERE parent = wa_output2-asset.
IF sy-subrc = 0.
MOVE-CORRESPONDING <wa_finaltab> TO wa_output3.
APPEND wa_output3 TO it_output2.
ENDIF.
ENDLOOP.
ENDIF.
ELSE.
CONTINUE.
ENDIF.
ENDIF.
ENDLOOP.
I checked my itab during debugging and I am sure there is a record where its parent field has the same value as
of the <fs_finaltab>-asset and wa_output2-asset. Help would be greatly appreciated. Thanks a lot guys and take care!
‎2006 Aug 29 8:41 AM
As far as I remember asset number has ALPHA conversion exit, that is internally it is stored with leading zeroes. Check if both fields <b>asset</b> and <b>parent</b> has the same internal represenatation.
Also statement
IF sy-subrc = 0.inside your second LOOP WHERE is absolutely redundant.
‎2006 Aug 29 8:41 AM
As far as I remember asset number has ALPHA conversion exit, that is internally it is stored with leading zeroes. Check if both fields <b>asset</b> and <b>parent</b> has the same internal represenatation.
Also statement
IF sy-subrc = 0.inside your second LOOP WHERE is absolutely redundant.