Application Development 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: 

Selection texts

Former Member
0 Kudos

Hi!

I hope it will be easy for you

Each program has 3 text types: selection texts, text symbols and list headers.

I know text symbols can addressed from the code this way: TEXT-001, or TEXT-abc. Fine.

Is there a way to retrieve the selection texts from the code?

For example if I have a select-option S_MATNR FOR mara-matnr. it is checked to read from the dictionary.

I would like to use it's text in the source code ("material number"). How can retrieve this text in the code ?

Thank you

Tamá

1 ACCEPTED SOLUTION

Former Member
0 Kudos

If you can take a look at the data element for MATNR in SE11, you will be able to find the tab FIELD label. The same text will be fetched for the select-option when you tick the checkbox in selection texts.

This info is stored in table DD04T. To fetch the data give the ROLLNAME as MATNR and DDLANGUAGE as EN

6 REPLIES 6

Former Member
0 Kudos

If you can take a look at the data element for MATNR in SE11, you will be able to find the tab FIELD label. The same text will be fetched for the select-option when you tick the checkbox in selection texts.

This info is stored in table DD04T. To fetch the data give the ROLLNAME as MATNR and DDLANGUAGE as EN

Former Member
0 Kudos

You may like to write a selet query to DD04T.

All short, medium and long texts are stored here.

Thanks

Kiran

Former Member
0 Kudos

I would like to read it from the selection texts, because it might be different from the data dictionary.

Former Member
0 Kudos

use this logic to get this texts

data: texte_request     type ref to cl_wb_request,
        l_object_name     type seu_objkey,
        l_inclname        type seu_objkey,
        l_object_type     type seu_objtyp,
        l_operation       type seu_action,
        l_WB_DATA_CONTAINER type  REF TO CL_WB_DATA_CONTAINER,
        l_textpool_state  type ref to cl_wb_textpool_state,
        source_instance   type ref to cl_wb_source,
        l_context         type ref to cl_wb_context,
        l_context_program type ref to cl_wb_program_context,
        l_wb_todo_request type ref to cl_wb_request,
        l_lines           type sy-index,
        l_index           type sy-index,
        progdir_entry     type progdir,
        rahmen            type seu_objkey.

  data: l_editor_state    type editorstat.

  data: begin of maintab occurs 10,
          name like trdir-name,
        end of maintab.


  create object l_textpool_state.
  case type.
    when sedi_fc_list_top.
      l_textpool_state->texttype = 'H'.
    when sedi_fc_sel_texts.
      l_textpool_state->texttype = 'S'.
    when sedi_fc_num_texts.
      l_textpool_state->texttype = 'I'.
  endcase.
  call method abap_pgeditor->abap_editor->get_source_instance
                importing
                        source_object = source_instance.
  progdir_entry = source_instance->l_progdir_entry.
  l_context = abap_pgeditor->abap_editor->context.
  l_context_program ?= l_context->context_object.
  rahmen        = l_context_program->rahmen.
  l_inclname    = l_context_program->include.
* nur zur Sicherheit, eigentlich sollte CONTEXT gefüllt sein
  if l_inclname eq space.
    call method abap_pgeditor->abap_editor->get_editor_state
                importing
                   state = l_editor_state.
    l_inclname    = l_editor_state-edinclude.
  endif.
  l_object_name = rahmen.
  l_object_type = swbm_c_type_prg_textelement.
  if progdir_entry-subc = 'I' or
     rahmen eq space.
* Bestimmung Rahmenprogramm
    call function 'RS_GET_MAINPROGRAMS'
         exporting
              dialog                 = 'X'
              fulltab                = 'X'
              name                   = l_inclname
         importing
              number_of_mainprograms = l_lines
              tindex                 = l_index
         tables
              mainprograms           = maintab
         exceptions
              cancelled              = 01.
    if sy-subrc ne 0.
      exit.
    else.
      if l_lines > 0.
        read table maintab index l_index.
        l_object_name = maintab-name.
      else.
        l_object_name = l_inclname.
      endif.
    endif.
  else.
    l_object_name = rahmen.
  endif.
  if abap_pgeditor->abap_editor->edit-app_disp = space or
     abap_pgeditor->abap_editor->edit-app_disp = 'A'.
    l_operation = swbm_c_op_edit.
  else.
    l_operation = swbm_c_op_display.
  endif.
  create object texte_request
        exporting p_object_type = l_object_type
                  p_object_name = l_object_name
                  p_object_state = l_textpool_state
                  p_operation   = l_operation.
  call method
       abap_pgeditor->if_wb_program~wb_manager->request_tool_access
          exporting
             p_wb_request   = texte_request
          importing p_wb_todo_request = l_wb_todo_request
          changing
             P_WB_DATA_CONTAINER = l_WB_DATA_CONTAINER
          exceptions action_cancelled = 1
                     no_tool_found    = 2.
  if sy-subrc = 0 and not l_wb_todo_request is initial.
    if l_wb_todo_request->operation = swbm_c_op_end.
      set screen 0. leave screen.
    else.
      perform process_int_nav_request using l_wb_todo_request.
    endif.
  endif.

former_member188685
Active Contributor
0 Kudos

can you do some thing like this..

REPORT  ZTEST_OPTION_01.
data: matnr type matnr.
data: text type table of TEXTPOOL.
select-options: s_matnr for matnr.


start-of-selection.

call function 'RS_TEXTPOOL_READ'
  exporting
    objectname                 = sy-repid
   ACTION                     = 'S'
*   LANGUAGE                   = SY-LANGU
  tables
    tpool                      = text
* EXCEPTIONS
*   OBJECT_NOT_FOUND           = 1
*   PERMISSION_FAILURE         = 2
*   INVALID_PROGRAM_TYPE       = 3
*   ERROR_OCCURED              = 4
*   ACTION_CANCELLED           = 5
          .

          break-point.

text consists of all texts.

you can filter what ever text you want.

Former Member
0 Kudos

Thanx, it is a bit harder than what I found... I'll just simply use the "READ TEXTPOOL" statement.