2014 Jun 05 6:11 PM
Hello experts,
I have to create five list boxes with values referenced to same field of the same table.
I have the values in the table. But I do not see them when I execute the screen.
Also when I tried to put the name in second list box, it doesnt allow me to do so.
There are five listboxes, each should have same list of values but different default values.
Thanks in advace.
Shubhendu
Hello experts,
I have to create five list boxes with values referenced to same field of the same table.
I have the values in the table. But I do not see them when I execute the screen.
Also when I tried to put the name in second list box, it doesnt allow me to do so.
There are five listboxes, each should have same list of values but different default values.
Thanks in advace.
Shubhendu
2014 Jun 05 7:28 PM
Hi.
I think you want to use F4 function. So you can filter the diferent records you want to show for each field.
right ?
e.g. 1 - To online PROGRAM:
In the screen codding after user_command module, write :
Module User_command_0100.
PROCESS ON VALUE-REQUEST.
FIELD table-field1 MODULE F4_FIELD_1_list_values. " CREATE ONE PER EACH FIELD YOU NEED..AND ITS SCREEN-NAME HERE ...
MODULE F4_FIELD_1_list_values INPUT.
* SELECT RECORDS you need.
select * from mara where .....
* fill list of values to show
LOOP AT it_table.
CLEAR it_value_tab.
it_value_tab-line = it_table-field.
APPEND it_value_tab.
ENDLOOP.
* fill columns to show
CLEAR it_field_tab.
it_field_tab-tabname = 'TABLE.
it_field_tab-fieldname = 'FIELD'.
it_field_tab-langu = 'E'.
it_field_tab-position = '1'.
APPEND it_field_tab.
* F4 help also returning the value to be displayed in internal table
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'FIELD_NAME_HERE'
dynpprog = 'SAPMz_PROG_NAME_HERE'
* window_title =
TABLES
value_tab = it_value_tab
field_tab = it_field_tab
return_tab = it_return_tab
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.
ELSE.
* Return the selected value
READ TABLE it_return_tab INDEX 1.
IF sy-subrc = 0.
* Conversion exit ALPHA, external->internal
REPLACE ALL OCCURRENCES OF '.' IN it_return_tab-fieldval WITH space IN CHARACTER MODE.
CONDENSE it_return_tab-fieldval NO-GAPS.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = it_return_tab-fieldval
IMPORTING
output = mara-matnr.
ENDIF.
ENDIF.
ENDIF.
ENDMODULE. " F4_FIELD_1_list_values INPUT
e.g. 2 - To report program/executable:
For each field, you create a at selection-screen on value-request for p_fieldN (create one at selection...to each field)
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
F4 help for fields that are only known at runtime
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'MAKT'
fieldname = 'MATNR'
value ='*'
TABLES
return_tab = it_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.
*Return the selected value
READ TABLE it_return_tab INDEX 1.
IF sy-subrc EQ 0.
*Conversion exit ALPHA, external->internal
REPLACE ALL OCCURRENCES OF '.' IN it_return_tab-fieldval WITH space IN CHARACTER MODE.
CONDENSE it_return_tab-fieldval NO-GAPS.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = it_return_tab-fieldval
IMPORTING
output = p_matnr.
ENDIF.
best regards.
Glauco
2014 Jun 10 4:37 PM
Thanks
If its an online PROGRAM:
I successfully set up the search help for 5 different fields.
Now what I want is to assign different default values to those 5 fields.
Is there anyway i could do that.
Thanks
2014 Jun 10 4:53 PM
2014 Jun 11 12:00 PM
Hi Shubhendu Tripathi !
In online, if you want to fill default value, you have 2 options as below, follow a simple example with char3:
1- In TOP include, declaring using VALUE after variable type:
DATA your_field type CHAR3 value '100'.
OR
2-Inside a PBO module, write:
IF your_field is initial.
your_field = '100'.
ENDIF.
best regards.
Glauco
2014 Jun 05 8:42 PM
Hello,
You can use the FM VRM_SET_VALUES to create a drop-down field on the screen with your values and keys.
TYPE-POOLS vrm.
DATA: name TYPE vrm_id,
list TYPE vrm_values,
value LIKE LINE OF list.
value-key = 'YOUR_KEY'
value-text = 'YOUR_TEXT'
APPEND value TO list
...
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'FIELD_NAME'
values = list.
But I think you should create five different fields and create a logic in your program to do what you want.
Use it in a simple field and transfer the value to your table workarea before save in the database.
Att,
Filipe
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |