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

Hi

Former Member
0 Likes
397

Hi Everybody,

I have created input/output fields in the layout in module pool program.

I have provided f4 help also.

Now i want to validate those fields respective to the help available.

How to do that?

Regards,

Chaitanya

Hi Everybody,

I have created input/output fields in the layout in module pool program.

I have provided f4 help also.

Now i want to validate those fields respective to the help available.

How to do that?

Regards,

Chaitanya

2 REPLIES 2
Read only

Former Member
0 Likes
380

hi chaitanya,

select single ebeln into zg8_ekko from zg8_ekko where

ebeln = zg8_ekko-ebeln.

if sy-subrc = 0.

message 'the purchase order no: already exists' type 'E'.

else.

leave to screen 200.

endif.

This is how i provided the F4 help for vendor and currency fields and the validation for these fields is explained below check them out it may help you solving your problem.

module vendorvalue input.

call function 'F4IF_FIELD_VALUE_REQUEST'

exporting

tabname = 'LFA1'

fieldname = 'LIFNR'

  • SEARCHHELP = ' '

  • SHLPPARAM = ' '

dynpprog = progname

dynpnr = dynnum

dynprofield = 'ZG8_EKKO-LLIEF'

  • STEPL = 0

  • VALUE = ' '

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • SUPPRESS_RECORDLIST = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • SELECTION_SCREEN = ' '

  • TABLES

  • RETURN_TAB =

  • EXCEPTIONS

  • FIELD_NOT_FOUND = 1

  • NO_HELP_FOR_FIELD = 2

  • INCONSISTENT_HELP = 3

  • NO_VALUES_FOUND = 4

  • OTHERS = 5

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

endmodule. " VENDORVALUE INPUT

&----


*& Module CURRENCYVALUE INPUT

&----


  • text

----


  • POV for currency field

module currencyvalue input.

call function 'F4IF_FIELD_VALUE_REQUEST'

exporting

tabname = 'EKKO'

fieldname = 'WAERS'

  • SEARCHHELP = ' '

  • SHLPPARAM = ' '

dynpprog = progname

dynpnr = dynnum

dynprofield = 'ZG8_EKKO-WAERS'

  • STEPL = 0

  • VALUE = ' '

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • SUPPRESS_RECORDLIST = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • SELECTION_SCREEN = ' '

  • TABLES

  • RETURN_TAB =

  • EXCEPTIONS

  • FIELD_NOT_FOUND = 1

  • NO_HELP_FOR_FIELD = 2

  • INCONSISTENT_HELP = 3

  • NO_VALUES_FOUND = 4

  • OTHERS = 5

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

endmodule. " CURRENCYVALUE INPUT

module vendor input.

  • IF OK_CODE2 = 'SAVE'.

select single lifnr into lfa1 from lfa1 where lifnr =

zg8_ekko-llief.

if sy-subrc ne 0.

message 'ERROR VENDOR doesnt exist' type 'E'.

endif.

  • ENDIF.

endmodule. " VENDOR INPUT

module currency input.

select single waers into tcurc from tcurc where waers =

zg8_ekko-waers.

if sy-subrc ne 0.

message 'ERROR CURRENCY doesnt exist' type 'E'.

endif.

Read only

Former Member
0 Likes
380

Hi chaianya,

After providing F4 help for a particular field you can validate the input for it using a select query,

for example,

if f4 help is provided for matnr as

*module matnr input.

call function 'F4IF_FIELD_VALUE_REQUEST'

exporting

tabname = 'mara'

fieldname = 'matnr'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'Zmara_test-matnr'

if sy-subrc 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

validation on matnr..

select single matnr into mara from mara where matnr = zmara_test-matnr.

you can validate any no. of fields in this way.

this wuold serve the purpose..

reward if helpful,

thanks.