cancel
Showing results for 
Search instead for 
Did you mean: 

How to check validation for a input field?

Former Member
0 Kudos

For example, I need to check the validation of a field, if OK, then the field will be inputted, otherwise, there will rise a message, how can I implement that?

Thanks and best regards,

Anders

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Andres,

U can write a code in Request Processing--DO_VALIDATE_INPUT

DATA: LR_BTADMINH       TYPE REF TO   CL_CRM_BOL_ENTITY.
  LR_BTADMINH  ?= ME->TYPED_CONTEXT->BTADMINH->COLLECTION_WRAPPER->GET_CURRENT( ).
    LV_ZZAFLD000057 = LR_ENTITY->GET_PROPERTY_AS_STRING( 'ZZAFLD000057' ).

 IF  LV_ZZAFLD000057 IS INITIAL.
DATA: L7_MSG_SERVICE TYPE REF TO CL_BSP_WD_MESSAGE_SERVICE,
          LVSP_MSG_V1  TYPE STRING VALUE 'Spare in Progress'.
    L7_MSG_SERVICE = ME->VIEW_MANAGER->GET_MESSAGE_SERVICE( ).
    L7_MSG_SERVICE->ADD_MESSAGE(
        IV_MSG_TYPE       = 'E'
        IV_MSG_ID         = 'ZBSP'
        IV_MSG_NUMBER     = '008'
        IV_MSG_V1         = LVSP_MSG_V1 ).
 ENDIF.

Regards,

Lokesh.

Former Member
0 Kudos

Dear All,

Thanks very much for your answer.

Best regards,

Anders

Former Member
0 Kudos

Masood,

For a requirement to make the BP Role assignment block on Account creation screen required for a minimum of one BP Role. Can we also use DO_VALIDATE_INPUT here? My understanding is that this method is triggered on SAVE.

What is the best way to develop the Roles assignment block to be a required entry? What details would be neccessary for a developer to deveop this functionality so that if no entry is made in the Assignment block BPRoles/RolesList, then an error is thrown?

Thanks!

Answers (2)

Answers (2)

Former Member
0 Kudos

Anders,

You should always use BADIs to do field validations, as controlling of error messages from UI is difficult.

If they are not available, use method DO_HANDLE_DATA or DO_VALIDATE_INPUT.

Regards,

Masood Imrani S.

Former Member
0 Kudos

Hello, I trying to make a input validations I have already implement a Code like the original message but i have Casting Problems, my scenarios is :

The user put some dates, so these dates are in one specific View and i am making my validations in other view inside of the method DO_VALIDATE_INPUT.

I Have made some testing retrieving somes date of other Context of the same views and works well, but as mention the context in which the dates are is in other view.

Do you have any idea how to resolved it ?

Thanks a lot .

suchita_phulkar
Active Contributor
0 Kudos

Hi There,

In the Get_ method of the attribute, do your validation . if NOT OK, clear the value and raise the message using confirm_popup etc or you can also add your message in global message container. You can find the threads on the forum on how to raise a message.

Thanks & Regards,

Suchita