‎2006 Mar 14 8:29 AM
Hi,
I am using two parametrs one for plant selection and other for storage location selection my query is :
after selecting a plant in the plant parameter the corresponding storage location should come as a possible entries(f4 help)in the storage location parameter, how can i do it other than search help, and it is for a executable program. give me the proper codings.
regards
paul
‎2006 Mar 14 8:54 AM
Hi,
please find the below sample code for your requirement.
&----
*& Report ZRKTEST5 *
*& *
&----
*& *
*& *
&----
REPORT ZRKTEST5 .
DATA: PROGNAME TYPE SY-REPID,
DYNNUM TYPE SY-DYNNR,
DYNPRO_VALUES TYPE TABLE OF DYNPREAD,
FIELD_VALUE LIKE LINE OF DYNPRO_VALUES.
DATA: BEGIN OF T_T001L OCCURS 0,
WERKS TYPE WERKS_D,
LGORT TYPE LGORT_D,
END OF T_T001L.
DATA: V_WERKS TYPE WERKS_D,
V_LGORT TYPE LGORT_D.
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS: P_PLANT LIKE MSEG-WERKS,
P_STOLOC LIKE MSEG-LGORT.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIZATION.
PROGNAME = SY-REPID.
DYNNUM = SY-DYNNR.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_STOLOC.
CLEAR: FIELD_VALUE, DYNPRO_VALUES. REFRESH DYNPRO_VALUES.
FIELD_VALUE-FIELDNAME = 'P_PLANT'.
APPEND FIELD_VALUE TO DYNPRO_VALUES.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = PROGNAME
DYNUMB = DYNNUM
TRANSLATE_TO_UPPER = 'X'
TABLES
DYNPFIELDS = DYNPRO_VALUES.
READ TABLE DYNPRO_VALUES INDEX 1 INTO FIELD_VALUE.
SELECT WERKS LGORT INTO TABLE T_T001L FROM T001L WHERE WERKS = FIELD_VALUE-FIELDVALUE.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'P_STOLOC'
DYNPPROG = PROGNAME
DYNPNR = DYNNUM
DYNPROFIELD = 'P_STOLOC'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = T_T001L.
START-OF-SELECTION.
WRITE:/ 'TEST F4 PROGRAM'.
END-OF-SELECTION.
THanks,
Ramakrishna
‎2006 Mar 14 8:33 AM
hi
i think the previous thread for the same is not closed. Please close it. the solution is available in that thread itself.
anyhow, define ur select options or parameters by referring the fields from either 'RMMG1 or MARD'.
Regards,
Phani
Message was edited by: Phani Kumar Sivapuram
‎2006 Mar 14 8:37 AM
HI paul,
you can use List Box..
check this code which <b>generates the second list box details based on the first one</b>..
TYPE-POOLS: VRM.
TABLES SPFLI.
TABLES SSCRFIELDS.
DATA flag.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST.
PARAMETERS PS_PARM LIKE SPFLI-CARRID AS LISTBOX VISIBLE LENGTH 10
USER-COMMAND
fcodex.
data: i_spfli type spfli occurs 0 with header line.
PARAMETERS PQ_PARAM LIKE SPFLI-connid AS LISTBOX VISIBLE LENGTH 15
USER-COMMAND
fcodey.
*DS AS CHECKBOX USER-COMMAND FLAG.
INITIALIZATION.
NAME = 'PS_PARM'.
DATA T TYPE I VALUE 0.
SELECT DISTINCT carrid into corresponding fields of table i_spfli FROM
SPFLI.
loop at i_spfli.
VALUE-KEY = i_spfli-CARRID.
VALUE-TEXT = i_spfli-CARRID.
APPEND VALUE TO LIST.
endloop.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = NAME
VALUES = LIST.
AT SELECTION-SCREEN.
if sy-ucomm eq 'FCODEX'.
REFRESH LIST.
CLEAR LIST.
PQ_PARAM = ' '.
NAME = 'PQ_PARAM'.
SELECT * FROM SPFLI WHERE CARRID = PS_PARM.
VALUE-KEY = SPFLI-connid.
VALUE-TEXT = SPFLI-connid.
APPEND VALUE TO LIST.
ENDSELECT.
endif.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SY-UCOMM NE 'FCODEX' OR SY-UCOMM NE 'FCODEY'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = NAME
VALUES = LIST.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
clear i_spfli.
refresh i_spfli.
select * into table i_spfli from spfli where carrid = ps_parm and connid
= pq_param.
loop at i_spfli.
WRITE: / 'CITY FROM:', I_SPFLI-CITYFROM, 'CITY TO :',I_SPFLI-CITYTO,
'DEPARTURE TIME :', I_SPFLI-DEPTIME.
ENDLOOPthis could be an alternative solution...
regards
satesh
‎2006 Mar 14 8:41 AM
Hi
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
use both coloumn in value_tab. It will show u
both search help.
Then use following code to achieve next goal.
call function 'DYNP_GET_STEPL'
importing
povstepl = step_line
exceptions
stepl_not_found = 1
others = 2.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = lc_dyname
dynumb = lc_dynumb
tables
dynpfields = ltab_fields
exceptions
others = 8.
commit work and wait.
Hope this will be useful.
Regards
vinod
‎2006 Mar 14 8:54 AM
Hi,
please find the below sample code for your requirement.
&----
*& Report ZRKTEST5 *
*& *
&----
*& *
*& *
&----
REPORT ZRKTEST5 .
DATA: PROGNAME TYPE SY-REPID,
DYNNUM TYPE SY-DYNNR,
DYNPRO_VALUES TYPE TABLE OF DYNPREAD,
FIELD_VALUE LIKE LINE OF DYNPRO_VALUES.
DATA: BEGIN OF T_T001L OCCURS 0,
WERKS TYPE WERKS_D,
LGORT TYPE LGORT_D,
END OF T_T001L.
DATA: V_WERKS TYPE WERKS_D,
V_LGORT TYPE LGORT_D.
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS: P_PLANT LIKE MSEG-WERKS,
P_STOLOC LIKE MSEG-LGORT.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIZATION.
PROGNAME = SY-REPID.
DYNNUM = SY-DYNNR.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_STOLOC.
CLEAR: FIELD_VALUE, DYNPRO_VALUES. REFRESH DYNPRO_VALUES.
FIELD_VALUE-FIELDNAME = 'P_PLANT'.
APPEND FIELD_VALUE TO DYNPRO_VALUES.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = PROGNAME
DYNUMB = DYNNUM
TRANSLATE_TO_UPPER = 'X'
TABLES
DYNPFIELDS = DYNPRO_VALUES.
READ TABLE DYNPRO_VALUES INDEX 1 INTO FIELD_VALUE.
SELECT WERKS LGORT INTO TABLE T_T001L FROM T001L WHERE WERKS = FIELD_VALUE-FIELDVALUE.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'P_STOLOC'
DYNPPROG = PROGNAME
DYNPNR = DYNNUM
DYNPROFIELD = 'P_STOLOC'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = T_T001L.
START-OF-SELECTION.
WRITE:/ 'TEST F4 PROGRAM'.
END-OF-SELECTION.
THanks,
Ramakrishna
‎2006 Mar 14 9:01 AM
Simplly use the following and rest all will be done by SAP.
select-options: werks for RM06E-WERKS.
select-options lgort for RM06E-LGORT.
if u enter any plant and then press F4 for storage it will display only for the selected pant.
‎2006 Mar 14 10:17 AM
Hi Paul,
This can be done in this way.
data : begin of i_lgort occurs 0,
lgort type t001L-lgort,
end of i_lgort.
data : retfield type dfies-fieldname.
data : ls_ret type dfies occurs 0.
Parameters: p_plant type t001w-werks,
p_stloc type t001L-lgort.
At selection-screen on VALUE-REQUEST FOR P_stloc.
select lgort from t001l into table i_lgort
where werks = p_plant.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'lgort'
PVALKEY = ' '
DYNPPROG = sy-repid
DYNPNR = '1000'
DYNPROFIELD = 'p_stloc'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
tables
value_tab = i_lgort
FIELD_TAB = ls_ret
RETURN_TAB = P_plant
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
This will solve your problem i think.
Regards
Anil Kumar K