<?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: subroutine in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1984441#M402125</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is an example using your code and passing parameters to the FORM (or you could just make the variables global):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  DATA: v_1 TYPE STRING,
        v_2 TYPE STRING,
        v_3 TYPE STRING.

  v_1 = '14.8KG g'.

  PERFORM F_FORM USING v_1 v_2 v_3.

  Write:/ v_2, v_3.
*---------------------------------------------------------------------*
*       FORM F_FORM                                                   *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  --&amp;gt;  V_STRING1                                                     *
*  --&amp;gt;  V_STRING2                                                     *
*  --&amp;gt;  V_STRING3                                                     *
*---------------------------------------------------------------------*
FORM F_FORM USING v_string1 v_string2 v_string3.
  data: str type string.
  data: p1 type string.
  data: p2 type string.
  data: offset type i.
  data: len type i.
  data: lowercase type sy-abcde.

  lowercase = sy-abcde.
  translate lowercase to LOWER CASE.

*  str = '14.8KG g'.
  str = V_STRING1.

  TRANSLATE str using ' %'.
  len = strlen( str ).
  len = len - 1.

  do len times.

    offset = offset + 1.
    if str+offset(1) ca '0123456789.'.
      concatenate p1 str+offset(1) into p1.
    elseif ( str+offset(1) ca sy-abcde
    or str+offset(1) ca lowercase
    or str+offset(1) = '%' ).
      concatenate p2 str+offset(1) into p2.
    endif.

  enddo.

  TRANSLATE p2 using '% '.

*  write:/ p1, p2.
   v_string2 = p1.
   v_string3 = p2.

ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Feb 2007 19:48:38 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-19T19:48:38Z</dc:date>
    <item>
      <title>subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1984439#M402123</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 am trying to do the following code into a form.&lt;/P&gt;&lt;P&gt;I must send a single field F while calling a form in the main program...&lt;/P&gt;&lt;P&gt;I must get it into 2 fields p1 &amp;amp; p2.&lt;/P&gt;&lt;P&gt;How I do I write the perform&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;data: str type string.&lt;/P&gt;&lt;P&gt;data: p1 type string.&lt;/P&gt;&lt;P&gt;data: p2 type string.&lt;/P&gt;&lt;P&gt;data: offset type i.&lt;/P&gt;&lt;P&gt;data: len type i.&lt;/P&gt;&lt;P&gt;data: lowercase type sy-abcde.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;lowercase = sy-abcde.&lt;/P&gt;&lt;P&gt;translate lowercase to LOWER CASE.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;str = '14.8KG g'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;TRANSLATE str using ' %'.&lt;/P&gt;&lt;P&gt;len = strlen( str ).&lt;/P&gt;&lt;P&gt;len = len - 1.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;do len times.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  offset = offset + 1.&lt;/P&gt;&lt;P&gt;  if str+offset(1) ca '0123456789.'.&lt;/P&gt;&lt;P&gt;    concatenate p1 str+offset(1) into p1.&lt;/P&gt;&lt;P&gt;  elseif ( str+offset(1) ca sy-abcde&lt;/P&gt;&lt;P&gt;        or str+offset(1) ca lowercase&lt;/P&gt;&lt;P&gt;        or str+offset(1) = '%' ).&lt;/P&gt;&lt;P&gt;      concatenate p2 str+offset(1) into p2.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;TRANSLATE p2 using '% '.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;write:/ p1, p2.&lt;/P&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 19:37:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1984439#M402123</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T19:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1984440#M402124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use following:&lt;/P&gt;&lt;P&gt;PERFORM  &amp;lt;performname&amp;gt; USING &amp;lt;var1&amp;gt; &amp;lt;var2&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, i think formal and actual parameters must be same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 19:42:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1984440#M402124</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T19:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1984441#M402125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is an example using your code and passing parameters to the FORM (or you could just make the variables global):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  DATA: v_1 TYPE STRING,
        v_2 TYPE STRING,
        v_3 TYPE STRING.

  v_1 = '14.8KG g'.

  PERFORM F_FORM USING v_1 v_2 v_3.

  Write:/ v_2, v_3.
*---------------------------------------------------------------------*
*       FORM F_FORM                                                   *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  --&amp;gt;  V_STRING1                                                     *
*  --&amp;gt;  V_STRING2                                                     *
*  --&amp;gt;  V_STRING3                                                     *
*---------------------------------------------------------------------*
FORM F_FORM USING v_string1 v_string2 v_string3.
  data: str type string.
  data: p1 type string.
  data: p2 type string.
  data: offset type i.
  data: len type i.
  data: lowercase type sy-abcde.

  lowercase = sy-abcde.
  translate lowercase to LOWER CASE.

*  str = '14.8KG g'.
  str = V_STRING1.

  TRANSLATE str using ' %'.
  len = strlen( str ).
  len = len - 1.

  do len times.

    offset = offset + 1.
    if str+offset(1) ca '0123456789.'.
      concatenate p1 str+offset(1) into p1.
    elseif ( str+offset(1) ca sy-abcde
    or str+offset(1) ca lowercase
    or str+offset(1) = '%' ).
      concatenate p2 str+offset(1) into p2.
    endif.

  enddo.

  TRANSLATE p2 using '% '.

*  write:/ p1, p2.
   v_string2 = p1.
   v_string3 = p2.

ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 19:48:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1984441#M402125</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T19:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1984442#M402126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Nagel !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 20:01:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1984442#M402126</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T20:01:28Z</dc:date>
    </item>
  </channel>
</rss>

