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

field enable for input when error occurs in module

Former Member
0 Likes
616

hello friends,

we use field or chain to enable field if error occurs within pai module.

i use tabstrip control

in main screen there is one tabstrip control.

for that i have two subscreen.

when errors occurs on main screen module then how can i enable the subscrren fields for input mode.

hello friends,

we use field or chain to enable field if error occurs within pai module.

i use tabstrip control

in main screen there is one tabstrip control.

for that i have two subscreen.

when errors occurs on main screen module then how can i enable the subscrren fields for input mode.

3 REPLIES 3
Read only

MarcinPciak
Active Contributor
0 Likes
581

Try this


"main screen's PAI 
 CHAIN.
  FIELD ...
  FIELD ...
    MODULE main_pai.
ENDCHAIN.

CALL SUBSCREEN sub.  

"in program
data: flag type c.

MODULE main_pai INPUT.
   if condition = true.
      flag = 'X'.
   endif.
ENDMODULE.

"subscreen's PAI 
CHAIN.
   FIELD ...
   FIELD ...
       MODULE sub_pai.
ENDCHAIN.

"in program

MODULE sub_pai INPUT.
   if flag = 'X'.
      message 'Please enter correct value' type 'E'.
   endif.
ENDMODULE.

Regards

Marcin

Read only

0 Likes
581

i say when i execute the module of main program. Main program throws the error to me at that time all subscrren fields are disable for input mode so what i do for enabling the subscreen fields.

Read only

0 Likes
581

Ok, there is no direct soltion because you are working with two screen and can't group those field together.

You could send a W message on main screen's PAI, so after you press ENTER all fields will be back ready for input. The problem is that you want only those fields from subscreen be left active, not those from main screen. This is kind of overcomming solution which comes to my mind:

Lets say we have two fields in main screen:

- SFLIGHT-CARRID

- SFLIGHT-CONNID

And one field in subscreen

- SFLIGHT-FLDATE

Now lets say when you enter CARRID diffetent than 'LH' we will disable CONNID field but leave FLDATE input enabled.


"first in program we declare a strcutre to transfer data b/w screen and program
tables: sflight. 

"then we use field FLAG which will indicate when user picks value different from LH
DATA: flag type c.

"and we use additional field for storing field name which is not to be disabled at main screen
DATA: field_name LIKE screen-name.

Now lets say screen 100 is mian screen and 200 is subscreen so the flow dialog will look like:


"screen 100
PROCESS BEFORE OUTPUT.
  MODULE pbo_0100.
  CALL SUBSCREEN sub_area INCLUDING sy-repid '0200'.

PROCESS AFTER INPUT.
  CALL SUBSCREEN sub_area.
  FIELD sflight-carrid MODULE validate.   "this field we want to validate

Our validate module would look like


MODULE validate INPUT.
  IF sflight-carrid ne 'LH'.
    MESSAGE 'Only LH entry allowed' TYPE 'W'.  "<- message type W will allow to leave rest fields input ready
                                                                      "we will disable rest fields ourselves
    flag = 'X'.        "mark that error was encountered
    field_name = 'SFLIGHT-CARRID'. "remeber field name where error was raised (we wan't to have ability to correct our entry, so this field must stay input ready)
  ELSE.
    CLEAR: flag, field_name.  "otherwise LH entry so everything input enabled
  ENDIF.
ENDMODULE.  

In PBO we will therefore disable all fields except this one if error was raised


MODULE pbo_0100 OUTPUT.
  LOOP AT SCREEN.
    IF flag = 'X' AND screen-name NE field_name.
      screen-input = 0.   
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ENDMODULE.  

This way each time user select entry other than LH, CONNID field will be disabled, CARRID we will be enabled for correction and subscreen field FLDATE is left input enabled

Regards

Marcin