Application Development and Automation 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: 
Read only

update routine - date difference need to be calculated

Former Member
0 Likes
614

update routine - date difference need to be calculated

-


Hi,

I have a report for which I need to add 6 keyfigure fields.

I need abap code to add to my update routine

They are:

Early – ZEARLYDT

On Time – ZONTIME

Late – ZLATEDT

Early%

On Time%

Late%

The is what the scenario is:

If Completion Date (ZCOMP_DT) < Request Date (ZRQEND_DT) then,

Early = 1, OnTime = 0, Late = 0

If Completion Date (ZCOMP_DT) = Request Date (ZRQEND_DT) then,

Early = 0, On Time = 1, Late = 0

If Completion Date (ZCOMP_DT) > Request Date (ZRQEND_DT) then,

Early = 0, On Time = 0, Late = 1

If Early = 1, Early% = 100%

If Early = 0, Early% = 0%

If On Time = 1, On Time% = 100%

If On Time = 0, On Time% = 0%

If Late = 1, Late% = 100%

If Late = 0, late% = 0%

QMMA/JCDS – Source Table(s) for "Complete Date"

"PETER" – Source Field for "Complete Date"

QMEL – Source Table for "Request Date"

LTRMN – Source Field for "Request Date"

--

update routine - date difference need to be calculated

-


Hi,

I have a report for which I need to add 6 keyfigure fields.

I need abap code to add to my update routine

They are:

Early – ZEARLYDT

On Time – ZONTIME

Late – ZLATEDT

Early%

On Time%

Late%

The is what the scenario is:

If Completion Date (ZCOMP_DT) < Request Date (ZRQEND_DT) then,

Early = 1, OnTime = 0, Late = 0

If Completion Date (ZCOMP_DT) = Request Date (ZRQEND_DT) then,

Early = 0, On Time = 1, Late = 0

If Completion Date (ZCOMP_DT) > Request Date (ZRQEND_DT) then,

Early = 0, On Time = 0, Late = 1

If Early = 1, Early% = 100%

If Early = 0, Early% = 0%

If On Time = 1, On Time% = 100%

If On Time = 0, On Time% = 0%

If Late = 1, Late% = 100%

If Late = 0, late% = 0%

QMMA/JCDS – Source Table(s) for "Complete Date"

"PETER" – Source Field for "Complete Date"

QMEL – Source Table for "Request Date"

LTRMN – Source Field for "Request Date"

--

4 REPLIES 4
Read only

Former Member
0 Likes
582

Hi Deva,

you should first write the ABAP code and if you face some problem then we can suggest you the solution.

Regards,

Atish

Read only

0 Likes
582

Yes, I need Abap code for this scenario. Need help writing it

Read only

0 Likes
582

I have included the following update routine which is supposed to give me results for ZEARLYDT, ZONTIME and ZLATE as either 1 or 0.

But, I am receiving all kinds of numbers in there.

--

Are there any changes that I need to make to the below code?

  • For Scheduled orders if Completed dt is le Required end dt

  • then met req dt is 1

IF LT_DATA_PACKAGE-NOT_TYPE = 'Z3' OR LT_DATA_PACKAGE-NOT_TYPE = 'Z4'

OR LT_DATA_PACKAGE-NOT_TYPE = 'Z5' OR LT_DATA_PACKAGE-NOT_TYPE = 'Z6'

OR LT_DATA_PACKAGE-NOT_TYPE = 'Z7' OR LT_DATA_PACKAGE-NOT_TYPE = 'Z8'.

IF LT_DATA_PACKAGE-/BIC/ZCOMP_DT LE LT_DATA_PACKAGE-/BIC/ZRQEND_DT .

LT_DATA_PACKAGE-/BIC/ZMETREQDT = 1.

ENDIF.

IF LT_DATA_PACKAGE-/BIC/ZCOMP_DT LT LT_DATA_PACKAGE-/BIC/ZRQEND_DT.

LT_DATA_PACKAGE-/BIC/ZEARLYDT = 1.

ENDIF.

IF LT_DATA_PACKAGE-/BIC/ZCOMP_DT EQ LT_DATA_PACKAGE-/BIC/ZRQEND_DT.

LT_DATA_PACKAGE-/BIC/ZONTIME = 1.

ENDIF.

IF LT_DATA_PACKAGE-/BIC/ZCOMP_DT GT LT_DATA_PACKAGE-/BIC/ZRQEND_DT.

LT_DATA_PACKAGE-/BIC/ZLATEDT = 1.

ENDIF.

LT_DATA_PACKAGE-/BIC/ZDATDIFF = LT_DATA_PACKAGE-CALDAY -

LT_DATA_PACKAGE-/BIC/ZRQEND_DT.

ENDIf.

Read only

0 Likes
582

code is correct

problem solved