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

Validating input field in module pool screen

Former Member
0 Likes
14,301

Hi All,

I have a requirement regarding screen input validation.

I have 4 I/O fields.

1)startdate

2)end date

3)available from

4)available to

Now i have filled the data into available from and available to .

when i enter the start date and end date inputs i need to validate these from available from and available to.

i think it can be done by chain , end chain in PAI. but i dont know exactly what should i do with chain and end chain.

can anybody guide me for this requirement if possible with sample code.

thanks in advance

regards

g.s.naidu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,901

Hi,

Include the fields in a FIELD statement, and enclose it in a CHAIN-ENDCHAIN block statment. Eg. Screen flow logic: CHAIN. FIELD: SPFLI-CARRID, SPFLI-CONNID. MODULE CHECK_FLIGHT. ENDCHAIN. When an error is found inside a chain, the screen is re-displayed, and all fields found anywhere in the chain are input-enabled. All non-chain fields remain disabled.

8 REPLIES 8
Read only

Former Member
0 Likes
3,902

Hi,

Include the fields in a FIELD statement, and enclose it in a CHAIN-ENDCHAIN block statment. Eg. Screen flow logic: CHAIN. FIELD: SPFLI-CARRID, SPFLI-CONNID. MODULE CHECK_FLIGHT. ENDCHAIN. When an error is found inside a chain, the screen is re-displayed, and all fields found anywhere in the chain are input-enabled. All non-chain fields remain disabled.

Read only

0 Likes
3,901

Hi sabyasachi kar ,

Thank you verymuch. Now i got the validation message. Your explanation worked out for me.

Thanks & Regards

g.s.naidu

Read only

Former Member
0 Likes
3,901

Hi,

Chain

Field field-name module Modulename,

Field field-name1 module Modulename,

Endchain.

Double click on Modulename.

then Module

Write ur code here..[Validation ]

Endmodule

Read only

Former Member
0 Likes
3,901

Hi,

chain.

field: available from,

available to module Validate_data on input.

endchain.

Write all the code for Validation in module validate_data.

hope this helps.

Regards,

Swati

Read only

Former Member
0 Likes
3,901

Heres one example

chain.

field:

  • izf39_details-placefrom module check_placefrom,

izf39_details-consigname module check_consigname,

izf39_details-addr0,

izf39_details-addr1,

izf39_details-addr2,

izf39_details-addr3,

izf39_details-city module check_city,

izf39_details-lstno module check_lstno ,

izf39_details-cstno module check_cstno,

***start of chg001 removing field izf39_details-transkey

  • izf39_details-transkey module get_trans_name on request,

***end of chg001.

izf39_details-transporter module fill_trans_name,

izf39_details-vehregno,

izf39_details-bolnr module check_bolnr,

izf39_details-refdoctxt1 module check_refdoctxt1,

izf39_details-refdoctxt2,

izf39_details-itemtype module check_itemtype,

izf39_details-menge module check_menge,

izf39_details-value module check_value,

izf39_details-pakgdesc module check_pakgdesc,

izf39_details-reason module check_reason,

izf39_details-destin module check_destin,

izf39_details-initiator module check_initiator.

endchain.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
3,901

Hi G.S.Naidu,

For this you can use,


PROCESS AFTER INPUT.
CHAIN.
FIELD : <field1>,
        <field2>,
        <field3>,
        <field4>
      MODULE <module_name>.
ENDCHAIN.

Now in the code of this <module_name>, you can compare the dates as per your requirements and then raise appropiate error messages.

In case of an error messages, the input fields will not be greyed out, instead you can change the input values and then again this module will be executed until success.

Hope this solves your problem.

Thanks & Regards

Tarun Gambhir

Read only

Former Member
0 Likes
3,901

Hi Tarun,

I'm trying to do as you said. In chain and end chain i've put screen field names.

In module and end module how should i check the dates can you tell me. exactly how to declare the data types and how to pass the input date to the validating variable.

Previously i have got the available from and available to dates and i have disable that dates because those should not get changed.

can you guide me how can i do this?

thanks

g.s.naidu

Read only

Former Member
0 Likes
3,901

Hi,

Consider the case where you want user to enter only u2018LHu2019 and u2018SQu2019 for sflight-carrid. In this case, you are restricting value of a screen field. This cannot be achieved by automatic field check. Hence there is a need of additional validation. It can be done in flow logic by using following statement:

PAI.

Field sflight-carrid values (u2018LHu2019).

For multiple values

PAI.

Field sflight-carrid values (u2018LHu2019 u2018SQu2019).

Field sflight-price values (between 1000 and 2000).

In this case when the user enters the value, PAI is triggered and field is checked for that particular value. If the value entered happens to be wrong, that field is enabled for user to enter. If you have multiple Field statements in your flow logic, it is sequential execution.

Consider the following case:

PAI.

Module assign.

Field sflight-carrid values (u2018LHu2019 u2018SQu2019).

In ABAP/4

Module assign.

Data: carrid1 like sflight-carrid.

Carrid1 = sflight-carrid.

Endmodule.

In this case, Sflight-carrid is used in the flow logic before the field statement. The system will give invalid value or some previous value as the field sflight-carrid is used in module before it is checked i.e., field statement is after the module in which sflight-carrid is being used. The field is not available to the system unless it executes the field statement. Field statement transfers the values to the program and is done only once. If you donu2019t have Field statement in your flow logic, transfer of values takes place in PAI event.

Consider one more case where you have multiple field statement.

PAI.

Field Sflight-carrid values (u2018LHu2019).

Field Sflight-connid values (u20180400u2019 u20180500u2019).

In this case if the user enters only carrid wrong, then this particular field is enabled and rest of the fields are disabled for user to input. Many times if the user enters wrong value for one field, then you might want to give option to user to enter all the fields, which is not possible by using Field statement only. This functionality can be achieved by CHAIN u2013 ENDCHAIN.

Syntax

Chain.

Field sflight-carrid value (u2018LHu2019).

Field sflight-connid values (between u2018200u2019 and u2018500u2019).

Endchain.

Field sflight-price values (u2018100u2019 u20181000u2019).

In this case, if the user enters wrong value only for carrid, both the fields i.e. carrid and connid are enabled as they are grouped together in the Chain statement. The field price will be disabled for input. Usually, logically related fields are grouped together with Chain-Endchain statement.

Regards,

Bhaskar