Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Control Mandatory fields on custom screen in Module pool program

Former Member
0 Likes
2,690

Hello all,

I have developed a custom screen on which I have a table control with 5 fields. I wanted to make the first three fields mandatory. So instead of selecting the entry as "required" from the screen attributes for these input fields, I have looped at table screen in PBO and based on the screen name and screen group I have set the field screen-required = 1. By doing this, I could make these 3 fields mandatory.

Now, when I enter the data for the first line and press enter, it is asking me to fill the required fields in the second line and so on.How can I avoid this without having to remove the mandatory symbol in the subsequent lines?

There is an altenative way of achieving this by not making the fields mandatory on the screen but while saving we can check if the value is entered and raise a message. In this scenario the user would not know that they are obligatory fields until he hits save button.

For example, in standard transaction VK12, if we select condition type K005 and go to the maintenance, we see that material is obligatory.

After entering material in first line and when I hit enter, it does not ask me enter the material in the second and subsequent lines even though it is a mandatory field.

I want to achive this functionality in my custom screen also.

Can anyone let me know how to handle this?

Thanks,

Sandeep.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,717

I have developed a custom screen on which I have a table control with 5 fields. I wanted to make the first three fields mandatory. So instead of selecting the entry as "required" from the screen attributes for these input fields, I have looped at table screen in PBO and based on the screen name and screen group I have set the field screen-required = 1

Why didn't you set these fields as required on the attributes? That has to be the easiest way.

Rob

6 REPLIES 6
Read only

Former Member
0 Likes
1,718

I have developed a custom screen on which I have a table control with 5 fields. I wanted to make the first three fields mandatory. So instead of selecting the entry as "required" from the screen attributes for these input fields, I have looped at table screen in PBO and based on the screen name and screen group I have set the field screen-required = 1

Why didn't you set these fields as required on the attributes? That has to be the easiest way.

Rob

Read only

0 Likes
1,717

Hello Rob,

I can set these fields mandatory in the attributes as well which will avoid looping at table SCREEN in PBO. Since I was looking at standard program behind VK12, I just followed it. There is absolutely no other reason behind it.

Any ideas how to achieve the functionality posted in my earlier question (similar to VK12)?

Thanks,

Sandeep

Read only

0 Likes
1,717

Sandeep,

Change the screen attributes for those fields from Input required to Input recommended ( Field attributes -> Program -> Input dropdown). This way the Mandatory symbol is shown even though the fields will not be mandatory( system will not check for entry ) but you have to check the Mandatory through code. Hope this is the functionality you are looking for.

Read only

0 Likes
1,717

In addition to checking the screen group, you also have to check whether the screen field is pupulated, If not then don't set the attribute.

But I don't see any real benefit to doing this. do it in the screen layout.

Rob

Read only

0 Likes
1,717

Suman,

Thanks very much. This is what I was looking for. Awarding full points

Thanks,

Sandeep

Read only

Former Member
0 Likes
1,717

Hi,

Check if other two fields get/set parameters are not checked in their attributes.

Reetesh