Skip to Content
Former Member
Dec 16, 2011 at 12:14 AM

Not able to create conditional required fields at Tcode CJ20N Proj Systems


Hello experts,

I have a requirement to create a few custom fields under custom enhancement tab in CJ20N transaction, and depending on a particular value for one of the fields, another set of fields need to be set to required. (If FIELD1 = 'Y', FIELD2 & FIELD3 should be set to required)

My approaches..

1. Assign a screen group to FIELD2 and FIELD3. If FIELD1 = 'Y' then LOOP AT SCREEN, and set screen-required = 1 for that specific screen group.

Problem with this approach is that, if I select FIELD1 = 'Y' (hit space or enter -> sy-ucomm = TOGGLE), the fields are successfully set to required. However, now if at this point I go and change value for FIELD1 = 'X' (hit space or enter), FIELD2 and FIELD3 still remain set to required, and keep requesting value.

2. Do not set any fields to required. Instead set it to an information message in PAI, informing user that this field requires a value when FIELD1 = 'Y' on TOGGLE and SAVE.

Problem with this approach is that even though during TOGGLE event user is provided with an informational message, if the user directly decides to SAVE (no change for TOGGLE event), in this case the same message is displayed, and the project screen itself is closed. I do not think it would be ideal for the user to see the entire project close on SAVE everytime they miss a conditionally required field.

I am just not sure at this point how to handle this at SAVE so that I can still have the same control as I would when TOGGLE event is triggered.

Experts please help if you have come across such a situation!!! Your insight would be greatly appreciated!

Edited by: akkinair on Dec 16, 2011 1:25 AM