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: 

Next input field is not populating the values of previous input field

Former Member
0 Kudos

Hi

Pleae see this scenario

I have 2 input fields(say F1 & F2) on my screen. These 2 fields doesn't have any check table. I've created Search Help for the first field and using Match Code object it's displaying the input help for the first field. My requirement is, the second input field should have a restriction so that it should display only the values that are relevant to the value currently available in the first input field.

But, the issue is, using F4 i fetch a value for the 1st input field. And, when I comes to the next input field and presses the F4 button it displays all the values instead of displaying values relevant to the 1st input field. The problem is, when I come to 2nd input field, the 1st input field is empty. So the SELECT query doesn't fetch the relevant data.

Please see the code.

"

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

SELECT-OPTIONS : so_idnorm FOR zcmd_config-idnorm NO INTERVALS OBLIGATORY MATCHCODE OBJECT zsde_configid.

PARAMETERS : p_value LIKE zcmd_config-val OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_value.

SELECT idnorm val INTO TABLE it_config FROM zcmd_config

WHERE zcmd_config~idnorm IN so_idnorm.

IF sy-subrc = 0.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'VAL'

dynpprog = 'SY-REPID'

value_org = 'S'

TABLES

value_tab = it_config

return_tab = it_return_tab.

IF sy-subrc = 0.

READ TABLE it_return_tab INDEX 1.

p_value = it_return_tab-fieldval.

ENDIF.

ENDIF.

"

Please guide me to solve this

5 REPLIES 5

Former Member
0 Kudos

Check this sample code,hope it will solve ur problem.

DATA : it_return1 LIKE ddshretval OCCURS 0 WITH HEADER LINE,

it_return2 LIKE ddshretval OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF it_ernam OCCURS 0,

ernam LIKE mara-ernam,

END OF it_ernam.

DATA: BEGIN OF it_matnr OCCURS 0,

matnr LIKE mara-matnr,

END OF it_matnr.

PARAMETERS: p_ernam LIKE mara-ernam,

p_matnr LIKE mara-matnr.

DATA m LIKE mara-matnr.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ernam.

SELECT ernam FROM mara INTO TABLE it_ernam.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_ERNAM'

value_org = 'S'

TABLES

value_tab = it_ernam

return_tab = it_return1

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

p_ernam = it_return1-fieldval.

SELECT matnr FROM mara INTO TABLE it_matnr WHERE ernam = p_ernam.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_MATNR'

value_org = 'S'

TABLES

value_tab = it_matnr

return_tab = it_return2

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

former_member382216
Participant
0 Kudos

Use the function module DYNP_VALUES_READ to get the selected value of field 1 and then pass the value to select statement .

Former Member
0 Kudos

Hi you create a search help for example:z_search_help in abap dictinory .

Here in selection method ,write the name of table from which value will retrive,

in import parameter

type f1,

in export parameter

type f1,f2.

Make sure both field should be in table.

Now in selection screen.

Parameters:f1 like <data object> matchcode object <name of search help>.

Parameters:f2 like <data object> matchcode object <name of search help created in abap dictionary z_search_help >

hope it will help you.

Former Member
0 Kudos

Hi,

delete 'obligatory' from p_value.

The problem will be solved.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

SELECT-OPTIONS : so_idnorm FOR zcmd_config-idnorm NO INTERVALS OBLIGATORY MATCHCODE OBJECT zsde_configid.

PARAMETERS : p_value LIKE zcmd_config-val.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_value.

SELECT idnorm val INTO TABLE it_config FROM zcmd_config

WHERE zcmd_config~idnorm IN so_idnorm.

IF sy-subrc = 0.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'VAL'

dynpprog = 'SY-REPID'

value_org = 'S'

TABLES

value_tab = it_config

return_tab = it_return_tab.

IF sy-subrc = 0.

READ TABLE it_return_tab INDEX 1.

p_value = it_return_tab-fieldval.

ENDIF.

ENDIF.

"

Former Member
0 Kudos

Hi Joyjit Ghosh,

Thank you very much for the answer.

The problem is solved.

Regards

Senthil