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

regarding PARAMETER

Former Member
0 Likes
470

hi all

PARAMETER P_WERKS like mseg-werks obligatory.

SELECT-OPTIONS S_mblnr for mkpf-mblnr obligatory.

i want to fetch the values for the select-options from a table based on the parameter value.

if you can tell me how to get the value of the parameter in to a variable at runtime, then its over.

3 REPLIES 3
Read only

Former Member
0 Likes
440

Hi

This will give you the desired result.

DATA: BEGIN OF ITAB OCCURS ,

MBLNR LIKE MKPF-MBLNR,

END OF ITAB.

DATA: DYNFIELDS TYPE TABLE OF DYNPREAD WITH HEADER LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MBLNR.

DYNFIELDS-FIELDNAME = 'P_WERKS'.

APPEND DYNFIELDS.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = SY-CPROG

DYNUMB = SY-DYNNR

TRANSLATE_TO_UPPER = 'X'

TABLES

DYNPFIELDS = DYNFIELDS

EXCEPTIONS

INVALID_ABAPWORKAREA = 1

INVALID_DYNPROFIELD = 2

INVALID_DYNPRONAME = 3

INVALID_DYNPRONUMMER = 4

INVALID_REQUEST = 5

NO_FIELDDESCRIPTION = 6

INVALID_PARAMETER = 7

UNDEFIND_ERROR = 8

DOUBLE_CONVERSION = 9

STEPL_NOT_FOUND = 10

OTHERS = 11.

READ TABLE DYNFIELDS WITH KEY FIELDNAME = 'P_WERKS'.

P_WERKS = DYNFIELDS-FIELDVALUE.

SELECT MBLNR INTO TABLE ITAB FROM MKPF WHERE WERKS = P_WERKS.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'MBLNR'

DYNPROFIELD = 'S_MBLNR' "or S_MBLNR-LOW

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNNR

TABLES

VALUE_TAB = ITAB.

Regards

Navneet

Read only

Former Member
0 Likes
440

Check the sample code..

REPORT ZTEST_F4HELP .

*---Report with selection screen and to display the list of

  • possible entries for field 'B' as per the value in field 'A'.

parameters: p_vbeln type vbak-vbeln,

p_posnr type vbap-posnr.

at selection-screen on value-request for p_posnr.

data: begin of help_item occurs 0,

posnr type vbap-posnr,

matnr type vbap-matnr,

arktx type vbap-arktx,

end of help_item.

data: dynfields type table of dynpread with header line.

dynfields-fieldname = 'P_VBELN'.

append dynfields.

call function 'DYNP_VALUES_READ'

exporting

dyname = sy-cprog

dynumb = sy-dynnr

translate_to_upper = 'X'

tables

dynpfields = dynfields

exceptions

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

invalid_parameter = 7

undefind_error = 8

double_conversion = 9

stepl_not_found = 10

others = 11.

read table dynfields with key fieldname = 'P_VBELN'.

p_vbeln = dynfields-fieldvalue.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = p_vbeln

importing

output = p_vbeln.

select posnr matnr arktx into table help_item

from vbap

where vbeln = p_vbeln.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield = 'POSNR'

dynprofield = 'P_POSNR'

dynpprog = sy-cprog

dynpnr = sy-dynnr

value_org = 'S'

tables

value_tab = help_item.

reward points if it is helpful.

thanks .

kiran.M

Read only

Former Member
0 Likes
440

Hi Murali

Did the solution work out or you still have problem.

Regards,

Navneeth

PS: Reward all helpful replies