Skip to Content
0

TMG going to dump after creating code in 01 event to validate date fields.

Jan 12, 2017 at 01:06 PM

63

avatar image

Hi Abapers,

I have a simple requirement. I have a ztable with TMG created. Now i need to validate 2 fields namely date-from and date-to. If date-to - date-from is greater than 3 years i need to throw an error and block that record to get saved in the database. For that i have created an include in event 01 (before saving the data to database) with f_validate_entry and inside that i have written the below code. Now my issue is that not only its not working but TMG while entering data its going in a dump. I am sharing my complete code so that someone could help me where i am going wrong.

FORM CREATE_ENTRY .

DATA: IT_ZDATA TYPE STANDARD TABLE OF ZVEH_REG_CERTF,
LW_ZDATA TYPE ZVEH_REG_CERTF.
DATA: lv_date TYPE i.

LOOP AT TOTAL.

IF <ACTION> EQ 'N' OR <ACTION> EQ 'U'.

APPEND <VIM_TOTAL_STRUC> TO IT_ZDATA.

ENDIF.

ENDLOOP.

IF IT_ZDATA[] IS NOT INITIAL.

* Perform validation

LOOP AT IT_ZDATA INTO LW_ZDATA.

LV_DATE = LW_ZDATA-VALID_TO - LW_ZDATA-VALID_FROM.

IF LV_DATE > 1095.

MESSAGE 'Check the Validity period date range' TYPE 'S' DISPLAY LIKE 'E'.

VIM_ABORT_SAVING = 'X'.

EXIT.

ENDIF.

ENDLOOP.

ENDIF.

ENDFORM. " CREATE_ENTRY

10 |10000 characters needed characters left characters exceeded

If you have a short dump, then read what it says, or attach this short dump if you don't know how to interpret it.

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

surajit sharma Jan 13, 2017 at 10:04 AM
-1

Hi Sandra,

Removed the dump. But no success on this issue.

Created a new include under 05 event with this code but still not working. While in debugging i found out that <ACTION> is always initial. Why?

Isn't that standard and should fill by itself when i am creating new entries from sm30. Please throw some light in this issue. If I am commenting <ACTION> then program is validating from the first line of data in sm30 when in maintain mode and not letting me in new entries.

***INCLUDE LZVEH_INSURANCEF01 .

FORM F_VALIDATE_ENTRY.

DATA: IT_ZDATA TYPE STANDARD TABLE OF ZVEH_INSURANCE,
LW_ZDATA TYPE ZVEH_INSURANCE.
DATA: LV_DATE TYPE I.

LOOP AT TOTAL.

IF <ACTION> EQ 'N' OR <ACTION> EQ 'U'.
IF <VIM_TOTAL_STRUC> IS ASSIGNED.
MOVE-CORRESPONDING <VIM_TOTAL_STRUC> TO LW_ZDATA.
ENDIF.
ENDIF.

*** Perform validation

LV_DATE = LW_ZDATA-VALID_TO - LW_ZDATA-VALID_FROM.

IF LV_DATE > 1095.

MESSAGE 'Check the Validity period date range' TYPE 'S' DISPLAY LIKE 'E'.
VIM_ABORT_SAVING = 'X'.
EXIT.

ENDIF.

ENDLOOP.

ENDFORM. "F_VALIDATE_ENTRY.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

So, it's no more a question about event 01? As per the forum rules, you must open a new question.

0