cancel
Showing results for 
Search instead for 
Did you mean: 

Validation logic in custom infotype

Former Member
0 Kudos
1,060

Hi Gurus,

I have created a custom PA infotype.

I need to add a validation logic on 'BEGDA' and 'ENDDA' which should get triggered, when I try to save the infotype.

The logic is very small one., but am not able to understand where to add the validation logic.

I have written the validation logic in the related module pool program of screen 2000 in PAI module., but its not getting triggered.

Below is the screen 2000 flow logic.

Kindly let me know where to write the logic.

PROCESS BEFORE OUTPUT.

MODULE BEFORE_OUTPUT.
CALL SUBSCREEN subscreen_empl   INCLUDING empl_prog empl_dynnr.
CALL SUBSCREEN subscreen_header INCLUDING header_prog header_dynnr.
MODULE P9123.
MODULE HIDDEN_DATA.


PROCESS AFTER
INPUT.
MODULE EXIT AT EXIT-COMMAND.
CHAIN.
FIELD P9123-BEGDA.
FIELD P9123-ENDDA.
FIELD P9123-ZABC.
MODULE INPUT_STATUS ON CHAIN-REQUEST.
ENDCHAIN.


MODULE PRE_INPUT_CHECKS.
CHAIN.
FIELD P9123-BEGDA.
FIELD P9123-ENDDA.
FIELD RP50M-SPRTX.
FIELD P9123-ZABC.
MODULE POST_INPUT_CHECKS.
ENDCHAIN.

Thanks in advance,

Goutham.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

Create an implementation of the BADI HRPAD00INFTY and put your validation in AFTER_INPUT method.

To get input structure, call the following method :

CALL METHOD cl_pt_container_util=>read_container
    EXPORTING
      im_container = new_innnn
    IMPORTING
      ex_value     = ls_p9123.

Check the ls_p9123-begda and ls_p9123-endda as per your requirement and validate the record.

This is a multiple use badi, so create an impl for each infotype validation to avoid confusion.

Hope it helps!!!!

Rgrds,

Sravan

Former Member
0 Kudos

Given it's a custom infotype, I presonally wouldn't put it in a BADI. I would go with the PAI check module ...

PROCESS AFTER INPUT.
MODULE EXIT AT EXIT-COMMAND.
CHAIN.
FIELD P9123-BEGDA.
FIELD P9123-ENDDA.
FIELD P9123-ZABC.
MODULE INPUT_STATUS ON CHAIN-REQUEST.
ENDCHAIN.

CHAIN.

FIELD P9123-BEGDA.
FIELD P9123-ENDDA.

MODULE CHECK_START_END_DATE.

ENDCHAIN.

Former Member
0 Kudos

Hello Adam,

Its a custom infotype so you can put any piece of code in the flow logic.

But in general, its always recommended to put validations for infotype in user-exit/BADI as it follows the logical DB behaviour.

If you want to put some default values then you can use PAI or PBO. Else its upto you how to proceed...!!!!!!

Rgrds,

Sravan

Former Member
0 Kudos

Hi ,

The check logic can easily be placed in PAI.

Please refer http://help.sap.com/saphelp_nw04s/helpdata/en/9f/dbabbd35c111d1829f0000e829fbfe/frameset.htm

Reward, if found helpful.

Cheers,

Regards,

Amit