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: 

how to validate fields in a search help

Former Member
0 Kudos

hi

i got a requirement that create a search help for that i have to validate that fields

plz tell me how to validate filed in a search help

regards

rao

1 REPLY 1

Former Member
0 Kudos

In selection-screens

-


You can refer this link . It has a similar requirement.

In screens

-


Just go through the SAP help regarding Input helps in dialog modules.

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbaac935c111d1829f0000e829fbfe/content.htm

**********************************8

process on value-request.

field v_land1 module country_value_help. " Module for Value Request

field v_regio module region_value_help. " Module for Value Request

in program:

MODULE country_value_help INPUT.

  • Internal table for Country and its Description

data: begin of t_t005t occurs 0,

LAND1 like t005t-land1,

LANDX like t005t-landx,

end of t_t005t.

data: v_choice like sy-tabix. " Index of selected row

  • Internal table for Dynpro fields and their values

data: begin of t_dynpfields occurs 0.

include structure dynpread.

data: end of t_dynpfields.

  • Get the country codes and their descriptions

select land1

landx

from t005t

into table t_t005t

where spras = 'EN'.

if not t_t005t[] is initial..

  • Pop up to display the Countries

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

ENDPOS_COL = 55

ENDPOS_ROW = 40

STARTPOS_COL = 40

STARTPOS_ROW = 20

TITLETEXT = 'Country'

IMPORTING

CHOISE = v_choice

TABLES

VALUETAB = t_t005t

EXCEPTIONS

BREAK_OFF = 1

OTHERS = 2.

if sy-subrc = 0.

if v_activity = 'V'.

read table t_t005t index v_choice.

if sy-subrc = 0.

v_land1 = t_t005t-land1.

clear : v_choice,

t_dynpfields,

t_dynpfields[].

move 'V_LANDX' to t_dynpfields-fieldname.

move t_t005t-landx to t_dynpfields-fieldvalue.

append t_dynpfields.

  • Update the screen field for Country Description

call function 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = 'SAPLZ_VENDOR_MASTER'

dynumb = '0004'

TABLES

dynpfields = t_dynpfields

EXCEPTIONS

invalid_abapworkarea = 01

invalid_dynprofield = 02

invalid_dynproname = 03

invalid_dynpronummer = 04

invalid_request = 05

no_fielddescription = 06

undefind_error = 07.

endif.

endif.

endif.

endif.

ENDMODULE. " country_value_help INPUT

&----


*& Module region_value_help INPUT

&----


  • text

----


MODULE region_value_help INPUT.

  • Internal table for Region and its Description

data: begin of t_t005u occurs 0,

LAND1 like t005u-land1,

BLAND like t005u-bland,

Bezei like t005u-bezei,

end of t_t005u.

  • Ranges for Country

ranges: r_land1 for t005u-land1.

  • Get the country codes and their descriptions

refresh r_land1.

clear r_land1.

refresh t_dynpfields.

move 'V_LAND1' to t_dynpfields-fieldname.

append t_dynpfields.

clear t_dynpfields.

  • Read the value in the Country field on the screen

call function 'DYNP_VALUES_READ'

EXPORTING

dyname = 'SAPLZ_VENDOR_MASTER'

dynumb = '0004'

translate_to_upper = 'X'

TABLES

dynpfields = t_dynpfields

EXCEPTIONS

invalid_abapworkarea = 01

invalid_dynprofield = 02

invalid_dynproname = 03

invalid_dynpronummer = 04

invalid_request = 05

no_fielddescription = 06

undefind_error = 07.

read table t_dynpfields with key fieldname = 'V_LAND1'.

if not t_dynpfields-FIELDVALUE is initial.

r_land1-low = t_dynpfields-FIELDVALUE.

r_land1-sign = 'I'.

r_land1-option = 'EQ'.

append r_land1.

clear r_land1.

endif.

  • Get the Regions to be displayed as F4 Help

select land1

bland

bezei

from t005u

into table t_t005u

where spras = 'EN'

and land1 in r_land1.

if not t_t005u[] is initial..

  • Popup to display Valid Regions for the selected country

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

ENDPOS_COL = 60

ENDPOS_ROW = 40

STARTPOS_COL = 40

STARTPOS_ROW = 20

TITLETEXT = 'Region'

IMPORTING

CHOISE = v_choice

TABLES

VALUETAB = t_t005u

EXCEPTIONS

BREAK_OFF = 1

OTHERS = 2.

if sy-subrc = 0.

if v_activity = 'V'.

read table t_t005u index v_choice.

if sy-subrc = 0.

v_regio = t_t005u-bland.

move 'V_BEZEI' to t_dynpfields-fieldname.

move t_t005u-bezei to t_dynpfields-fieldvalue.

append t_dynpfields.

  • Update the Region description on the screen.

call function 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = 'SAPLZ_VENDOR_MASTER'

dynumb = '0004'

TABLES

dynpfields = t_dynpfields

EXCEPTIONS

invalid_abapworkarea = 01

invalid_dynprofield = 02

invalid_dynproname = 03

invalid_dynpronummer = 04

invalid_request = 05

no_fielddescription = 06

undefind_error = 07.

endif.

endif.

endif.

endif.

ENDMODULE. " region_value_help INPUT

************************************

Regards

Vasu