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

Dynamically making a field Mandatory

Former Member
0 Likes
594

Hi Gurus,

I want to make a field mandatory in runtime based on inputs.

e.g.

if s_option1 has a value 10 then s_oprion2 should become a mandatory field.

How's it possible?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
559

Try:


REPORT ztest MESSAGE-ID 00.

PARAMETERS    : p_kokrs     LIKE tka01-kokrs,
                p_waers     LIKE tka01-waers MODIF ID nch.

AT SELECTION-SCREEN OUTPUT.
  IF NOT p_kokrs IS INITIAL.
    LOOP AT SCREEN.
      IF screen-group1 = 'NCH'.
        screen-required = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'NCH'.
        screen-required = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

Rob

2 REPLIES 2
Read only

Former Member
0 Likes
559

Hi,

please try this code :

selection-screen begin of block b1 with frame.

PARAMETERS : A TYPE EKKO-EBELN,

B TYPE EKKO-LIFNR.

selection-screen end of block b1.

at selection-screen output.

IF A = '0000000010'.

IF B IS INITIAL.

MESSAGE 'B IS MANDATORY' TYPE 'E'.

ENDIF.

ENDIF.

Reward points, if helpful

Sandeep Kaushik

Read only

Former Member
0 Likes
560

Try:


REPORT ztest MESSAGE-ID 00.

PARAMETERS    : p_kokrs     LIKE tka01-kokrs,
                p_waers     LIKE tka01-waers MODIF ID nch.

AT SELECTION-SCREEN OUTPUT.
  IF NOT p_kokrs IS INITIAL.
    LOOP AT SCREEN.
      IF screen-group1 = 'NCH'.
        screen-required = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'NCH'.
        screen-required = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

Rob