Skip to Content
0
Mar 11, 2022 at 12:26 AM

To make field mandatory during create, but readonly during update

1194 Views

Hi All,

I have just tried to build an app using ABAPRestfull programming concept, I have managed to make the app work fine until now, but I have question related to like I mentioned in the title of this question.

I have tried to put code like:

managed; // implementation in class zbp_tj_i_xxx unique;

define behavior for ZTJ_I_xxx //alias <alias_name>

persistent table ztjt_xxx

lock master

//authorization master ( instance )

//etag master <field_name>

{

mapping for ztjt_xxx corresponding;

// mandatory fields that are required to create data

field ( mandatory : create, readonly : update ) team; //=> this does not work during creation

create; update; delete;

}

So the issue is, during creation of new data, the field are in readonly mode which I do not expect to happen, but during updating of existing data, the the fields are in readonly mode which I expect to happen.

If I code like this:

field ( mandatory : create ) team;

The field is editable during creation of new data which I expected.

But this also happend during updating of existing data, this field is editable which I dont want to happen.

I hope anybody can help me with this issue.

Thanks

TJ