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

Reports

Former Member
0 Likes
718

Hi ,

I do have a small question.

I have a selection screen which contains two fields

plant -- ________

Material---________

______----is Input field.

Suppose if i enter plant as 1000 and execute i should all the materails under 1000 to material input field when i press F4 key.

How can we write the code..

Tell me in a simple way.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
699

Hi Anji,

As per your code we will get all the material number since i cannot see any feld like plant there in program

when i give 1000 only materials related to 1000 should appear when i press F4 .How can i restrict for only one plant .Please give me neccessary suggestion.

5 REPLIES 5
Read only

Former Member
0 Likes
699

Hi

You can create a Elementary search help using the Table MARC and attach to that Material field such that the Plant related fields only appear.

see the sample code

REPORT Ztest_HELP .

TABLES : MARC.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_MATNR(10) TYPE C.

SELECTION-SCREEN END OF BLOCK B1.

DATA : BEGIN OF ITAB OCCURS 0,

MATNR TYPE MATNR,

END OF ITAB.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.

SELECT MATNR

FROM MARC

INTO TABLE ITAB

UP TO 10 ROWS.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'MATERIAL NUMBER'

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'P_MATNR'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = ITAB

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

Reward points for useful Answers

Regards

Anji

Read only

former_member491305
Active Contributor
0 Likes
699

Hi,

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.

USE 'DYNP_VALUES_READ' FM to read the value of plant and then select from MARC where plant = p_plant.

Display the values Using "F4IF_INT_TABLE_VALUE_REQUEST" FM

Read only

Former Member
0 Likes
699

Hi,

For that U have to write codings in the

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <material number>.

In this code u have to write select query for getting values of material number corresponds to that particular field.

After that u have to write Fuction Module 'F4IF_INT_TABLE_VALUE_REQUEST' for Displaying those values in the F4 Help.

Regards,

Padmam.

Read only

Former Member
0 Likes
700

Hi Anji,

As per your code we will get all the material number since i cannot see any feld like plant there in program

when i give 1000 only materials related to 1000 should appear when i press F4 .How can i restrict for only one plant .Please give me neccessary suggestion.

Read only

0 Likes
699

Hi ,

Check out the foll code.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

DATA:BEGIN OF itab OCCURS 0,

matnr TYPE marc-matnr,

END OF itab.

DATA: it_ret LIKE TABLE OF ddshretval WITH HEADER LINE.

*-----Use this FM to read Plant value in Screen

<b> DATA:it_dyfld LIKE TABLE OF dynpread WITH HEADER LINE.

it_dyfld-fieldname = 'P_WERKS'.

APPEND it_dyfld.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-repid

dynumb = sy-dynnr

TABLES

dynpfields = it_dyfld.

READ TABLE it_dyfld INDEX 1.

p_werks = it_dyfld-fieldvalue.</b>

SELECT matnr

FROM marc

INTO TABLE itab WHERE werks = p_werks .

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'ITAB-MATNR'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'P_MATNR' "-P_MATNR screen field

value_org = 'S'

TABLES

value_tab = itab

return_tab = it_ret

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

READ TABLE it_ret INDEX 1.

p_matnr = it_ret-fieldval.

Message was edited by:

Vigneswaran S