‎2008 Oct 14 6:01 AM
Hi All,
We have created a custom search help for parameters like P1 and P2. Example there will be two parameters (P1 & P2) for P1 we have to give the PO (Purchase order) as an input for the other parameter P2 when you click the search help it should display the related PO item details and it is working fine (For that we have used AT SELECTION SCREEN VALUE REQUEST there we called the F4 function module and filling values based on the input PO)
But the problem here is in the selection screen after entering PO and pressing enter only (any user command) the F4 help is working fine. Other wise it is showing no values in Search help of P2.
Suggest us how to overcome this scenario.
Regards
Paul
‎2008 Oct 14 6:07 AM
Hi,
Use this code....
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
DATA it_dynfield TYPE STANDARD TABLE OF dynpread WITH HEADER LINE.
"This function module is used to read values from selection screen when u do not press enter...
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
request = 'A'
translate_to_upper = 'X'
TABLES
dynpfields = it_dynfield
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_dynfield WITH KEY fieldname = 'po_no'.
IF it_dynfield-fieldvalue IS NOT INITIAL.
po_no = it_dynfield-fieldvalue.
ENDIF.
SELECT werks FROM ekpo
WHERE ebeln = po_no
INTO TABLE it_help1.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'WERKS'
dynpprog = sy-cprog
dynpnr = '1000'
dynprofield = 'P_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.
This will solve ur problem....
Edited by: Sukriti Saha on Oct 14, 2008 7:08 AM
‎2008 Oct 14 6:07 AM
HI paul,
Try using matchcode object <searchhelp name>.
Parameters: ebeln like ekko-ebeln MATCHCODE OBJECT <mobj>
Regards,
Amit
‎2008 Oct 14 6:07 AM
Hi,
Use this code....
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
DATA it_dynfield TYPE STANDARD TABLE OF dynpread WITH HEADER LINE.
"This function module is used to read values from selection screen when u do not press enter...
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
request = 'A'
translate_to_upper = 'X'
TABLES
dynpfields = it_dynfield
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_dynfield WITH KEY fieldname = 'po_no'.
IF it_dynfield-fieldvalue IS NOT INITIAL.
po_no = it_dynfield-fieldvalue.
ENDIF.
SELECT werks FROM ekpo
WHERE ebeln = po_no
INTO TABLE it_help1.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'WERKS'
dynpprog = sy-cprog
dynpnr = '1000'
dynprofield = 'P_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.
This will solve ur problem....
Edited by: Sukriti Saha on Oct 14, 2008 7:08 AM