Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Schedule Delivery

Former Member
0 Kudos

Hi,

DATA: SCHED_QUAN LIKE CETT-MENGE,

FIFTEEN_DAYS LIKE SY-DATUM.

FIFTEEN_DAYS = SY-DATUM + 15.

SCHED_QUAN = 0.

SORT CETT BY EBELP EINDT.

LOOP AT CETT.

IF CETT-EINDT GT FIFTEEN_DAYS.

EXIT.

ELSE.

SCHED_QUAN = CETT-MENGE + SCHED_QUAN.

ENDIF.

ENDLOOP.

F1 = SCHED_QUAN.

F2 = F1.

This code calculates the quantity(MENGE) of the individual items (EBELP) in the Purchase order to the delivered from the first record till 15 days from current date... However I am facing problems in the displaying the results... as it is returning the same quantity (last EBELP one) to all Items... How can i fix this one...

3 REPLIES 3

Former Member
0 Kudos

Hi!



DATA: SCHED_QUAN LIKE CETT-MENGE,
FIFTEEN_DAYS LIKE SY-DATUM.

FIFTEEN_DAYS = SY-DATUM + 15.
SCHED_QUAN = 0.

SORT CETT BY EBELP EINDT.

LOOP AT CETT.
  IF CETT-EINDT GT FIFTEEN_DAYS.
    CONTINUE.   "EXIT.   <<< to skip only the actual step
  ELSE.
    SCHED_QUAN = CETT-MENGE + SCHED_QUAN.
  ENDIF.
ENDLOOP.

F1 = SCHED_QUAN.
F2 = F1.

Your version is working only if you are sorting by EINDT and then EBELP.

Regards

Tamá

0 Kudos

You have removed the EXIT and replaced it with continue... Why????

Also what's the reason that its working only when sorted by EINDT and by EBELP.

0 Kudos

Yes, but you wrote it in wrong order in your program. You can let the EXIT, if you write the EINDT first and EBELP second.

SORT CETT BY EINDT EBELP.

Or else you have to change EXIT to CONTINUE.

This is because if you sort your internal table first by EBELP, this field might cause wrong order in the dates. And in worst case if the lowest EBELP document has EINDT higher than 15 days, the processing will terminate immediately. Anyways wrong order will cause unstable working in your program.

Regards

Tamá