on 07-21-2005 10:18 PM
Hi,
I want to validate the user input before saving it. I have created a function of type EXIT and added in the planning folder as funtion attribute before saving. I need to know what needs to be passed to the function module to validate the field. Please advise.
There are a number of ways to validate user input, the easiest being by having the allowed range specified in the level (with an exit variable if the range is dynamic). With a characteristic relation, you can also validate value (which can also take a user exit..)... What sort of validation are you looking to do?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you choose to use an exit function, here is a quick example of exit function validation:
FUNCTION Z_CHECK_DEBIT_CREDIT.
*
Validate total amount equals debit + credit
*
DATA: ls_mesg TYPE upc_ys_mesg.
Data: L_DC_TOTAL TYPE P.
FIELD-SYMBOLS: <ls_data> TYPE ANY,
<cl_AMOUNT> TYPE ANY,
<cl_debit> TYPE ANY,
<cl_credit> TYPE ANY,
<ch_struct> TYPE ANY,
<kf_struct> TYPE ANY.
<ls_data> and therefore xs_data contains two structures
1. S_CHAS : Characteristics
2. S_KYFS : key figures
LOOP AT xth_data ASSIGNING <ls_data>.
now <ls_data> points to a line of xth_data and can
be used to reference each characteristic and/or
keyfigure contained within.
choose second structure which contains the keyfigures
*if you were working with a characeristic, you would *need to assign the component 'S_CHAS'.
ASSIGN COMPONENT 'S_KYFS' OF STRUCTURE xs_data TO <kf_struct>.
*Get the total debit amount
*REMEMBER TO CAPITALIZE all infoObject names!
ASSIGN COMPONENT '0DEBIT' OF STRUCTURE <kf_struct> TO <cl_debit>.
*Get the total credit amount
ASSIGN COMPONENT '0CREDIT' OF STRUCTURE <kf_struct> TO <cl_credit>.
*Get the total amount
ASSIGN COMPONENT '0AMOUNT' OF STRUCTURE <kf_struct> TO <cl_amount>.
L_DC_TOTAL = <cl_debit> + <cl_credit>.
IF L_DC_TOTAL NE <cl_amount>.
*Output message to the end user
ls_mesg-msgty = 'E'.
ls_mesg-msgid = 'upf'.
ls_mesg-msgno = '001'.
ls_mesg-msgv1 =
'Total not equal to debit minus credit!'.
APPEND ls_mesg TO et_mesg.
ENDIF.
ENDLOOP.
ENDFUNCTION.
Message was edited by: Cynara Kidwell
Message was edited by: Cynara Kidwell
Thanks for the input. I need to validate the date characteristic entered by the user and the date field is dynamic,the user can input any date and I need to check if the date is less the system date, then they can't plan with the date. So I have created an EXIT function n TCODE: BPS0, and moved that in the plannin folder(UPSPM) and changed the function attributes to "Execute function when Saving". I want to know what paramters I need to add on the EXIT function in TCODE: BPS0.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.