<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get Selection text in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879015#M1478232</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anything using RTTI?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Yup. Like the one below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: pernr TYPE persno.
PARAMETERS pa_bukrs TYPE pa0001-bukrs.
SELECT-OPTIONS so_pernr FOR pernr.

PERFORM get_rolltext USING pa_bukrs.
PERFORM get_rolltext USING so_pernr-low.

FORM get_rolltext USING item.
  DATA: it_ddic TYPE dd_x031l_table WITH HEADER LINE.
  DATA: r_datadescr TYPE REF TO cl_abap_datadescr.
  DATA ls_roll_info TYPE rpy_dtel.

  r_datadescr ?= cl_abap_typedescr=&amp;gt;describe_by_data( item ).
  it_ddic[] = r_datadescr-&amp;gt;get_ddic_object( ).
  READ TABLE it_ddic INDEX 1.

  CALL FUNCTION 'RPY_DATAELEMENT_READ'
    EXPORTING
      dataelement_name = it_ddic-fieldname
    IMPORTING
      dtel_inf         = ls_roll_info
    EXCEPTIONS
      cancelled        = 1
      not_found        = 2
      permission_error = 3
      illegal_type     = 4
      OTHERS           = 5.

  CHECK sy-subrc = 0.
  WRITE: / 'Medium text for this component is', ls_roll_info-SCRTEXT_M.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 May 2010 12:56:07 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2010-05-06T12:56:07Z</dc:date>
    <item>
      <title>Get Selection text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879013#M1478230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to read the text present in selection text of a report (which is displayed with the parameters and select-options present on the selection screen). I used the READ TEXTPOOL statement for the same. It returns the text that has been explicitly specified but does not return the text which has been selected to be picked up from the DDIC.&lt;/P&gt;&lt;P&gt;Is there any way to pick that up?&lt;/P&gt;&lt;P&gt;Anything using RTTI?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 11:22:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879013#M1478230</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-06T11:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get Selection text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879014#M1478231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am not sure whether this helps you or not. &lt;/P&gt;&lt;P&gt;Dictionary Texts can be get from table DDFTX.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raghava Channooru.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 11:38:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879014#M1478231</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-06T11:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get Selection text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879015#M1478232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anything using RTTI?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Yup. Like the one below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: pernr TYPE persno.
PARAMETERS pa_bukrs TYPE pa0001-bukrs.
SELECT-OPTIONS so_pernr FOR pernr.

PERFORM get_rolltext USING pa_bukrs.
PERFORM get_rolltext USING so_pernr-low.

FORM get_rolltext USING item.
  DATA: it_ddic TYPE dd_x031l_table WITH HEADER LINE.
  DATA: r_datadescr TYPE REF TO cl_abap_datadescr.
  DATA ls_roll_info TYPE rpy_dtel.

  r_datadescr ?= cl_abap_typedescr=&amp;gt;describe_by_data( item ).
  it_ddic[] = r_datadescr-&amp;gt;get_ddic_object( ).
  READ TABLE it_ddic INDEX 1.

  CALL FUNCTION 'RPY_DATAELEMENT_READ'
    EXPORTING
      dataelement_name = it_ddic-fieldname
    IMPORTING
      dtel_inf         = ls_roll_info
    EXCEPTIONS
      cancelled        = 1
      not_found        = 2
      permission_error = 3
      illegal_type     = 4
      OTHERS           = 5.

  CHECK sy-subrc = 0.
  WRITE: / 'Medium text for this component is', ls_roll_info-SCRTEXT_M.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 12:56:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879015#M1478232</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-05-06T12:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Get Selection text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879016#M1478233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcin,&lt;/P&gt;&lt;P&gt;Thanks a lot for the help. I think it will do the job.&lt;/P&gt;&lt;P&gt;Just an addition to this (to enhance the reusablity), what if i want to implement this in a function module. i.e. I want to call a function module from my program which will do this for me. In such a case, the function module must also have the run-time attributes of the select-options. How can this be achieved?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Swapnil.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 May 2010 08:36:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879016#M1478233</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-20T08:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Get Selection text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879017#M1478234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you don't need to have select-options parameter in function module. Just look closer to code above&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PERFORM get_rolltext USING pa_bukrs.
PERFORM get_rolltext USING so_pernr-low.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here I am passing only one value (paramater or the low value of select options). So this works for single data object. Later this one is evaluated in subroutine. So if you want to use that in FM, then just type the parameter as ANY (or leave the typing empty). This way you can pass any sel.screen parameter you want or even any other data object from the program. &lt;/P&gt;&lt;P&gt;It will be checked if it is a valid data object. If so then you should get the corresponding text in the DDIC for it. Note, however that this data object or sel.screen parameter (or value of select options) must be typed with DDIC reference (i.e. type field of table or type of data element). So you should not pass fields which have custom typings defined in the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also there have to be some additional checks in the FM itself added. I just assumed we are passing correct type to this subroutine. So basically you should consider of handling errors in case someone passes not a data object but some other entity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 May 2010 08:46:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879017#M1478234</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-05-20T08:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Get Selection text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879018#M1478235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My objective of having a FM is to make it reusable such that the developer will not have to worry about the different select-options that are present in different programs. The developer should just call a single FM which will fetch the texts for all the select options in the selection screen for the program. I tried using the FM 'RS_REFRESH_FROM_SELECTOPTIONS' which gets the select options along with the value that they have, but if i pass selection_table-selname to the perform, it is interpreted as a string and not as a select-option. So, how do I pass all the select-options to a FM or is there a different way of achieving this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Swapnil.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 May 2010 09:03:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879018#M1478235</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-20T09:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get Selection text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879019#M1478236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In FM you can either&lt;/P&gt;&lt;P&gt;1) create two imporitng paramenter, one would be for regular sel.screen parameter, another one would be for select-options. Make them both optional so the user will provide any he wants. Inside do a check if &lt;EM&gt;is supplied&lt;/EM&gt; and if so then for parameter use the above code and for select-options you have to extract one of its value (i.e LOW or HIGH). Then just proceed as with normal parameter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) make one parameter of type any and inside fm check what type of parameter is it. If structure (select options line) then use class &lt;EM&gt;cl_abap_structdescr&lt;/EM&gt; to get its strcutrue, then get its &lt;EM&gt;low&lt;/EM&gt; component and use same approach as above for sinlge field&lt;/P&gt;&lt;P&gt;if parameter (single field) then use above coding without additional checks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That should help&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 May 2010 09:09:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879019#M1478236</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-05-20T09:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Get Selection text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879020#M1478237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think we are not on the same page yet. I do not intend to call the FM using individual parameter / select-option name because this way the whole objective of reusability will be lost. In different programs, there will be different select-options which will call for different code for each program. I need something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'Z_SEL_SCR_TEXT' &lt;/P&gt;&lt;P&gt;EXPORTING program = sy-repid&lt;/P&gt;&lt;P&gt;TABLES text = sel_scr_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can pass the names of the select options to the FM (which i get from the FM RS_REFRESH_FROM_SELECTOPTIONS), but those will go in char format and get_ddic_object( ) will return char. How do I pass select-options to this function module?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Swapnil.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 May 2010 10:26:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879020#M1478237</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-20T10:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Get Selection text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879021#M1478238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I get you. You can use FM &lt;STRONG&gt;RS_REPORTSELECTSCREEN_INFO&lt;/STRONG&gt; to get info about selection screen parameters/sel options and then use method &lt;EM&gt;describe_by_name&lt;/EM&gt; to get that information. Refer the below&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: pernr TYPE persno.
PARAMETERS pa_bukrs TYPE pa0001-bukrs.
SELECT-OPTIONS so_pernr FOR pernr.

*PERFORM get_rolltext USING
*PERFORM get_rolltext USING s

DATA: it_fieldnames TYPE TABLE OF RSDYNPAR WITH HEADER LINE,
      it_fieldinfo  type table of RSEL_INFO WITH HEADER LINE.

CALL FUNCTION 'RS_REPORTSELECTSCREEN_INFO'
  EXPORTING
    report                    = sy-repid
  tables
    field_info                = it_fieldinfo[]
    field_names               = it_fieldnames[].


LOOP AT it_fieldinfo.

  DATA: it_ddic TYPE dd_x031l_table WITH HEADER LINE.
  DATA: r_datadescr TYPE REF TO cl_abap_datadescr.
  DATA ls_roll_info TYPE rpy_dtel.

  r_datadescr ?= cl_abap_typedescr=&amp;gt;describe_by_name( it_fieldinfo-DBFIELD ).
  it_ddic[] = r_datadescr-&amp;gt;get_ddic_object( ).
  ...
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Just encapsulate the above into FM and collect the texts in the table which you retrun from that fm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 May 2010 11:22:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879021#M1478238</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-05-20T11:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Get Selection text</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879022#M1478239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The question is solved.&lt;/P&gt;&lt;P&gt;Thanks a lot Marcin. You are simply awesome!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 May 2010 14:22:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selection-text/m-p/6879022#M1478239</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-20T14:22:15Z</dc:date>
    </item>
  </channel>
</rss>

