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: 

LOOP AT SCREEN - MAKING SOME FIELD REQUIRED AND DYANMIC

Former Member
0 Kudos

Hi,

I have a report with 4 radio buttons and 10 i/o fields, when user clicks on each button 2 or 3 fields will be open for input and i have done the same using Loop at screen screen-input = 0 ....

I want to make the open fields as required to i achived by using SCREEN-REQUIRED = 1.

But my problem is I have to initialize the 1st radio button as default, so now 2 fields are open for input and it show those are required too. But if I am selecting the second radio button then i get a error message 'Please enter the required fields'.

Note: I am not executing,I am just selecting the second radio button, I have used Loop at screen in AT selection-screen output.

I tried to debug by clicking the second readio button but it does not go to debug mode, it just prompts the error message

I tried to clear the screen field required to 0 for those who have in At selection screen, but failed since it is not triggering.

Please help to solve this. I have already gone thru some of the Threads in SDN, It show to hide and so on via selecting the radio button, I want to remove the defauld or required from the screen fields when user clicks on the another radio button.

Points assured.

regards,

Prabhu

6 REPLIES 6

former_member598013
Active Contributor
0 Kudos

Hi Prabhu,

Put the same logic under the event AT SELECTION SCREEN OUTPUT.


  IF P1 = 'X'.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'MI2'.
        SCREEN-INVISIBLE = 0.
        SCREEN-INPUT = 0.
        SCREEN-ACTIVE = 1.
        SCREEN-OUTPUT = 1.
        MODIFY SCREEN.
      ENDIF.
      IF SCREEN-GROUP1 = 'MI2'.
        SCREEN-INVISIBLE = 0.
        SCREEN-INPUT = 0.
        SCREEN-ACTIVE = 1.
        SCREEN-OUTPUT = 1.
        MODIFY SCREEN.

      ENDIF.
    ENDLOOP.
  ELSEIF P2 = 'X'.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'MI1'.
        SCREEN-INVISIBLE = 0.
        SCREEN-INPUT = 0.
        SCREEN-ACTIVE = 1.
        SCREEN-OUTPUT = 1.
        MODIFY SCREEN.
      ENDIF.
      IF SCREEN-GROUP1 = 'MI1'.
        SCREEN-INVISIBLE = 0.
        SCREEN-INPUT = 0.
        SCREEN-ACTIVE = 1.
        SCREEN-OUTPUT = 1.
        MODIFY SCREEN.

      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'MI2'.
        SCREEN-INVISIBLE = 0.
        SCREEN-INPUT = 0.
        SCREEN-ACTIVE = 1.
        SCREEN-OUTPUT = 1.
        MODIFY SCREEN.
      ENDIF.
      IF SCREEN-GROUP1 = 'MI1'.
        SCREEN-INVISIBLE = 0.
        SCREEN-INPUT = 0.
        SCREEN-ACTIVE = 1.
        SCREEN-OUTPUT = 1.
        MODIFY SCREEN.
      ENDIF.

    ENDLOOP.
  ENDIF.

&*************Reward Point if helpful*************&

Former Member
0 Kudos

Hi,

To make the fields mandatory in your case handle in "at selection screen" event or "at selection screen on field" event.

If the field is initial give an error message saying field is mandatory.

make screen-required = 0.

Regards,

Jaya Vani.

Former Member
0 Kudos

Put an user command 'UCOMM' for the radio-buttons..... remove the obligatory flds.... check the same from at-selection-screen.... within the event CHECK sy-ucomm NE 'UCOMM'.

Edited by: Amitava De on Jun 25, 2008 1:12 PM

Former Member
0 Kudos

hii,

can you plzz check if the radio buttons are assigned into the same group...

if they are then you can try by assigning them to different groups...

plzz revert if problem solved..

thanks..

Former Member

Hi,

Develop some code under the event AT SELECTION-SCREEN event like below.

AT SELECTION-SCREEN.

IF radio_button1 = 'X' AND sy-ucomm = 'ONLI'.

IF field1 is initial.

MESSAGE E000 with <Your own text>.

ENDIF.

IF field1 is initial.

MESSAGE E000 with <Your own text>.

ENDIF.

ENDIF.

Same as for the rest of radio buttons and fields. In this case 'SCREEN-REQUIRED = 1' is not required. The field has checked in the above way whether it has some value or not.

Rgds,

Bujji

0 Kudos

Hi guys,

My code is this , and please try to execute the same, when you try to click on the second radio button,

REPORT zsscr.

types: begin of ty_ap_data,

bukrs(4),

akont(10),

key3(10),

End_date(10),

GL_rep_balance(20),

GL_fun_balance(20),

GL_Acc_balance(20),

end of ty_ap_data.

TABLES : rfsdo,lfb1,knb1,SKA1,fagl_s_rfdsld00_list1,t001.

CONSTANTS: id1(20) TYPE c VALUE 'ZFI_RFKSLD00_EXTRACT',

id2(20) TYPE c VALUE 'ZFI_RFDSLD00_EXTRACT',

id3(24) TYPE c VALUE 'ZFI_RAGITT_ALV01_EXTRACT'.

DATA : g_endpd LIKE rfsdo-allgbmon,

g_enddat TYPE sy-datum.

DATA: it_data TYPE STANDARD TABLE OF ty_ap_data,

wa_data LIKE LINE OF it_data,

wa_ACYTD_BAL LIKE FOAP_S_RFKSLD00_LIST1-ACYTD_BAL.

FIELD-SYMBOLS: <WA> type ANY.

  • <WA2> TYPE fagl_s_rfdsld00_list1.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : S_bukrs for t001-bukrs MODIF ID CM OBLIGATORY.

PARAMETERS :

  • p_bukrs TYPE t001-bukrs MODIF ID CM OBLIGATORY,

p_GJAHR TYPE bkpf-gjahr MODIF ID CM.

SELECT-OPTIONS : S_monate FOR rfsdo-allgbmon MODIF ID CM NO-EXTENSION no INTERVALS.

PARAMETERS: p_BERDAT LIKE RBADA-BRDATU MODIF ID FA,

p_BEREIC LIKE RBADA-AFABE1 MODIF ID FA,

p_SRTVR LIKE RBADA-SRTVR MODIF ID FA,

p_pa_git LIKE tabwo-gitvrs MODIF ID FA.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

SELECT-OPTIONS : S_ako_ap FOR lfb1-akont MODIF ID AP,

S_ako_ar FOR knb1-akont MODIF ID AR,

S_SKO_IV FOR SKA1-SAKNR MODIF ID IV.

SELECTION-SCREEN END OF BLOCK b2.

selection-screen begin of block b3 with frame title text-003.

selection-screen begin of line.

parameters: p_ap radiobutton group rad1 DEFAULT 'X' USER-COMMAND RB.

selection-screen comment (30) text-004 for field p_ap.

selection-screen end of line.

selection-screen begin of line.

parameters: p_ar radiobutton group rad1.

selection-screen comment (30) text-005 for field p_ar.

selection-screen end of line.

selection-screen begin of line.

parameters: p_fa radiobutton group rad1.

selection-screen comment (30) text-006 for field p_fa.

selection-screen end of line.

selection-screen begin of line.

parameters: p_iv radiobutton group rad1.

selection-screen comment (30) text-007 for field p_iv.

selection-screen end of line.

selection-screen end of block b3.

INITIALIZATION.

S_bukrs-low = '0001'.

AT SELECTION-SCREEN OUTPUT.

if p_ap = 'X'.

loop AT SCREEN.

if screen-group1 = 'AR' or screen-group1 = 'FA' or screen-group1 = 'IV'.

screen-input = 0. "Enable

MODIFY SCREEN.

ENDIF.

if screen-group1 = 'AP' or screen-group1 = 'CM'.

screen-REQUIRED = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

CLEAR : p_GJAHR,S_monate[],p_BERDAT,p_BEREIC,p_SRTVR,p_pa_git,S_ako_ap[],S_ako_ar[],S_SKO_IV[].

ELSEIF p_ar = 'X'.

loop AT SCREEN.

if screen-group1 = 'AP' or screen-group1 = 'FA' or screen-group1 = 'IV'.

screen-input = 0. "Enable

MODIFY SCREEN.

ENDIF.

if screen-group1 = 'AR' or screen-group1 = 'CM'.

screen-REQUIRED = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

CLEAR : p_GJAHR,S_monate[],p_BERDAT,p_BEREIC,p_SRTVR,p_pa_git,S_ako_ap[],S_ako_ar[],S_SKO_IV[].

elseif p_fa = 'X'.

loop AT SCREEN.

if screen-group1 = 'AR' or screen-group1 = 'AP' or screen-group1 = 'IV' or screen-name = 'P_GJAHR' or

screen-name = 'S_MONATE-LOW' or screen-name = 'S_MONATE-HIGH' or screen-name = 'P_BEREIC' or screen-name = 'P_SRTVR'.

screen-input = 0. "Enable

MODIFY SCREEN.

ENDIF.

ENDLOOP.

CLEAR : p_GJAHR,S_monate[],p_BERDAT,p_BEREIC,p_SRTVR,p_pa_git,S_ako_ap[],S_ako_ar[],S_SKO_IV[].

P_BEREIC = '01'.

P_SRTVR = '0007'.

ELSEIF p_iv = 'X'.

loop AT SCREEN.

if screen-group1 = 'AR' or screen-group1 = 'FA' or screen-group1 = 'AP'.

screen-input = 0. "Enable

MODIFY SCREEN.

ENDIF.

ENDLOOP.

CLEAR : p_GJAHR,S_monate[],p_BERDAT,p_BEREIC,p_SRTVR,p_pa_git,S_ako_ap[],S_ako_ar[],S_SKO_IV[].

endif.

*----


AT SELECTION-SCREEN ON RADIOBUTTON GROUP rad1.

LOOP AT SCREEN.

if screen-group1 = 'AR' or screen-group1 = 'FA' or screen-group1 = 'IV' or

screen-group1 = 'AP' or screen-group1 = 'CM'.

screen-required = 0. "Enable

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Points assured.

regards,

prabhu