Skip to Content
0

SAP C4C Mandatory field in SDK not work

Jun 21, 2017 at 11:28 AM

156

avatar image

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Zoran Galijanic Jun 26, 2017 at 12:44 PM
0

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 :-)

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

Hi Zoran,

As you say,it just mark the field as mandatory and we need to use extra absl to implement the mandatory check.

Btw,I reported an incident and received the following answer:

“Question:If this function mentioned can be supported in 1705.
Answer:=> No it cannot be supported as for custom logic to replicate there should be some script files and current frame work does not support without creating validation script files. Its not possible in the current or future releases. ”

Thanks very much for your reply!

0

Hello Baoxiang,

The setting in the UI Designer is just for the visibility -> show a red star.

To have a real check you need some ABSL coding in the validation for the rep. node.
Or define it as an AlternativeKey (if it is really one) like Zoran mentioned above. In this case the check (incl. a uniqueness check) is done by the system.

HTH,
. Horst

0

Hi Horst,

You are right but at the same time I want to say that it is really a bad design,especially,designers seem to have no plans to change it,I'm so confused.

Baoxiang

0

Hello Benny,

If you expect to be able to replace the UI or use a different input mechanism (WebService,...) you need different ways (UI, BO, ...).

But I agree: it is not strait-forward. :-(

Bye,
. Horst

0

Hi Horst,

I have deleted my mistake question way and asked a new question"https://answers.sap.com/questions/235417/sap-c4c-copy-textcollection-from-custombo.html".

Looking forward to your reply.

Thanks in advance.

0