Skip to Content
avatar image
Former Member

SAP C4C Mandatory field in SDK not work

Hello,

As my pictures show:

I set custom BO filed mandatory(without ABSL check) and it did not work

Attention please!It's a Custom BO so I can't "edit layout" in H5 or SL to set mandatory attribute.

If I must to add extra checks using ABSL like the blog:https://archive.sap.com/discussions/thread/3608195 ?????

mandatory.png (84.7 kB)
mandatory.png (84.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 26, 2017 at 12:44 PM

    In UI designer mandatory property is for marking field with red star (as you attached in picetures).

    If you want make field mandatory and prohibit save action, you have at least two possibilities:

    1. possibility:

    in BO define corresponding field as AlternativeKey if necesary

    [AlternativeKey] AgreementDate : Date;

    or

    2. possibility:

    in BO define flag:

    [Transient] element MandatoryFieldsSet:Indicator; 

    in "Event - AfterModify" script:

    this.GetFirst().MandatoryFieldsSet= true;
    if (this.GetFirst().AgreementDate==""){
    	this.GetFirst().MandatoryFieldsSet= false;
    }
    

    in "Validation - OnSave" script:

    return this.GetFirst().MandatoryFieldsSet;
    

    Please use following code snippet and mark this answer correct if you accept this :-)

    Add comment
    10|10000 characters needed characters exceeded