Skip to Content
0
Former Member
Jul 27, 2005 at 07:08 PM

displaying negative nos.

17 Views

Hi,

I am working on an ALV program which should show the no. of days as negative...if the due date is past the current date.

For instance if the due date is 07/26/2005, it should show 1-.

I have declared the data as:

no_of_days_1 type I.

no_of_days_1_d(10) type C.

In my code:

disc_d_date: gets calculated at run time.

no_of_days_1 = sy-datum - disc_d_date.

if no_of_days_1 < 0 .

concatenate

no_of_days_1_d '-' into

no_of_days_1_d.

condense no_of_days_1_d NO-GAPS.

shift no_of_days_1_d RIGHT

DELETING TRAILING space.

else.

no_of_days_1_d = no_of_days_1.

endif.

The problem it appears, no_of_days_1_d being declared as I(integer), cannot store negative nos. A possible solution would be to create a data element with the sign checkbox ticked.

Would appreciate if anybody has a better solution.

Rajib