Application Development 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: 

How do I make a field mandatory/optional in SAP GUI

monika_eggers
Active Participant
0 Kudos

I took over a PPF (parallel processing framework) report from a colleague who is not available anymore. One of the input fields is mandatory. How do I make it optional?

1 ACCEPTED SOLUTION

Former Member

Hi Monika,

It seems that the required property is set somewhere under the event AT SELECTION-SCREEN OUTPUT.

You should be able to see a line of code like this:

screen-required = 1. " wherein 1 = required and 0 = optional

Change the parameter value from 1 to 0.

Regards,

Aldrin

29 REPLIES 29

Sandra_Rossi
Active Contributor

Please give more details. Is it a selection screen? Is it a classic dynpro? Did you search the web for the code LOOP AT SCREEN ... MODIFY SCREEN to modify at runtime? Are there a transaction + screen variants? etc.

horst_keller
Product and Topic Expert
Product and Topic Expert

Screen 1000 is a selection screen generated from ABAP statements. In screen painter you see the generated dynpro. Making changes there doesn't help at all. Read the documentation about selection screens. You must search the program for OBLIGATORY. And don't forget to use F1 in the editor.

0 Kudos

It's a transaction and a complex selection screen with some header data at the top and several tabs for detailed selections and settings at the bottom. One of the header fields is mandatory. I don't know what screen variants are. I don't know what to do with the LOOP AT SCREEN ... .

I have looked at screen 1000 and can see the mandatory field but also lots of non-mandatory fields there, they look all alike, just CHAIN. FIELD fieldname. FIELD fieldname. MODULE %_END_OF_SCREEN. MODULE %_OK_CODE_1000.ENDCHAIN. I also pressed the button "Layout" and found the field and looked at the attributes. None of this seems to make this field mandatory.

0 Kudos
Thanks, that answer is helpful. I had looked at the code in the report, but couldn't find any kind of MANDATORY or OBLIGATORY marker so I thought I was in the wrong place.

I can't see how this makes the field mandatory p_bpares or p_bpare mandatory, while all the other fields are not mandatory - everything looks just the same:

SELECTION-SCREEN BEGIN OF BLOCK det0hd2
WITH FRAME TITLE hdr002.
PARAMETERS:
p_excdat TYPE bca_dte_am_basis_pp_execdate MODIF ID exd,
p_bpares TYPE tbca_bpare-bpare MEMORY ID bca_bns_y MODIF ID bps,
p_ptypes TYPE fspr_product_y-prodtype MODIF ID pts.
SELECT-OPTIONS:
p_bpare FOR tbca_bpare-bpare MODIF ID bpr,
p_prodex FOR fspr_product_y-prodext MODIF ID hd2,
p_prover FOR fspr_prodv_y-version MODIF ID fpv,
p_prtype FOR fspr_product_y-prodtype MODIF ID pto,
p_pgrphd FOR tbca_cn_bcog_pgc-main_proc_group MODIF ID pgh,
p_pgrpmb FOR tbca_cn_bcog_pgc-memb_proc_group MODIF ID pgm.
SELECTION-SCREEN END  OF BLOCK det0hd2.

Is the MEMORY ID doing this?

I'm also comparing this to a very similar report where the same field is not mandatory and it also has the MEMORY ID there. Actually it's even using the same include.

horst_keller
Product and Topic Expert
Product and Topic Expert

Now Sandra comes in. There are MODIF ID additions (use F1!), hinting at the fact that dynamic modifications take place with LOOP AT SCREEN, MODIFY SCREEN somewhere.

Debug the program to find it.

It doesn't help, you'll have to learn some ABAP ...

0 Kudos

"It doesn't help, you'll have to learn some ABAP ..."

tsk tsk!

<chuckles>

It doesn't matter whether it is a transaction or not. What matters is whether it is an executable report or a module pool/function group with a screen. If the program is a report which is what it appears to be, you can only change the parameter fields attributes either using parameter statements or in the AT Selection-Screen Output event as has been pointed out above.

matt
Active Contributor

Bad advice. Good advice "Hire an abapper". 😉

I thought I'd rejected this question on the grounds of it being a FAQ. But I like some of the answers so I'll let it stand.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hmm, also reports can have dynpros and also module or function pools can have selection screens. It's only a question of what kind of screen is used and not what kind of program.

horst_keller
Product and Topic Expert
Product and Topic Expert

"Hire an abapper".

At SAP??????

matt
Active Contributor
0 Kudos

Well, I thought maybe you'd run out.

0 Kudos

I'm fairly fluent in ABAP, I was an ABAP developer at SAP for a couple of years, and I now do ABAP development again in a non-development team (in between I was in consulting with maybe a dozen lines of code per year at most). Before I almost never had to code SAP-GUI-related things because I was a CRM developer, almost everything happened in CRM WebClient UI except for a couple of correction and analysis reports - which had only the most simple selection screens with a few parameters with or without OBLIGATORY markers. (If you ever need to make a field mandatory or not mandatory in CRM WebClient UI I can help you out :-P)

It's not actually possible to debug this problem without knowing first that one needs to put a breakpoint near

"screen-required = 1". Try it yourself, open a report in se38, use /h, try to run it without filling the mandatory fields. The debugger doesn't start. The error message is also too common to be able to put breakpoints near all occurrences.

horst_keller
Product and Topic Expert
Product and Topic Expert

So I say, you have to learn some old ABAP then ... 😉

0 Kudos

I don't know if this was a rejection of my question, but you did post two inappropriate and insulting moderation messages, "Insufficient detail, but just basic programming. Please refer to your course notes and the documentation." "And it's a FAQ. In future, please search before posting."

I actually went through the folders in the box next to my desk to check if one of the bulky SAP training folders contained my BC400 and BC401 training materials from when I took the courses in 2008, but alas, they weren't. Anyway, this was not really necessary, as I remember that BC400 only taught us about making a parameter in a selection screen mandatory by putting OBLIGATORY behind it, not the screen-required = 1 method or any other way. But hey, at least I unpacked my box finally.

Search before posting. I searched for a week before posting. I contacted other developers who didn't take some years break from coding (they couldn't figure it out, either), I searched help.sap.com, the archive, the web. Some discussions ended in links that are not working anymore since SAP moved everything recently. Others were blocked inside the SAP network without specifying a reason, maybe they are malware distribution sides that stole technical discussions/documentation or lapsed domains to attract viewers. Others were accessible and not ending in dead links, but didn't seem to apply to my PPF reports.

In the future, before moderating, please search for yourself and see if the answer can really be found so easily or at all.

Yes, I guess I could have made the question clearer, as in "obviously besides removing OBLIGATORY behind the parameter, which is not there, otherwise it would be staring me right in the face and I wouldn't be here asking", or I could have posted the architecture picture from the PPF documentation and ask if anyone understands what the hell it is trying to tell me (it never mentions the table where the required fields are customized and I was not even able to gather that "it's BCA PPF customizing" is the answer to the question "how"),

or I could have posted my vita to ensure people understand that I don't come right out of an introduction to ABAP course (which does not cover the screen-required = 1 anyway) or my complete search history of links that were either blocked, discussions answered by non-working links or not applicable.

matt
Active Contributor

It's not actually possible to debug this problem without knowing first that one needs to put a breakpoint near

Go to SE38. Enter the name of the program. Choose the option from the menu that say execute in debug. Then you straight into debug. Pretty soon after that you get into any LOOP AT SCREEN that's been written. If I remember correctly, you get the same option in SE93 with transactions.

matt
Active Contributor

In the interests of clarity, I want to point out that I have not ignored the above comment. I have replied to it privately.

In general, if anyone has a problem with moderation it's probably best to raise it with the site administrators, or post with the tag Using SAP.

Jelena
Active Contributor

I thought the name sounded familiar – there seems to be already some history of disagreements with the moderators. Wouldn’t this be a good time to use this as a learning experience instead of offense?

There is nothing inappropriate much less insulting in the quoted moderator’s message.

Have you actually read your own question? The first sentence is irrelevant. The second doesn’t provide much detail (where is this field located?). And the actual question can be answered on Google in about 30 seconds by using simple logic. Of course, if you google “how to make field optional in report site:sap.com” that brings up all kinds of irrelevant posts. But this just means it’s a wrong search string. When someone made a field mandatory and I need to do the reverse wouldn’t it make sense to search for all the possible ways to make the field mandatory and then try the opposite? Google -> "how to make selection screen field mandatory site:sap.com" -> the top link (dated 2004) mentions LOOP AT SCREEN option. All the keywords are already in your question's tags. So I really want to know how did you manage to spend the whole week searching?

As someone who has to fill in many roles on a short notice and without any training or documentation I can empathize with the situation but definitely not with the way you’ve handled this. First post a LMGTFY question without any pertinent details and then go on a rant (yet again!) when the moderator does his job?

Sorry but I find the whole story ridiculous. Someone gives you an assignment that you are clearly not qualified for. Not a single person at SAP can answer a basic ABAP question (allegedly). You can’t seem to think logically. And you don’t go back to the supervisor to tell them they need to assign proper resources to this task? As an SAP customer’s employee I am now deeply concerned about the SAP's products... You might want to consider what image such behavior projects.

0 Kudos

That doesn't work either if there are empty fields that were made mandatory by using OBLIGATORY or screen-required = 1 or graphically the way Shiva C described below. Try it out. It will go into the debugger, you add e.g. a breakpoint for ABAP command = MESSAGE, then you continue to the selection screen. Then when you try to continue from there it will show the error that the mandatory field is not filled without going into the debugger again. It will only work for errors that were coded, like IF the account number is filled and the bank key is not filled show such and such error message.

That's because you are at that point not processing your abap code but are processing system code.

Try using /hs and tehn breakpoint->At Statement instead. That turns on system debugging. Shiva's answer is totally incorrect and will never work as this is a report program so the screen gets regenerated all the time.

However, I really can't see why all of this to make a field obligatory or not is so hard.

matt
Active Contributor
0 Kudos

Oh dear. Now you're arguing against what wasn't said. You contended:

It's not actually possible to debug this problem without knowing first that one needs to put a breakpoint near.

I say - yes it is, and explain how. Nothing about setting breakpoints at the MESSAGE command. If you do what I said, you will see if there is a LOOP AT SCREEN, and if there is any setting screen-required = 1. If you don't see this before the selection screen appears, then search the source code for "OBLIGATORY".

Anyway, this has gone on long enough. Comments locked.

Former Member

Hi Monika,

It seems that the required property is set somewhere under the event AT SELECTION-SCREEN OUTPUT.

You should be able to see a line of code like this:

screen-required = 1. " wherein 1 = required and 0 = optional

Change the parameter value from 1 to 0.

Regards,

Aldrin

0 Kudos

That helped a lot! With this hint I could find a line

screen-required = con_screen_on.

and from there I found out by debugging that the required fields for the <s>post</s> parallel processing framework (or more specifically for the PPF variant for banking) are customized in table / view BCA_AM_BASIS_PPA.

0 Kudos

Just to know, was PPF for post or parallel processing framework? (that's completely different)

I meant parallel processing framework.

Former Member

To which field u make it as a mandatory or Obligatory ..First of all u go through that pericular screen number..and click on LAYOUT button ..in that screen to which field u want select that input field & double click on that particular field u will get Attributes pop-up in that select program tab --> in that list box is there .the list box contains different options like:

possible

not possible

required

recommanded etc..in that u can select possible..

horst_keller
Product and Topic Expert
Product and Topic Expert
This answer makes no sense. As the discussion shows, it is a selection screen.

Yep You're right Horst

0 Kudos

Still, it's useful general information for mandatory fields in SAP GUI (even though here it doesn't apply because the generated screen will be overwritten on the next generation).

matt
Active Contributor
0 Kudos

And it's a FAQ. In future, please search before posting.