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: 

Dialog Programming: How to validate the LOV in a search help

Former Member
0 Kudos

Dear All,

How can we validate the LOV in search help for a particular field based on the value of another field? Let me make it clear with an example...I have a screen with two feilds or text boxes one for Material no. and another one for Box no.

Now my requirement is that on choosing or inputting a particular Material No. I should get a list of BoxNos. relevant to that Material No. only and not a whole lot of BoxNos.

Please suggest a solution at your earliest.

Thanx in advance.

Alok.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

use dynpro_value_read FM to read material no.

In event

process on value-request.

field it_bob module get_value.

Write ur logic in this module and call

FM HELP_VALUES_GET_WITH_TABLE

Regards,

Amole

4 REPLIES 4

former_member181962
Active Contributor
0 Kudos

you should use the function module dynp_values_read in the POV section of the screen.

I have an example for you:

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,

ravi

Former Member
0 Kudos

Hi,

use dynpro_value_read FM to read material no.

In event

process on value-request.

field it_bob module get_value.

Write ur logic in this module and call

FM HELP_VALUES_GET_WITH_TABLE

Regards,

Amole

Former Member
0 Kudos

Hi Alok,

This can be done as follows:

use the FM F4IF_INT_TABLE_VALUE_REQUEST to get the value of box no's

You can write a select query to fetch the box no's from the given material no. into a int tab & pass this int tab to the tables parameter of the above FM.

Please note : For this you have to trigger the PAI of the screen so that the value you enter in the mat no is captured.

Regards

Sharat.

ps: reward points if helpful!

Former Member
0 Kudos

Hi Alok,

This question has been asked quite a few times.. This can be done in both screens and selection screens.

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

Regards,

SP.