01-31-2007 4:55 PM
Hi,
I have a requirement where i have two select options. One select option for purchase org.
and other for sales org. For every purchase org there are some corresponding sales og related. Now when i press F4 on the sales org it should give me a list only relevant to the purchase org that i have chosen prior.
How to do that? Please advise.
Thanks,
Das.
01-31-2007 6:10 PM
Thank you all for the replies.
I shall try with your suggestions.
Thanks,
Das.
01-31-2007 4:57 PM
Hi,
Use the function module F4IF_INT_TABLE_VALUE_REQUEST for custom F4..
Check this example..
TABLES: T005T.
DATA: BEGIN OF t_t005 OCCURS 0,
land1 TYPE t005-land1,
END OF t_t005.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(6) v_text FOR FIELD P_LAND1.
PARAMETERS: p_land1 TYPE t005-land1.
SELECTION-SCREEN COMMENT 13(35) v_text1.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_text = 'Country'.
v_text1 = ' '.
AT SELECTION-SCREEN OUTPUT.
IF NOT p_land1 IS INITIAL.
SELECT SINGLE * FROM t005t
WHERE spras = sy-langu
AND land1 = p_land1.
IF sy-subrc = 0.
v_text1 = t005t-landx.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_land1.
REFRESH: t_t005.
SELECT land1
INTO TABLE t_t005
FROM t005.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'T005'
PVALKEY = ' '
retfield = 'LAND1'
dynpprog = sy-repid
DYNPNR = sy-dynnr
dynprofield = 'P_LAND1'
callback_program = sy-repid
value_org = 'S'
TABLES
value_tab = t_t005
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.
Thanks,
Naren
01-31-2007 5:07 PM
Hi
U should manage the search help in the event AT SELECTION-SCREEN ON VALUE-REQUEST.
Max
01-31-2007 5:35 PM
HI,
check this..
<b>tables: mara.
data: begin of itab occurs 0,
matnr like mara-matnr,
end of itab.
DATA : return like ddshretval occurs 0 with header line.
PARAMETERS: p_matnr like mara-matnr.
INITIALIZATION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
REFRESH ITAB.
SELECT matnr FROM mara INTO TABLE ITAB.</b>
( can add where clause regarding other condition)
or
*( restricts only to the matnr with starts with 1 ).
<b>
SELECT matnr FROM mara INTO TABLE ITAB where matnr like '1%'.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR '
dynprofield = 'P_MATNR '
dynpprog = sy-REPID
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = ITAB
return_tab = return.</b>
Regards
SAB
01-31-2007 6:10 PM
Thank you all for the replies.
I shall try with your suggestions.
Thanks,
Das.
01-31-2007 7:20 PM
HI Das,
Check this,
TABLES: mara, makt.
DATA mat LIKE mara-matnr.
DATA: BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
END OF itab.
DATA : BEGIN OF btab OCCURS 0,
maktx LIKE makt-maktx,
END OF btab.
DATA : return LIKE ddshretval OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS: so_matnr FOR mara-matnr,
so_maktx FOR makt-maktx.
INITIALIZATION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_matnr-low.
PERFORM matnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_matnr-high.
PERFORM matnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_maktx-low.
PERFORM maktx.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_maktx-high.
PERFORM maktx.
&----
*& Form matnr
&----
text
----
FORM matnr.
REFRESH itab.
SELECT matnr FROM mara INTO TABLE itab.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR '
dynprofield = 'P_MATNR '
dynpprog = sy-repid
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = itab
return_tab = return.
mat = return-fieldval.
UNPACK mat TO mat.
so_matnr = return-fieldval.
REFRESH return.
CLEAR return.
ENDFORM. "matnr
&----
*& Form maktx
&----
text
----
FORM maktx.
REFRESH btab.
SELECT maktx FROM makt INTO TABLE btab WHERE matnr = mat AND spras =
sy-langu.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MAKTX'
dynprofield = 'SO_MAKTX '
dynpprog = sy-repid
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = btab
return_tab = return.
so_maktx = return-fieldval.
REFRESH return.
CLEAR return.
ENDFORM. "maktx
Regards
SAB