‎2008 Nov 20 1:47 PM
Hi All,
I have a selection screen as below.
Parameters:
P_WERKS LIKE MARC-WERKS,
P_MATNR LIKE MATNR.Now I require help for materail when Press F4, the materail should be only that belongs to the Plant entered in the selection screen.
Please suggest.
Regards,
Helpful answers are surely rewarded
‎2008 Nov 20 1:53 PM
‎2008 Nov 20 2:12 PM
Hi Priyanka,
In the module:
at selection-screen on value-request for matnr.
First use the FM DYNP_READ_VALUES.
So that u will get the value in Ware house field.
When U are writing the select Query for Matnr give This ware house field in
Where Condition.
So that only Corresponding values will come into itab.
Pass this itab to Ur regular fm F4IF_INT_TABLE_VALUE_REQUEST.
Try like this.
Regards,
Shalini
‎2008 Nov 20 2:13 PM
Hi Priyanka,
Select the values of matnr based on the p_werks in an internal table and then pass that internal table in the following function module:
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = fieldname
dynpprog = ws_repid
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = v_tab
return_tab = v_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
others = 3.
Thanks,
Pradeep
‎2008 Nov 20 7:27 PM
Hi,
Here are some other options you may want to consider:
1. If you don't mind getting a popup (with the plant value from your P_WERKS defaulted in the popup) during your F4 on MATNR, then you can just code your parameters as follows:
Parameters:
P_WERKS LIKE MARC-WERKS,
P_MATNR LIKE MARC-MATNR. "Notice that the MARC was added (your code did not have it)
The popup is sent because search help MAT1W is defined using the setting "Dialog with value restriction."
2. To get around the MAT1W dialog issue, you can use search help H_MARC which uses "Display values immediately." One way to do this is to create your own structure using SE11 with just two fields, WERKS (type WERKS_D) and MATNR (type MATNR). Override the search help for field MATNR so that H_MARC is used instead of MAT1 (you can do this via the Search Help for Field button). Then code your parameters as follows:
Parameters:
P_WERKS LIKE ZMYSTRUC-WERKS,
P_MATNR LIKE ZMYSTRUC-MATNR.
3. Try to find an existing standard structure or table that gives you a similar relationship as the one defined in option 2. I checked for the obvious possible structures/tables, but I was unable to find an existing one that worked correctly without getting the popup described in option 1.
Best Regards,
Jamie
‎2008 Nov 20 10:11 PM
Hi,
Do this way:
*internal table made to populate the value of werks when pressing f4
DATA: BEGIN OF IT_FINAL1 OCCURS 0,
WERKS TYPE ZMARC-WERKS,
END OF IT_FINAL1.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
RETFIELD = 'WERKS' "field of internal table
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_FINAL1
* FIELD_TAB =
RETURN_TAB = IT_RETURN
.
WRITE IT_RETURN-FIELDVAL TO P_WERKS.
REFRESH IT_FINAL1.
Thanks,
Krishna..
‎2008 Nov 21 4:55 AM
Hi,
First get the plant from the screen,
Then according to the palnt you get , do the select statment.
Last using FM: F4IF_INT_TABLE_VALUE_REQUEST.
Do you use dialog program or general program?
If you use dialog program, you can use POV.
process on value-request.
field p_matnr module mod_get_F4.
module mod_get_F4.
select matnr from MARC into table it_matnr
where WERKS = P_WERKS .
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'MATNR'
dynpprog = 'ZTEST' " program name
dynpnr = '1000' " screen number
dynprofield = 'P_MATNR'
VALUE_ORG = 'S'
tables
value_tab = it_matnr
exceptions
parameter_error = 1
no_values_found = 2
others = 3
.if you use general program:
at selection-screen on value-request for p_matnr.
select matnr from MARC into table it_matnr
where WERKS = P_WERKS .
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'MATNR'
dynpprog = 'ZTEST_C' " program name
dynpnr = '1000' " screen number
dynprofield = 'P_MATNR'
VALUE_ORG = 'S'
tables
value_tab = it_matnr
exceptions
parameter_error = 1
no_values_found = 2
others = 3
.Hope it helps.
Regards,
Chris Gu
‎2008 Nov 21 5:06 AM
Hi Priyanka,
go the selection screen layout and assign the SEARCH HELP MAT1
to the parameter
regards
Ramchander Rao.K