on 02-26-2014 7:42 AM
Hello experts
I wrote an endroutine which lookups a field from a standard DSO: ZWWSIC.
For the WHERE condition it checks if ZPR_FROM and ZPR_TO are equal to the result field.
This works fine.
But unfortunately ZPR_FROM and ZPR_TO sometimes is an intervall consisting of more than 2 values.
How can I implement an intervall logic comparison in the code below.
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
LOOP AT ITAB INTO WA
WHERE /BIC/ZPR_FROM = <RESULT_FIELDS>-/BIC/ZWWPRD
OR /BIC/ZWWPR_TO = <RESULT_FIELDS>-/BIC/ZWWPRD.
<RESULT_FIELDS>-/BIC/ZWWSIC = WA-/BIC/ZWWSIC.
<RESULT_FIELDS>-/BIC/ZZBRARW1 = <RESULT_FIELDS>-/BIC/ZZBRARW1.
<RESULT_FIELDS>-/BIC/ZZBRARW = <RESULT_FIELDS>-/BIC/ZZBRARW.
<RESULT_FIELDS>-/BIC/ZZBRA1 = <RESULT_FIELDS>-/BIC/ZZBRA1.
<RESULT_FIELDS>-/BIC/ZZBRA = <RESULT_FIELDS>-/BIC/ZZBRA.
<RESULT_FIELDS>-/BIC/ZWWPRD = <RESULT_FIELDS>-/BIC/ZWWPRD.
<RESULT_FIELDS>-RECORD = ICOUNT.
ICOUNT = ICOUNT + 1.
APPEND <RESULT_FIELDS> TO ITAB_TARGET.
ENDLOOP.
ENDLOOP.
Hi Thomas
I would try it like this:
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
LOOP AT ITAB INTO WA.
IF /BIC/ZPR_FROM <= <RESULT_FIELDS>-/BIC/ZWWPRD
AND /BIC/ZWWPR_TO >= <RESULT_FIELDS>-/BIC/ZWWPRD.
<RESULT_FIELDS>-/BIC/ZWWSIC = WA-/BIC/ZWWSIC.
<RESULT_FIELDS>-/BIC/ZZBRARW1 = <RESULT_FIELDS>-/BIC/ZZBRARW1.
<RESULT_FIELDS>-/BIC/ZZBRARW = <RESULT_FIELDS>-/BIC/ZZBRARW.
<RESULT_FIELDS>-/BIC/ZZBRA1 = <RESULT_FIELDS>-/BIC/ZZBRA1.
<RESULT_FIELDS>-/BIC/ZZBRA = <RESULT_FIELDS>-/BIC/ZZBRA.
<RESULT_FIELDS>-/BIC/ZWWPRD = <RESULT_FIELDS>-/BIC/ZWWPRD.
<RESULT_FIELDS>-RECORD = ICOUNT.
ICOUNT = ICOUNT + 1.
APPEND <RESULT_FIELDS> TO ITAB_TARGET.
ENDIF
.
ENDLOOP.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
Whether the interval is between from and to or you mean to say there interval in from and to separately.
If interval is between from and to then you could use the code given by Tom Thielen but one issue is that it will decrease the loading performance since wa will hold all the data.
Also if you don't want the same date to be repeated, sort and delete the adjacent duplicate with comparison.
Regards,
Sakthi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you please explain the record set with example like what value you are fetching and what value you have in source.
Regards,
AL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.