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: 

while selecting least date, have to exclude bland fields

Former Member
0 Kudos

I could select least date among 5 date fields...

Problem is 1 or 2 fields are not having data...so the result is coming as blank... I have to find the least among available dates...

My present code is like this:

FORM LEAST_DAT_CALC .

DATE7 = I_PA9030-ZDT_TMPSERV.

IF DATE7 > I_PA9030-ZDT_TRG.

DATE7 = I_PA9030-ZDT_TRG.

ENDIF.

IF DATE7 > I_PA9030-ZDT_WRKCHG.

DATE7 = I_PA9030-ZDT_WRKCHG.

ENDIF.

IF DATE7 > I_PA9030-ZDT_TSKFRC.

DATE7 = I_PA9030-ZDT_TSKFRC.

ENDIF.

IF DATE7 > I_PA9030-ZDT_PERSERV.

DATE7 = I_PA9030-ZDT_PERSERV.

ENDIF.

ENDFORM. " LEAST_DAT_CALC

Pls help me...

4 REPLIES 4

Former Member
0 Kudos

use sy-subrc to eliminate the data which is not available

move to the next field which has data

Former Member
0 Kudos

hi,

try the following code :


FORM LEAST_DAT_CALC .

DATE7 = I_PA9030-ZDT_TMPSERV.

IF DATE7 IS NOT INITIAL.
IF DATE7 > I_PA9030-ZDT_TRG.
DATE7 = I_PA9030-ZDT_TRG.
ENDIF.
ENDIF.

IF DATE7 IS NOT INITIAL.
IF DATE7 > I_PA9030-ZDT_WRKCHG.
DATE7 = I_PA9030-ZDT_WRKCHG.
ENDIF.
ENDIF.

IF DATE7 IS NOT INITIAL.
IF DATE7 > I_PA9030-ZDT_TSKFRC.
DATE7 = I_PA9030-ZDT_TSKFRC.
ENDIF.
ENDIF.

IF DATE7 IS NOT INITIAL.
IF DATE7 > I_PA9030-ZDT_PERSERV.
DATE7 = I_PA9030-ZDT_PERSERV.
ENDIF.
ENDIF.

ENDFORM. " LEAST_DAT_CALC

Regards,

Mansi.

Former Member
0 Kudos

FORM LEAST_DAT_CALC .

DATE7 = I_PA9030-ZDT_TMPSERV.

IF DATE7 > I_PA9030-ZDT_TRG
AND I_PA9030-ZDT_TRG IS NOT INITIAL.

DATE7 = I_PA9030-ZDT_TRG.

ENDIF.

IF DATE7 > I_PA9030-ZDT_WRKCHG
AND I_PA9030-ZDT_WRKCHG IS NOT INITIAL.

DATE7 = I_PA9030-ZDT_WRKCHG.

ENDIF.

IF DATE7 > I_PA9030-ZDT_TSKFRC
AND I_PA9030-ZDT_TSKFRC IS NOT INITIAL.

DATE7 = I_PA9030-ZDT_TSKFRC.

ENDIF.

IF DATE7 > I_PA9030-ZDT_PERSERV
AND I_PA9030-ZDT_PERSERV IS NOT INITIAL.

DATE7 = I_PA9030-ZDT_PERSERV.

ENDIF.

ENDFORM. " LEAST_DAT_CALC

0 Kudos

Hi Swasthik,

consider this case...

first assigned to Date7 is blank... even though other fields are having value it is not taking as the least one...

what now? Pls...