2009 Aug 06 3:20 PM
Hi,
I have 2 filelds in one table like "code, text". I am creating one list box for "text" field. In that drop down list I have to show both code and text fields. But when I click on any record the text has to populate on the screen field text. I tried with "VRM_SET_VALUES" and "F4IF_INT_TABLE_VALUE_REQUEST" but it's not coming fine. And also is there any possibility of getting that record index where we are clicking on dropdown.
The second problem is I have to create one text field with the length of 255 characters. I am using Container for that but it's not showing on the screen. Can anyone send the model example of this.
Thanks in advance
Hi,
I have 2 filelds in one table like "code, text". I am creating one list box for "text" field. In that drop down list I have to show both code and text fields. But when I click on any record the text has to populate on the screen field text. I tried with "VRM_SET_VALUES" and "F4IF_INT_TABLE_VALUE_REQUEST" but it's not coming fine. And also is there any possibility of getting that record index where we are clicking on dropdown.
The second problem is I have to create one text field with the length of 255 characters. I am using Container for that but it's not showing on the screen. Can anyone send the model example of this.
Thanks in advance
2009 Aug 06 3:43 PM
Hi check this program for refernce
REPORT z_listbox.
TYPE-POOLS vrm.
"screen field name for listbox
DATA: listbox.
"value table
DATA: name TYPE vrm_id,
value_tab TYPE vrm_values WITH HEADER LINE.
DATA: mess TYPE string,
idx(3) TYPE c.
CALL SCREEN 0900.
"first fill your listbox in PBO
MODULE init_listbox OUTPUT.
REFRESH value_tab.
value_tab-key = '1'.
CONCATENATE value_tab-key 'TRUE' INTO value_tab-text.
APPEND value_tab.
value_tab-key = '0'.
CONCATENATE value_tab-key 'FALSE' INTO value_tab-text. "dispaly KEY field together with TEXT for this key
APPEND value_tab.
name = 'LISTBOX'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = name
values = value_tab[]
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE.
"your PAI
MODULE user_command_0900 INPUT.
IF sy-ucomm = 'FC_LIST'.
CLEAR idx.
LOOP AT value_tab WHERE key = listbox.
WRITE sy-tabix TO idx.
CONDENSE idx.
ENDLOOP.
CONCATENATE 'You have selected rown #' idx INTO mess.
MESSAGE mess TYPE 'I'. "...will show which row was picked
ENDIF.
ENDMODULE.
As for the second question, you have to place text field directly on screen layout, not in container. But as 255 chars is too to be displayed in text field you have two possibilities:
1) place input/output field on screen layout -> in its attributes set Def. length = 255 -> select Scrollable -> select Output only - this field will behave like text field then and can store string of length 255, but the string will be stored in one line so will look weird
2) use text editor to show your string, for this use FMs RH_EDITOR_SET and RH_EDITOR_GET or classs CL_GUI_TEXTEDIT
CALL FUNCTION 'RH_EDITOR_SET'
EXPORTING
repid = sy-repid
dynnr = '0100'
controlname = 'CONTAINER'
max_cols = 72
max_lines = 20
TABLES
lines = it_str
Regards
Marcin
Marcin
2009 Aug 07 4:36 AM
Thanks for your reply. But your answer is not as per my requirement. You are concatenating and display both fields in list box that is ok. But after selecting record from list box only second field has to display in list box not Key field. how can we do that.
For the second example (for text field with 255 char) . Can you give one full example.
Thanks in advance
2009 Aug 07 10:12 AM
Ok, this is non standard requirement but this will help you. In above code simply change
DATA: listbox(10) type c. "lisbox definition length
"PAI
MODULE user_command_0900 INPUT.
IF sy-ucomm = 'FC_LIST'.
read table value_tab WITH KEY key = listbox(1). "first read only key field
listbox = value_tab-text+1(5). "but return text to that field
ENDIF.
ENDMODULE.
One disadvantage is that among your entries 1TRUE, 0FALSE you will get in dropdown list also this last picked value (text). You can't unfortunatelly omit that.
As for the second question, you may return text value from list box to your text field
"in same module as above
your_text_field_var = value_tab-text+1(5).
or directly to your text editor
DATA: it_str TYPE TABLE OF char72 WITH HEADER LINE.
"PAI
MODULE user_command_0900 INPUT.
IF sy-ucomm = 'FC_LIST'.
read table value_tab WITH KEY key = listbox(1). "first read only key field
listbox = value_tab-text+1(5). "but return text to that field
"....add this code
REFRESH it_str.
it_str = listbox.
APPEND it_str.
CALL FUNCTION 'RH_EDITOR_SET'
EXPORTING
repid = sy-repid
dynnr = '0900'
controlname = 'CONTAINER' "<- this is custom control which you have to place on screen
max_cols = 72
max_lines = 20
TABLES
lines = it_str. "<- and here is displayed your text
ENDIF.
ENDMODULE.
Please close the thread once issue solved.
Regards
Marcin
2009 Sep 02 1:55 PM
2009 Sep 02 3:10 PM
could you please give a feedback, as requested per the rules of engagement. Thx so much.
2009 Sep 04 8:06 AM
>
> could you please give a feedback, as requested per the rules of engagement. Thx so much.
He doesn't seem to be interested in rewarding any of replies he received in any of threads he created.
This is one of the reason I really miss something like personalized black list in SDN, where you would get notification once you want to help such guy.
Thanks Sandra for your concern:)
Regards
Marcin
2009 Sep 04 8:35 AM
Thx, I'll check that next times But I prefer the Abuse button
2009 Sep 04 8:52 AM
I've sent him the following message:
Dear Baleeqahmed
I have received complaints from a number of users that you do not give feedback to your questions and seldom award points to helpful answers. Please note that there is a requirement to give points for helpful answers.
This is a community. You want answers to you questions, then you should show appreciation for thos who help you.
This is part of the rules, and breaking the rules can lead to your account being deleted.
Thank-you for your cooperation.
Matt Billingham - Forums Moderator
If the behaviour continues, please let the moderators know, and we will take action. Baleeqahmed is on my watch list.
matt
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |