‎2008 Nov 20 10:44 AM
Hi abapers,
Is it possible to create a serach help programitically say by using FM
F4IF_INT_TABLE_VALUE_REQUEST in a se38 program
and then attaching it to a field of a custom z table ?
regards,
Aditya
‎2008 Nov 20 10:51 AM
Hi,
try like this...
PERFORM read_dynprofield USING 'YSAFE_STK_INS-WERKS'
CHANGING ysafe_stk_ins-werks.
SELECT DISTINCT
a~matnr
b~maktx
INTO CORRESPONDING FIELDS OF TABLE it_help1
FROM ysafe_stk_ins AS a
INNER JOIN makt AS b
ON a~matnr = b~matnr
WHERE a~werks EQ ysafe_stk_ins-werks.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'YSAFE_STK_INS-WERKS'
value_org = 'S'
TABLES
value_tab = it_help1
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.
*&---------------------------------------------------------------------*
*& Form READ_DYNPROFIELD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FIELDNAME text
* <--P_VALUE text
*----------------------------------------------------------------------*
FORM read_dynprofield USING p_fieldname
CHANGING p_value.
DATA it_dynfield4 TYPE STANDARD TABLE OF dynpread WITH HEADER LINE.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
request = 'A'
translate_to_upper = 'X'
TABLES
dynpfields = it_dynfield4
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
READ TABLE it_dynfield4 WITH KEY fieldname = p_fieldname.
p_value = it_dynfield4-fieldvalue.
ENDFORM. " READ_DYNPROFIELD
Arunima
‎2008 Nov 20 10:48 AM
Hi,,,,,
Yes aditya It can be done By BDC,,,, Just do the recording of creating the search Help,, and then create it,,,,,
Thanks
saurabh
‎2008 Nov 20 10:48 AM
u can call
CALL FUNCTION 'DYNP_VALUES_READ' to collect the tb_dynpfields from dynpfields under the tables section of FM.This way you read dynamically the value of one field say wf_field2.
Using tb_dynpfields-fieldvalue you can fetch the required values from the data base that u wanna use in the search help.
then call the FM.
F4IF_INT_TABLE_VALUE_REQUEST, using those values..Your search help will come bases on the entries of the other field wf_field2
That will help u out
Regards
Rudra
‎2008 Nov 20 10:51 AM
Hi,
try like this...
PERFORM read_dynprofield USING 'YSAFE_STK_INS-WERKS'
CHANGING ysafe_stk_ins-werks.
SELECT DISTINCT
a~matnr
b~maktx
INTO CORRESPONDING FIELDS OF TABLE it_help1
FROM ysafe_stk_ins AS a
INNER JOIN makt AS b
ON a~matnr = b~matnr
WHERE a~werks EQ ysafe_stk_ins-werks.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'YSAFE_STK_INS-WERKS'
value_org = 'S'
TABLES
value_tab = it_help1
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.
*&---------------------------------------------------------------------*
*& Form READ_DYNPROFIELD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FIELDNAME text
* <--P_VALUE text
*----------------------------------------------------------------------*
FORM read_dynprofield USING p_fieldname
CHANGING p_value.
DATA it_dynfield4 TYPE STANDARD TABLE OF dynpread WITH HEADER LINE.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
request = 'A'
translate_to_upper = 'X'
TABLES
dynpfields = it_dynfield4
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
READ TABLE it_dynfield4 WITH KEY fieldname = p_fieldname.
p_value = it_dynfield4-fieldvalue.
ENDFORM. " READ_DYNPROFIELD
Arunima
‎2008 Nov 20 11:02 AM
Hi,
also you can use the extension matchcode object for parameters and select-options for creating search helps for the particular screen fields( if you are talking about creating about selection-screen fields)
Regards,
Manjista.