2006 Aug 22 5:31 PM
hi friends,
I have task like this,, for example, lets assume that there are tow fields in the slection screen, one sales org and the pther a plant, when the user input the sales org i need to get th ecooresponding palnts which belongs to sales org inthe select-option of the plant..
is this poosible in at-slection screen event? please let me know how you would process this?
Thanks in advance
Rinky
2006 Aug 22 5:46 PM
Hi,
Check this code..
REPORT ZTESTF4 .
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.
Regards
Vijay
2006 Aug 22 5:33 PM
2006 Aug 22 5:46 PM
Hi,
Check this code..
REPORT ZTESTF4 .
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.
Regards
Vijay
2006 Aug 22 5:57 PM
HI i JUST WORKED ON SIMILAR CASE, IT WORKS FOR MY CASE, REFER TO THIS EDITED CODE ONCE AGAIN
<b>*&---------------------------------------------------------------------*
*& Report Z_SAM *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT Z_SAM .
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: TEMP TYPE MANDT DEFAULT '300'.
PARAMETERS: ERSDA TYPE DATS.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-NAME = 'TEMP'.
IF TEMP = '300'.
select ERSDA from mara into ERSDA where matnr =
'000000000000000002'.
ENDSELECT.
* MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
WRITE:/ ERSDA.</b>
This doesn't use any select statements ofcourse, award points if found helpful
Message was edited by: Rahul Kavuri