04-03-2018 6:07 PM
Transaction Code: CV04N
Go to Object Links tab > Vendor > press F4
It will display search help KRED_C (then KRED_T). Elementary search help KREDI (Vendors by Country/Company Code) only allows one selection. My requirement is to enable multiple selection.
What I did was copied KREDI to ZKREDI and enabled the multiple selection feature (callcontrol-multisel = 'X') in the search help exit. Checkbox is now present to select multiple values. RECORD_TAB now shows the records selected depending on how much boxes were ticked. However, only the last record is being displayed.
In the screenshot, I selected 5 records. However, only the last record will be displayed in the left table control "Vendor"
Search Help Exit Pseudo Code
CHECK sy-tcode EQ 'CV04N'.
*EXIT immediately, if you do not want to handle this step
IF callcontrol-step <> 'SELONE' AND
callcontrol-step <> 'SELECT' AND
callcontrol-step <> 'RETURN' AND
callcontrol-step <> 'DISP'.
EXIT.
ENDIF.
"Enable multiple selection
callcontrol-multisel = 'X'.
IF callcontrol-step = 'RETURN'.
ENDIF.
Problem:
How can I return multiple selected values in the screen?
04-06-2018 12:20 PM
Value of callcontrol-multisel is provided by the caller of the search help not by the search help. Now, go for a small report to perform a test worth a thousand words
TABLES: lfa1.
PARAMETER pa_lifnr TYPE lfa1-lifnr MATCHCODE OBJECT kredi.
SELECT-OPTIONS so_lifnr FOR lfa1-lifnr MATCHCODE OBJECT kredi.
You should be able to use KREDI, as it was delivered by SAP, for the select-options and use multiple selection, but not for the parameter. What conclusions can you draw?
...
In your case, the search help wont be able to fill other fields, so you have to explicitly handle it in the PROCESS ON VALUE REQUEST block. Use FM F4_FIELD_ON_VALUE_REQUEST to call the search-help using parameters SEARCHHELP and MULTIPLE_CHOICE, use returned records of RETURN_TAB to update dynpro fields.
NB: don't forget to handle field STEPL to fill the table-control, starting from value returned by DYNP_GET_STEPL.
04-04-2018 5:39 AM
hi,
for filling selected data of search help in table control, you should write code.
use fm for calling search help
F4IF_FIELD_VALUE_REQUEST
04-04-2018 6:25 AM
see below sample code
DATA:LT_DDSHRETVAL TYPE STANDARD TABLE OF DDSHRETVAL,
LS_DDSHRETVAL TYPE DDSHRETVAL,
LV_IN TYPE I.
DATA:LT_DYNPREAD TYPE STANDARD TABLE OF DYNPREAD,
LS_DYNPREAD TYPE DYNPREAD.
FIELD-SYMBOLS:<LS_DYNPREAD> TYPE DYNPREAD.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
TABNAME = 'MAKT'
FIELDNAME = 'MAKTX'
SEARCHHELP = 'ZDEMO_MSH'
TABLES
RETURN_TAB = LT_DDSHRETVAL
EXCEPTIONS
FIELD_NOT_FOUND = 1
NO_HELP_FOR_FIELD = 2
INCONSISTENT_HELP = 3
NO_VALUES_FOUND = 4
OTHERS = 5.
LOOP AT LT_DDSHRETVAL INTO LS_DDSHRETVAL.
CLEAR GS_MAKT.
GS_MAKT-MAKTX = LS_DDSHRETVAL-FIELDVAL.
APPEND GS_MAKT TO GT_MAKT.
ENDLOOP.
DO 20 TIMES.
CLEAR LS_DYNPREAD.
LS_DYNPREAD-FIELDNAME = 'GS_MAKT-MAKTX'.
LS_DYNPREAD-STEPL = SY-INDEX.
APPEND LS_DYNPREAD TO LT_DYNPREAD.
ENDDO.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = 'ZDEMO2'
DYNUMB = '0100'
* DETERMINE_LOOP_INDEX = 'X'
TABLES
DYNPFIELDS = LT_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.
CLEAR LV_IN.
LOOP AT LT_DYNPREAD ASSIGNING <LS_DYNPREAD>.
CHECK <LS_DYNPREAD>-FIELDVALUE IS INITIAL.
LV_IN = LV_IN + 1.
CLEAR LS_DDSHRETVAL.
READ TABLE LT_DDSHRETVAL INTO LS_DDSHRETVAL INDEX LV_IN.
<LS_DYNPREAD>-FIELDVALUE = LS_DDSHRETVAL-FIELDVAL.
ENDLOOP.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = 'ZDEMO2'
DYNUMB = '0100'
TABLES
DYNPFIELDS = LT_DYNPREAD
EXCEPTIONS
INVALID_ABAPWORKAREA = 1
INVALID_DYNPROFIELD = 2
INVALID_DYNPRONAME = 3
INVALID_DYNPRONUMMER = 4
INVALID_REQUEST = 5
NO_FIELDDESCRIPTION = 6
UNDEFIND_ERROR = 7
OTHERS = 8.
04-06-2018 12:20 PM
Value of callcontrol-multisel is provided by the caller of the search help not by the search help. Now, go for a small report to perform a test worth a thousand words
TABLES: lfa1.
PARAMETER pa_lifnr TYPE lfa1-lifnr MATCHCODE OBJECT kredi.
SELECT-OPTIONS so_lifnr FOR lfa1-lifnr MATCHCODE OBJECT kredi.
You should be able to use KREDI, as it was delivered by SAP, for the select-options and use multiple selection, but not for the parameter. What conclusions can you draw?
...
In your case, the search help wont be able to fill other fields, so you have to explicitly handle it in the PROCESS ON VALUE REQUEST block. Use FM F4_FIELD_ON_VALUE_REQUEST to call the search-help using parameters SEARCHHELP and MULTIPLE_CHOICE, use returned records of RETURN_TAB to update dynpro fields.
NB: don't forget to handle field STEPL to fill the table-control, starting from value returned by DYNP_GET_STEPL.