<?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: Adding in Select statement for SAPscript printout in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298763#M157685</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again, sorry for the late reply on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm still not really sure if i understood properly on this. However, this is what i have written so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my SAPscript, i write:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PERFORM GET_MATNR IN PROGRAM ZLMMSS006
USING &amp;amp;EBELN&amp;amp; &amp;amp;EBELP&amp;amp;
CHANGING &amp;amp;W_MATNR&amp;amp;
ENDPERFORM
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in my Program ZLMMSS006, i write:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM GET_MATNR TABLE  IN_TAB STRUCTURE ITCSY
                     OUT_TAB STRUCTURE ITCSY.

DATA: RSNUM LIKE EKET-RSNUM,
      MATNR LIKE RESB-MATNR.

SELECT SINGLE RSNUM
INTO RSNUM
FROM EKET
WHERE EBELN = EBELN AND
      EBELP = EBELP.

SELECT MATNR
INTO MATNR
FROM RESB
WHERE RSNUM = RSNUM.

MATNR = OUT_TAB.

ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that what's up there is most likely wrong, but i'd like to know what do i need to change&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Bernard Loh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 May 2006 06:40:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-05-22T06:40:26Z</dc:date>
    <item>
      <title>Adding in Select statement for SAPscript printout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298758#M157680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a new requirement where i would need to output a new field in a sapscript printout.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
A summary of the requirements is as follows:
-&amp;gt; If EKPO-PSTYP = '3'
   -&amp;gt; select RSNUM
      from EKET
      where EKET-EBELN = EKPO-EBELN and
            EKET-EBELP = EKPO-EBELP
   -&amp;gt; select MATNR
      from RESB
      where RESB-RSNUM = EKET-RSNUM
   -&amp;gt; display RESB-MATNR in printout
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;At the moment, the sapscript is only reading from table EKPO, whereas for the new requirement to work, i'll also need to read from table EKET and RESB. Am i right to understand that sapscript cannot read SELECT statements directly from the Change Editor and i would need to do a PERFORM statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The question now is, where do i put this part of the logic? Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Bernard Loh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 01:53:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298758#M157680</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-17T01:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Adding in Select statement for SAPscript printout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298759#M157681</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;Just write the logic of ur selection in the driver program  same as the previous logic u r performing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just take the field what u want fro that select statement and pass it to the sapscript.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't be confused about it..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Simha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 02:48:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298759#M157681</guid>
      <dc:creator>Simha_</dc:creator>
      <dc:date>2006-05-17T02:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding in Select statement for SAPscript printout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298760#M157682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for you reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, that was my original intention, however, i was informed by my superior to avoid amending the driver program, since it is SAP standard. Therefore, it was suggested to me to do a PERFORM statement instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i would like to know how to do it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 04:17:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298760#M157682</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-17T04:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Adding in Select statement for SAPscript printout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298761#M157683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi bernard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can write your perform statement in your sapscript as in normal program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or you can refer to this link in this data is retrieved without modification in driver program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/ts010.htm" target="test_blank"&gt;http://www.sap-img.com/ts010.htm&lt;/A&gt;&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;Sumit Bhutani&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ps reward points if helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 04:28:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298761#M157683</guid>
      <dc:creator>sbhutani1</dc:creator>
      <dc:date>2006-05-17T04:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adding in Select statement for SAPscript printout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298762#M157684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; Write a PERFORM in your script.&lt;/P&gt;&lt;P&gt;  PERFORM GET_MATNR IN PROGRAM Z_SUBROTINEPOOL&lt;/P&gt;&lt;P&gt;                    USING W_EBELN W_EBELP&lt;/P&gt;&lt;P&gt;                    CHANGING W_MATNR &lt;/P&gt;&lt;P&gt;  ENDPERFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  And check the following to write the FORM in the Z program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The structure ITCSY is used in relation with SAPScripts. You can call a Routine in any program in SAPScript.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg: if you have a subroutine named ADD_INCOME in a program ZSHAIL_BASIC, you can call the subroutine in SAPScript as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/: PERFORM ADD_INCOME IN PROGRAM ZSHAIL_BASIC&lt;/P&gt;&lt;P&gt;/: USING &amp;amp;var1&amp;amp;&lt;/P&gt;&lt;P&gt;/: CHANGING &amp;amp;var2&amp;amp;&lt;/P&gt;&lt;P&gt;/: ENDPERFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the input parameter to the subroutine is var1 and the value returned by the subroutine is var2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the program ZSHAIL_BASIC, you have to call the subroutine as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM ADD_INCOME TABLES IN_TAB STRUCTURE ITCSY OUT_TAB STRUCTURE ITCSY.&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;IN_TAB is a structure of type ITCSY,which has 2 components, NAME and value.&lt;/P&gt;&lt;P&gt;So in the program, var1(which is sent from SAPScript) , will be stored as IN_TAB-NAME and its value will be in IN_TAB-VALUE. You can utilise the IN_TAB-VALUE and after performing the required operations, the return value should be assigned to table OUT_TAB.&lt;/P&gt;&lt;P&gt;This value can thus be obtained in var2 specified in SAPScript.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Also you can search for "SUBROUTINE IN SCRIPT"... "PERFORM IN SCRIPT", "ITCSY"....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Bharat Kumar Reddy.V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 04:28:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298762#M157684</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-17T04:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adding in Select statement for SAPscript printout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298763#M157685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again, sorry for the late reply on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm still not really sure if i understood properly on this. However, this is what i have written so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my SAPscript, i write:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PERFORM GET_MATNR IN PROGRAM ZLMMSS006
USING &amp;amp;EBELN&amp;amp; &amp;amp;EBELP&amp;amp;
CHANGING &amp;amp;W_MATNR&amp;amp;
ENDPERFORM
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in my Program ZLMMSS006, i write:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM GET_MATNR TABLE  IN_TAB STRUCTURE ITCSY
                     OUT_TAB STRUCTURE ITCSY.

DATA: RSNUM LIKE EKET-RSNUM,
      MATNR LIKE RESB-MATNR.

SELECT SINGLE RSNUM
INTO RSNUM
FROM EKET
WHERE EBELN = EBELN AND
      EBELP = EBELP.

SELECT MATNR
INTO MATNR
FROM RESB
WHERE RSNUM = RSNUM.

MATNR = OUT_TAB.

ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that what's up there is most likely wrong, but i'd like to know what do i need to change&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Bernard Loh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2006 06:40:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-in-select-statement-for-sapscript-printout/m-p/1298763#M157685</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-22T06:40:26Z</dc:date>
    </item>
  </channel>
</rss>

