We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

[sap-hr] Create family member error - Birth date 01.08.1990 is earlier than date . .

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Posted by pmw wong
on May 11 at 12:14 AM
Hi all,

When I created a family member (IT0021) with subtype 1 (spouse) in HR module, I always got this error: "Birth date dd.mm.yyyy is earlier than date ..". Then I debug the program, this error occurred in the method check_marriage_date (see below) in class CL_HRPA_INFOTYPE_0021_CN.

In the current logic of the method below, it checks whether l_p0528-famdt is initial or not (statement: CHECK NOT l_p0528-famdt IS INITIAL.). If it is not initial, it will compare it against birth date (IF p0021-fgbdt > l_p0528-famdt).

The problem is that l_p0528-famdt contains SPACE at that moment. It passes the statement checking (CHECK NOT l_p0528-famdt IS INITIAL.) because the definition of "INITIAL" in ABAP means "00000000". Hence, the program continues to the next statement (IF p0021-fgbdt > l_p0528-famdt). As you can see, l_p0528-famdt is always less than p0021-fgbdt (birth date, which contains 01.08.1990). As a result. the above error message is always shown.

Has anybody encountered this issue? Do you think that it is a SAP bug?

PS:
1. We are using ECC 6.0.
2. Country version is China.
3. IT 0021 has secondary infotype (infotype view) 0528.


METHOD check_marriage_date.
DATA lt_field_list TYPE hrpad_field_tab.
DATA ls_msg TYPE symsg.
DATA l_p0528 TYPE p0528.

is_ok = true.
l_p0528 = pnnnn2.

CHECK NOT l_p0528-famdt IS INITIAL.
IF p0021-fgbdt > l_p0528-famdt.
IF 1 = 0 .
* Birth date &1 is earlier than date &2
MESSAGE e003(hrpadcn) WITH p0021-fgbdt l_p0528-famdt.
ENDIF.
ls_msg-msgty = 'E'.
ls_msg-msgid = 'HRPADCN'.
ls_msg-msgno = '003'.
WRITE p0021-fgbdt TO ls_msg-msgv1.
WRITE l_p0528-famdt TO ls_msg-msgv2.
APPEND 'P0021-FGBDT' TO lt_field_list.
APPEND 'P0528-FAMDT' TO lt_field_list.
CALL METHOD message_handler->add_message
EXPORTING
message = ls_msg
field_list = lt_field_list
cause = message_handler->infotype_specific.
is_ok = false.
ELSEIF l_p0528-famdt > sy-datum.
IF 1 = 0 .
* Date &1 is later than current date &2
MESSAGE w004(hrpadcn) WITH l_p0528-famdt sy-datum.
ENDIF.
ls_msg-msgty = 'W'.
ls_msg-msgid = 'HRPADCN'.
ls_msg-msgno = '004'.
WRITE l_p0528-famdt TO ls_msg-msgv1.
WRITE sy-datum TO ls_msg-msgv2.
APPEND 'P0528-FAMDT' TO lt_field_list.
CALL METHOD message_handler->add_message
EXPORTING
message = ls_msg
field_list = lt_field_list
cause = message_handler->infotype_specific.
ENDIF.

ENDMETHOD.
__.____._
Copyright © 2010 Toolbox.com and message author.

Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251

0 comments:

Post a Comment

T r a n s l a t e to your language