<?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: Passing range table in a Subroutine in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456100#M215606</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not able to understand what ur asking.....but u can directly loop at so_vbeln/so_fkdat/so_fkart to get the data in select options.&lt;/P&gt;&lt;P&gt;Not sure y ur using itab_so....wat is the structure of itab_so??!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Aarthi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Jul 2006 06:52:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-07-25T06:52:21Z</dc:date>
    <item>
      <title>Passing range table in a Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456099#M215605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got 3 select options like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Tables : VBRK.
*---------------------------------------------------------------------*
*SELECTION SCREEN GUI
*---------------------------------------------------------------------*
SELECT-OPTIONS:
so_fkdat   FOR vbrk-fkdat OBLIGATORY,
so_fkart   FOR vbrk-fkart,
so_vbeln   FOR vbrk-vbeln.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now In the title of my alv I want to show &lt;/P&gt;&lt;P&gt;what user hav input in these 3 select-options. (the alv part is okay)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FORM form_so_title
                    USING itab_so  TYPE ANY TABLE
                    it_so
                    CHANGING p_ls_line_info TYPE slis_entry.
  LOOP AT itab_so into it_so.
* this is not working with type any
* so i hav to loop instead of read line
*  READ TABLE it_so INDEX 1. 
    EXIT.
  ENDLOOP.
*When i am trying to access it_so-low, i m getting error
   l_describe = cl_abap_typedescr=&amp;gt;describe_by_data( it_so-low ).
    IF l_describe-&amp;gt;type_kind EQ 'D'.
      WRITE it_so-high TO p_ls_line_info DD/MM/YYYY.
    ELSE.
      p_ls_line_info = it_so-high.
    ENDIF.
* this routine is complex but i am only posting 
* certain part of it
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is how I am calling the routines&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  ls_line-key  = 'Billing Date'.
  PERFORM form_so_title USING so_fkdat[] so_fkdat
                        CHANGING ls_line-info.
  APPEND ls_line TO lt_top_of_page.
*

  ls_line-key  = 'Billing No.'.
  CLEAR ls_line-info.
  PERFORM form_so_title USING so_vbeln[] so_vbeln
                        CHANGING ls_line-info.
  APPEND ls_line TO lt_top_of_page.
*
  ls_line-key  = 'Billing Type'.
  CLEAR ls_line-info.
  PERFORM form_so_title USING so_fkart[] so_fkart
                        CHANGING ls_line-info.
  APPEND ls_line TO lt_top_of_page.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;P.S.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jul 2006 06:44:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456099#M215605</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-25T06:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Passing range table in a Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456100#M215606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not able to understand what ur asking.....but u can directly loop at so_vbeln/so_fkdat/so_fkart to get the data in select options.&lt;/P&gt;&lt;P&gt;Not sure y ur using itab_so....wat is the structure of itab_so??!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Aarthi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jul 2006 06:52:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456100#M215606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-25T06:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Passing range table in a Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456101#M215607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not possible to pass the different select-options into same parameter in the subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to do it with MACRO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;define disp.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;here you can access components like &amp;amp;1-low, &amp;amp;1-high...&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;end-of-defination.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*use it&lt;/P&gt;&lt;P&gt;disp so_fkdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jul 2006 06:54:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456101#M215607</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2006-07-25T06:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Passing range table in a Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456102#M215608</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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FORM form_so_title
             tables itab_so  like so_fkdat
           CHANGING p_ls_line_info TYPE slis_entry.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : - so_fkdat should be globally declared.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;or&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make a global varaible like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : lt_fkdat type ranges of fkdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then this&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FORM form_so_title
             tables itab_so  like lt_fkdat
           CHANGING p_ls_line_info TYPE slis_entry.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE :- It will not recognize the variable until u type cast it. always define type of variable in form aparameter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jul 2006 06:54:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456102#M215608</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-25T06:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Passing range table in a Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456103#M215609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Aarthi: &lt;/P&gt;&lt;P&gt;the idea is to do it dynamically, &lt;/P&gt;&lt;P&gt;i want to reuse the code, &lt;/P&gt;&lt;P&gt;as i wrote in my subroutine, its 100 line of code&lt;/P&gt;&lt;P&gt;and i dont want to repeat them&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;itab_so has got no strucute&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Manoj Gupta  :&lt;/P&gt;&lt;P&gt;I want to use the same subroutines for all the three select-options&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Naimesh Patel :&lt;/P&gt;&lt;P&gt;Macro is nice work around, but i need to use it in other programs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jul 2006 07:12:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456103#M215609</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-25T07:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Passing range table in a Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456104#M215610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZT_SO
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  zt_so.

*---------------------------------------------------------------------*
* ALV
*---------------------------------------------------------------------*
TYPE-POOLS: slis, kkblo.


*---------------------------------------------------------------------*
*TABLES
*---------------------------------------------------------------------*

TABLES: usr01, sscrfields, vbrk.
TABLES: thead,                         "Textheader
        tline.                         "Textline
DATA:
it_vbrk LIKE TABLE OF vbrk.
*---------------------------------------------------------------------*
*SELECTION SCREEN GUI
*---------------------------------------------------------------------*
SELECT-OPTIONS:
so_fkdat   FOR vbrk-fkdat OBLIGATORY,
so_fkart   FOR vbrk-fkart,
so_vbeln   FOR vbrk-vbeln.


AT SELECTION-SCREEN.

  CASE sscrfields-ucomm.
    WHEN 'ONLI'.
      PERFORM form_extract_data.
    WHEN OTHERS.
      MESSAGE s001(00) WITH '' sscrfields-ucomm.
  ENDCASE.

START-OF-SELECTION.
  PERFORM form_show.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  form_so_title
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_SO_FKDAT[]  text
*      &amp;lt;--P_LS_LINE_INFO  text
*----------------------------------------------------------------------*
FORM form_so_title
                    USING itab_so  TYPE ANY TABLE
                    CHANGING
                    it_so
                    p_ls_line_info TYPE slis_entry.

  FIELD-SYMBOLS:
  &amp;lt;fs_low&amp;gt; TYPE ANY, &amp;lt;fs_high&amp;gt; TYPE ANY,
  &amp;lt;fs_option&amp;gt; TYPE ANY, &amp;lt;fs_sign&amp;gt; TYPE ANY.

  DATA comp_low(3) TYPE c VALUE 'LOW'.
  DATA comp_high(4) TYPE c VALUE 'HIGH'.
  DATA comp_sign(4) TYPE c VALUE 'SIGN'.
  DATA comp_option(6) TYPE c VALUE 'OPTION'.

  LOOP AT itab_so INTO it_so.
    EXIT.
  ENDLOOP.
  DATA:
           str_where(255), str_low(10), str_high(10), str_option(50), typ1.

  DATA l_describe TYPE REF TO cl_abap_typedescr.

  ASSIGN COMPONENT comp_low OF STRUCTURE it_so TO &amp;lt;fs_low&amp;gt;.
  ASSIGN COMPONENT comp_high OF STRUCTURE it_so TO &amp;lt;fs_high&amp;gt;.
  ASSIGN COMPONENT comp_sign OF STRUCTURE it_so TO &amp;lt;fs_sign&amp;gt;.
  ASSIGN COMPONENT comp_option OF STRUCTURE it_so TO &amp;lt;fs_option&amp;gt;.

  l_describe = cl_abap_typedescr=&amp;gt;describe_by_data( &amp;lt;fs_low&amp;gt; ).
  typ1 = l_describe-&amp;gt;type_kind.


  IF &amp;lt;fs_high&amp;gt; IS NOT INITIAL
  AND &amp;lt;fs_low&amp;gt; IS NOT INITIAL.
    IF typ1 = 'D'.
      WRITE &amp;lt;fs_low&amp;gt;  TO str_low DD/MM/YYYY.
      WRITE &amp;lt;fs_high&amp;gt; TO str_high DD/MM/YYYY.
    ELSE.
      str_low = &amp;lt;fs_low&amp;gt;.
      str_high = &amp;lt;fs_high&amp;gt;.
    ENDIF.
*     "BT", "NB"
    IF &amp;lt;fs_option&amp;gt; = 'BT'.
      str_option = 'between'.
    ELSEIF &amp;lt;fs_option&amp;gt; = 'NB'.
      str_option = ' not between'.
    ENDIF.

    CONCATENATE  str_option str_low 'and' str_high INTO p_ls_line_info
    SEPARATED BY space.
  ELSEIF &amp;lt;fs_high&amp;gt; IS NOT INITIAL.
    IF typ1 = 'D'.
      WRITE &amp;lt;fs_high&amp;gt; TO p_ls_line_info DD/MM/YYYY.
    ELSE.
      p_ls_line_info = &amp;lt;fs_high&amp;gt;.
    ENDIF.
  ELSEIF &amp;lt;fs_low&amp;gt; IS NOT INITIAL.
*    "EQ", "NE", "GE", "GT", "LE", "LT", "CP" and "NP"

    CASE  &amp;lt;fs_option&amp;gt;.
      WHEN 'EQ'.
        str_option = ''.
      WHEN 'NE'.
        str_option = 'not equal to'.
      WHEN 'GE'.
        str_option = 'greater than or equal to'.
      WHEN 'GT'.
        str_option = 'greater than'.
      WHEN 'LE'.
        str_option = 'less than or equal to'.
      WHEN 'LT'.
        str_option = 'less than'.
      WHEN 'CP'.
        str_option = 'like'.
      WHEN 'NP'.
        str_option = 'not like'.
    ENDCASE.
    IF typ1 = 'D'.
      WRITE &amp;lt;fs_low&amp;gt; TO str_low DD/MM/YYYY.
    ELSE.
      str_low = &amp;lt;fs_low&amp;gt;.
    ENDIF.
    CONCATENATE  str_option str_low INTO p_ls_line_info
       SEPARATED BY space.
  ENDIF.

ENDFORM.                    " form_so_title
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  form_extract_data
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM form_extract_data .
  SELECT SINGLE * FROM vbrk.
  APPEND vbrk TO it_vbrk.
ENDFORM.                    " form_extract_data
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  form_show
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM form_show .
  DATA:
  gt_list_top_of_page TYPE slis_t_listheader,
  wa_gt LIKE LINE OF gt_list_top_of_page.

*"List Header for Top-Of-Page
  PERFORM comment_build USING gt_list_top_of_page[].
  FORMAT COLOR COL_TOTAL.
  LOOP AT gt_list_top_of_page INTO wa_gt.
    FORMAT INTENSIFIED ON.
    WRITE:/ wa_gt-key.
    FORMAT INTENSIFIED OFF.
    WRITE wa_gt-info.
  ENDLOOP.
  FORMAT COLOR OFF.

  FORMAT COLOR COL_KEY.
  LOOP AT it_vbrk INTO vbrk.
    WRITE:/ vbrk-vbeln.
    WRITE vbrk-fkdat.
  ENDLOOP.
  FORMAT COLOR OFF.



ENDFORM.                    " form_show

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  comment_build
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;LT_TOP_OF_PAGE  text
*----------------------------------------------------------------------*
FORM comment_build USING lt_top_of_page TYPE
                                        slis_t_listheader.
  DATA: ls_line TYPE slis_listheader,
         str_select TYPE string,
         str_where(255), str_low(10), str_high(10), str_option(50).


  CLEAR ls_line.
  ls_line-typ  = 'H'.
  ls_line-info = 'SDN BLOG'.
  APPEND ls_line TO lt_top_of_page.

  CLEAR ls_line.
  ls_line-typ  = 'H'.
  ls_line-info = 'Form report'.
  APPEND ls_line TO lt_top_of_page.


  CLEAR ls_line.
  CLEAR str_where.
  ls_line-typ  = 'S'.

  ls_line-key  = 'Report generated on'.
  WRITE sy-datum TO ls_line-info DD/MM/YYYY.
  APPEND ls_line TO lt_top_of_page.




*
  ls_line-key  = 'Billing Date'.
  PERFORM form_so_title USING so_fkdat[]
                        CHANGING so_fkdat ls_line-info.
  APPEND ls_line TO lt_top_of_page.
*

  ls_line-key  = 'Billing No.'.
  CLEAR ls_line-info.
  PERFORM form_so_title USING so_vbeln[]
                        CHANGING so_vbeln ls_line-info.
  APPEND ls_line TO lt_top_of_page.
*
  ls_line-key  = 'Billing Type'.
  CLEAR ls_line-info.
  PERFORM form_so_title USING so_fkart[]
                        CHANGING so_fkart ls_line-info.
  APPEND ls_line TO lt_top_of_page.

ENDFORM.                    "comment_build&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jul 2006 07:58:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-range-table-in-a-subroutine/m-p/1456104#M215610</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-25T07:58:41Z</dc:date>
    </item>
  </channel>
</rss>

