<?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: Sapscript External Subroutine in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139318#M114049</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Varun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your issue is not yet resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your external routine program Please define your "CH" as mentioned below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;data : ch(1) type c.&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT Z_V_SCRIPT_SR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM z_v_script TABLES IN_PAR STrUCTURE ITCSY&lt;/P&gt;&lt;P&gt;OUT_PAR STRUCTURE ITCSY.&lt;/P&gt;&lt;P&gt;data : cntr type i value -1.&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;data : ch(3) type c.&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;read table in_par with key 'COUNTER'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;cntr = in_par-value.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cntr = cntr + 1.&lt;/P&gt;&lt;P&gt;ch = cntr.&lt;/P&gt;&lt;P&gt;read table out_par with key 'COUNTER'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;out_par-value = ch.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script Code :&lt;/P&gt;&lt;P&gt;/: BOX FRAME 10 TW&lt;/P&gt;&lt;P&gt;/E MAIN&lt;/P&gt;&lt;P&gt;p3 &amp;amp;spaces(3)&amp;amp;&amp;amp;itab-carrid&amp;amp; &amp;amp;spaces(35)&amp;amp; &amp;amp;itab-connid&amp;amp;&lt;/P&gt;&lt;P&gt;= &amp;amp;spaces(25)&amp;amp;&amp;amp;itab-fldate&amp;amp;&lt;/P&gt;&lt;P&gt;/: PERFORM Z_V_SCRIPT IN PROGRAM Z_V_SCRIPT_SR&lt;/P&gt;&lt;P&gt;/: USING &amp;amp;COUNTER&amp;amp;&lt;/P&gt;&lt;P&gt;/: CHANGING &amp;amp;COUNTER&amp;amp;&lt;/P&gt;&lt;P&gt;/: ENDPERFORM&lt;/P&gt;&lt;P&gt;/: IF &amp;amp;COUNTER&amp;amp; EQ '1'&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;/: &amp;amp;ULINE(45)&amp;amp;&amp;lt;/u&amp;gt;/&lt;/P&gt;&lt;P&gt;: DEFINE &amp;amp;COUNTER&amp;amp; = 0&lt;/P&gt;&lt;P&gt;/: endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change &amp;lt;u&amp;gt;/: &amp;amp;ULINE(45)&amp;amp;&amp;lt;/u&amp;gt;/  to PD &amp;amp;ULINE(45)&amp;amp;.&lt;/P&gt;&lt;P&gt;                            PD : paragraph format or default use '*'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tested with your earlier code and it is working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lanka&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Lanka Murthy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Feb 2006 00:06:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-02-02T00:06:15Z</dc:date>
    <item>
      <title>Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139314#M114045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While caling the external subroutine from sapscript &lt;/P&gt;&lt;P&gt;1) what should be the data type of using and changing    parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Can't I write the perform statement as&lt;/P&gt;&lt;P&gt;/: perform &amp;lt;form&amp;gt; in program &amp;lt;prog&amp;gt;&lt;/P&gt;&lt;P&gt;/: changing &amp;amp;outparam&amp;amp;&lt;/P&gt;&lt;P&gt;/: endperform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)MODIFY OUT_PAR INDEX SY-TABIX.&lt;/P&gt;&lt;P&gt;what does the above statement mean. It is taken from sap documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The form definition is :&lt;/P&gt;&lt;P&gt;FORM &amp;lt;form&amp;gt; TABLES OUT_TAB STRUCTURE ITCSY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I defined a variable num of type i in print program.&lt;/P&gt;&lt;P&gt;I used in changing parameter in external subroutine.&lt;/P&gt;&lt;P&gt;But when I debug the script and program the value of num is not updated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Varun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2006 23:56:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139314#M114045</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-01T23:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139315#M114046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume that this is related to &lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="105271"&gt;&lt;/A&gt;.  Did these answers not help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:00:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139315#M114046</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-02T00:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139316#M114047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;i&amp;gt;1) what should be the data type of using and changing parameters.&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;There is no data type in the USING and CHANGING inside the sapscript.  They must be defined as you have done in the print program, STRUCTURE ITCSY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;2) Can't I write the perform statement as&lt;/P&gt;&lt;P&gt;/: perform &amp;lt;form&amp;gt; in program &amp;lt;prog&amp;gt;&lt;/P&gt;&lt;P&gt;/: changing &amp;amp;outparam&amp;amp;&lt;/P&gt;&lt;P&gt;/: endperform.&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, this is how to right it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;3)MODIFY OUT_PAR INDEX SY-TABIX.&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;This means that it is modify the row of OUT_PAR.  The row is = whatever sy-tabix is at the time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:03:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139316#M114047</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-02T00:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139317#M114048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried all the ways mentioned in that thread but still I am not able to resolve the issue.They all suggested me different ways but the method involving external subroutine did not work. I am just trying to achieve it using external subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Varun.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:03:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139317#M114048</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-02T00:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139318#M114049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Varun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your issue is not yet resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your external routine program Please define your "CH" as mentioned below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;data : ch(1) type c.&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT Z_V_SCRIPT_SR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM z_v_script TABLES IN_PAR STrUCTURE ITCSY&lt;/P&gt;&lt;P&gt;OUT_PAR STRUCTURE ITCSY.&lt;/P&gt;&lt;P&gt;data : cntr type i value -1.&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;data : ch(3) type c.&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;read table in_par with key 'COUNTER'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;cntr = in_par-value.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cntr = cntr + 1.&lt;/P&gt;&lt;P&gt;ch = cntr.&lt;/P&gt;&lt;P&gt;read table out_par with key 'COUNTER'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;out_par-value = ch.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script Code :&lt;/P&gt;&lt;P&gt;/: BOX FRAME 10 TW&lt;/P&gt;&lt;P&gt;/E MAIN&lt;/P&gt;&lt;P&gt;p3 &amp;amp;spaces(3)&amp;amp;&amp;amp;itab-carrid&amp;amp; &amp;amp;spaces(35)&amp;amp; &amp;amp;itab-connid&amp;amp;&lt;/P&gt;&lt;P&gt;= &amp;amp;spaces(25)&amp;amp;&amp;amp;itab-fldate&amp;amp;&lt;/P&gt;&lt;P&gt;/: PERFORM Z_V_SCRIPT IN PROGRAM Z_V_SCRIPT_SR&lt;/P&gt;&lt;P&gt;/: USING &amp;amp;COUNTER&amp;amp;&lt;/P&gt;&lt;P&gt;/: CHANGING &amp;amp;COUNTER&amp;amp;&lt;/P&gt;&lt;P&gt;/: ENDPERFORM&lt;/P&gt;&lt;P&gt;/: IF &amp;amp;COUNTER&amp;amp; EQ '1'&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;/: &amp;amp;ULINE(45)&amp;amp;&amp;lt;/u&amp;gt;/&lt;/P&gt;&lt;P&gt;: DEFINE &amp;amp;COUNTER&amp;amp; = 0&lt;/P&gt;&lt;P&gt;/: endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change &amp;lt;u&amp;gt;/: &amp;amp;ULINE(45)&amp;amp;&amp;lt;/u&amp;gt;/  to PD &amp;amp;ULINE(45)&amp;amp;.&lt;/P&gt;&lt;P&gt;                            PD : paragraph format or default use '*'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tested with your earlier code and it is working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lanka&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Lanka Murthy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:06:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139318#M114049</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-02T00:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139319#M114050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lanka, is really pushing for you to do as suggested.  I'm not really sure about it because what if your counter goes more than 9,  CH will not be big enough to hold 10.  This really isn't as difficult as we are making it seem.  &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;  I usually try to stay away from having PERFORMs in my sapscript.  I like to handle everything in one place, meaning the print program.  I would suggest trying to implement your counter in the print program and remove the PERFORM from the sapscript.  If not, we can struggle thru this.  &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:11:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139319#M114050</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-02T00:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139320#M114051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you defined....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : cntr type i value -1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;outside of the form, somewhere in the top of the program.  If not, this field will never be more than 0.  The reason for this is because having defined it in the PERFORM,  it is local, therefore everytime you call the FORM, it will be starting from -1.  In the FORM, when you add 1 to it, it will be 0, never more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:13:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139320#M114051</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-02T00:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139321#M114052</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;Rich Apologies for that. I just want to convey that Varun's code is OK to use. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a common practice that to use external routine (By using and Changing) in SAP script. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes You are correct if the Counter is more than 10 it wont work. But in his code he is checking IF Counter EQ 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought he will always check COUNTER EQ 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lanka&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:18:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139321#M114052</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-02T00:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139322#M114053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lanka, I agree totally.  I was just concern about the 1 character field.  &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Varun, when debugging is the value being set to "1"?  If it will always be "1", then try as Lanka has suggested and make it as 1 character field.  There may be a problem when the sapscript is looking for "1" and the value is coming as "SPACE SPACE  1" or something like that.  Not really sure since I have not debugged it myself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:23:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139322#M114053</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-02T00:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139323#M114054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see Varun's code he is moving Numeric to CH(3) . I think this may be storing in CH.&lt;/P&gt;&lt;P&gt;Example : If Counter is 1 and moved to CH.&lt;/P&gt;&lt;P&gt;It stored in CH as " space space 1".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When in Script if you are using &lt;/P&gt;&lt;P&gt;IF &amp;amp;COUNTER&amp;amp; (Here Counter is of type "CH"  ) EQ '1' --This statement is failing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Rich correctly mentioned &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   -- No need to define data type "CH".&lt;/P&gt;&lt;P&gt;Just change the counter and pass it to OUT_TAB. This will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : cntr type i value -1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table in_par with key 'COUNTER'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;cntr = in_par-value.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cntr = cntr + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table out_par with key 'COUNTER'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;out_par-value = cntr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modiffy OUT_PAR index sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Correct me if I am wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lanka&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:33:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139323#M114054</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-02T00:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139324#M114055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can I join in too? &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How about this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your SAPscript layout set&lt;/P&gt;&lt;P&gt;ABOVE all of the TEXT ELEMENTs in the MAIN window&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/:  DEFINE &amp;amp;COUNTER&amp;amp; = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the section of SAPscript where you need to increment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/: PERFORM Z_V_SCRIPT IN PROGRAM Z_V_SCRIPT_SR&lt;/P&gt;&lt;P&gt;/: USING &amp;amp;COUNTER&amp;amp;&lt;/P&gt;&lt;P&gt;/: CHANGING &amp;amp;COUNTER&amp;amp;&lt;/P&gt;&lt;P&gt;/: ENDPERFORM&lt;/P&gt;&lt;P&gt;/: IF &amp;amp;COUNTER&amp;amp; = '001'&lt;/P&gt;&lt;P&gt;/  &amp;amp;ULINE(45)&amp;amp;&lt;/P&gt;&lt;P&gt;/: DEFINE &amp;amp;COUNTER&amp;amp; = 0&lt;/P&gt;&lt;P&gt;/: ENDIF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the ABAP...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM Z_V_SCRIPT tables table_in  structure itcsy&lt;/P&gt;&lt;P&gt;                       table_out  structure itcsy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: lv_counter(3)   type n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE TABLE_IN WITH KEY NAME = 'COUNTER'.&lt;/P&gt;&lt;P&gt;CHECK SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;LV_COUNTER = TABLE_IN-VALUE.&lt;/P&gt;&lt;P&gt;LV_COUNTER = LV_COUNTER + '1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE TABLE_OUT WITH KEY NAME = 'COUNTER'.&lt;/P&gt;&lt;P&gt;CHECK SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;TABLE_OUT-VALUE = LV_COUNTER.&lt;/P&gt;&lt;P&gt;SHIFT TABLE_OUT-VALUE LEFT DELETING LEADING SPACE.&lt;/P&gt;&lt;P&gt;MODIFY TABLE_OUT INDEX SY-TABIX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... though I have no idea why you want to increment a counter by 1 and then set it to 0 again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:38:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139324#M114055</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-02T00:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139325#M114056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for joining Norman,  I did assume that the DEFINE statement was somewhere in the script.  Again, I'm not really familiar about PERFORMs in sapscripts, but I was thinking that the DEFINE statement should be present?  is this correct assumption?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lanka,  I was thinking the same in my eariler post,  you can't see that I was mentioning the SPACE SPACE 1 very good because it goes from 1 line to the next.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:47:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139325#M114056</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-02T00:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139326#M114057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for Norman for Joining.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rich and my self  suggesting as Change the counter from IN_TAB and use the same in OUT_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lanka&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:50:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139326#M114057</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-02T00:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Sapscript External Subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139327#M114058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't really have to specify the DEFINE first.  If it's not there, it will pass a space in the first PERFORM call.  I usually define variables for PERFORMs in MAIN above the text elements to initialize them.  If you don't and are printing multiple copies of the form, the variable could get held from one copy to another.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I've had problems like this, it was usually related to leading spaces when the value gets passed back to the layout set.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2006 00:55:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sapscript-external-subroutine/m-p/1139327#M114058</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-02T00:55:15Z</dc:date>
    </item>
  </channel>
</rss>

