‎2006 Jun 13 9:39 AM
HI,
in sm30, i have 2 fields e.g vendor number,purchase order number. for both i have search help. after choosing a value for vendor no., i now take f4 help at second field. i want to have in display only those orders for the chosen vendor and not all the orders.
how can this be done in a collective search help? please help.
‎2006 Jun 13 11:06 AM
In the search-help for purchase order, you have a tab called 'Purchase documents per vendor'. If you put the vendor no. there, it will show you all the POs for that vendor. Does that meet your purpose?
‎2006 Jun 13 11:06 AM
In the search-help for purchase order, you have a tab called 'Purchase documents per vendor'. If you put the vendor no. there, it will show you all the POs for that vendor. Does that meet your purpose?
‎2006 Jun 13 12:06 PM
Hi
If you want to do it through the ABAP code then you can use FM F4IF_INT_TABLE_VALUE_REQUEST and DYNP_VALUES_READ.
‎2006 Jun 13 2:37 PM
hi ,
i used DYNPRO_VALUES_READ to read the value on the screen. but i found after this FM DYNPFIELDS-FIELDVALUE is still empty.
it is unable to get the field value. only when i press enter after giving first field, then it works.
when just F4 is pressed, i dont read the value given for first field. i think the reason is the not using proper event of table maintenance.
any ideas?
‎2006 Jun 13 2:44 PM
Are you passing an entry in DYNPFIELDS with fieldname = <field name of the vendor field> before calling DYNP_VALUES_READ on the F4 of the 2nd field?
‎2006 Jun 13 2:51 PM
YES, i pass the field name.
i m doing all this in POV.
any idea as to what the suitable event in table maintenance where i can get the requirement done.
‎2006 Jun 13 3:30 PM
Surendra,
You can do with normal elementary search help.
Assumimg its a custom table and you can add a custom search help to it.
Create an elementary search help with as below
Give EKKO in selection method, define two fields LIFNR & EBELN.
Assign LIF as a default value for EBELN.
Try and let me know, I have tried and working fine.
Regds
Manohar
‎2006 Jun 13 3:40 PM
hi manohar,
if in my case field has no parameter id then waht to do?
‎2006 Jun 13 3:43 PM
If its a Z field suggest you to create a parameter id, can be created thru data element, give Z01 as parameted id and double click give description.
Regds
Manohar
‎2006 Jun 13 3:51 PM
problem is that the fields are PRODH1, PRODH2 which are standard fields
‎2006 Jun 13 4:24 PM
ok, then in this case if you have no option to change the standard data element, suggest you to have your own data element and create parameter id for it.
If not you need to programatically control from table maintanence screen flow, as i don't see any event will help us in this.
Regds
Manohar
‎2006 Jun 13 12:21 PM
<b>DYNP_VALUES_READ</b> Reads a screen field
<b>DYNP_VALUES_UPDATE</b> Updates a screen field
tables tcurt.
DATA DYFIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.
PARAMETERS: P_WAERS LIKE TCURT-WAERS, "Currency
P_LTEXT LIKE TCURT-LTEXT, "Long Text
P_KTEXT LIKE TCURT-KTEXT. "Short Text
*----
*--- Example of updating value of another field on the screen -
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WAERS.
CLEAR: DYFIELDS[], DYFIELDS.
*--- select currency
CALL FUNCTION 'HELP_VALUES_GET'
EXPORTING
fieldname = 'WAERS'
tabname = 'TCURT'
IMPORTING
SELECT_VALUE = P_WAERS.
*--- get long text for the selected currency
SELECT SINGLE LTEXT FROM TCURT
INTO DYFIELDS-FIELDVALUE
WHERE SPRAS = SY-LANGU
AND WAERS = P_WAERS.
IF SY-SUBRC <> 0.
CLEAR DYFIELDS-FIELDVALUE.
ENDIF.
*--- update another field
DYFIELDS-FIELDNAME = 'P_LTEXT'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
tables
dynpfields = DYFIELDS .
*----
*--- Example of reading value of another field -
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KTEXT.
*--- read another field
CLEAR: DYFIELDS[], DYFIELDS.
DYFIELDS-FIELDNAME = 'P_WAERS'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS .
READ TABLE DYFIELDS INDEX 1.
*--- get short text and update current field
SELECT SINGLE KTEXT FROM TCURT
INTO P_KTEXT
WHERE SPRAS EQ SY-LANGU
AND WAERS EQ DYFIELDS-FIELDVALUE.
*----
regards
vinod
‎2006 Jun 13 12:45 PM
‎2006 Jun 13 4:16 PM
Here is an example for vendor and POs. In your last post you mentioned PRODH1 and PRODH2. So do you need for these two or the LIFNR and EBELN as mentioned originally.
DATA: v_return LIKE dfies-fieldname,
v_program LIKE sy-repid.
PARAMETERS: p_lifnr LIKE ekko-lifnr,
p_ebeln LIKE ekko-ebeln.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ebeln.
PERFORM read_current_sel_screen_data.
PERFORM get_ebeln_f4_values_for_lifnr.
START-OF-SELECTION.
END-OF-SELECTION.
*---------------------------------------------------------------------*
* FORM READ_CURRENT_SEL_SCREEN_DATA *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM read_current_sel_screen_data.
*-- Internal table to get screen data.
DATA: BEGIN OF i_dynpread OCCURS 0.
INCLUDE STRUCTURE dynpread.
DATA: END OF i_dynpread.
DATA: l_dyname LIKE d020s-prog. " Program name.
CLEAR i_dynpread.
REFRESH i_dynpread.
*- Appending field name
i_dynpread-fieldname = 'P_LIFNR'.
APPEND i_dynpread.
CLEAR i_dynpread.
l_dyname = sy-repid.
*-- call function to get screen field data.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = l_dyname
dynumb = '1000'
TABLES
dynpfields = i_dynpread
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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
READ TABLE i_dynpread INDEX 1.
IF sy-subrc = 0.
p_lifnr = i_dynpread-fieldvalue.
ENDIF.
ENDIF.
CLEAR i_dynpread.
REFRESH i_dynpread.
ENDFORM. " READ_CURRENT_SEL_SCREEN_DATA
*---------------------------------------------------------------------*
* FORM GET_EBELN_F4_VALUES_FOR_LIFNR *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM get_ebeln_f4_values_for_lifnr.
v_program = sy-repid.
SET PARAMETER ID 'LIF' FIELD p_lifnr.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'EKKO'
fieldname = 'EBELN'
searchhelp = 'MEKKL'
* SHLPPARAM = ' '
dynpprog = v_program
dynpnr = '1000'
dynprofield = 'P_EBELN'
* STEPL = 0
* VALUE = ' '
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* SUPPRESS_RECORDLIST = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* TABLES
* RETURN_TAB =
EXCEPTIONS
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " GET_EBELN_F4_VALUES_FOR_LIFNR