Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

problem with list box & container (textfield)

Former Member
0 Likes
1,611

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

8 REPLIES 8
Read only

MarcinPciak
Active Contributor
0 Likes
1,252

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

Read only

0 Likes
1,252

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

Read only

0 Likes
1,252

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

Read only

Former Member
0 Likes
1,252

answered

Read only

0 Likes
1,252

could you please give a feedback, as requested per the rules of engagement. Thx so much.

Read only

0 Likes
1,252

>

> 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

Read only

0 Likes
1,252

Thx, I'll check that next times But I prefer the Abuse button

Read only

matt
Active Contributor
0 Likes
1,252

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