<?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: Problem with external PERFORM in SAPscripts in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320635#M165250</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 got to spend some more time on the code and its now working fine except for couple of issues.&lt;/P&gt;&lt;P&gt;a) when i issue a print the program prints 'N' copies (N = no. of items on the GI). &lt;/P&gt;&lt;P&gt;b) this is my corrected code, here upon on every new rsnum/rspos combination i need to query from resb table. but currently it queries every time. the values in l_old_rsnum and l_old_rspos for some reason is lost when the routine is called the next time. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT zram_test2 .

TABLES resb.

DATA:   mvmt    TYPE mseg-bwart,
        l_rsnum TYPE mseg-rsnum,
        l_rspos TYPE mseg-rspos.

DATA:   req(16) TYPE c,
        out(16) TYPE c,
        isd(16) TYPE c.
*---------------------------------------------------------------------*
*       FORM p_get_qty                                                *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  --&amp;gt;  RSNUM                                                         *
*  --&amp;gt;  RSPOS                                                         *
*---------------------------------------------------------------------*
FORM p_get_qty TABLES input  STRUCTURE itcsy
                      output STRUCTURE itcsy.

  DATA: avlbl TYPE resb-bdmng,
        wa_resb TYPE resb,
        wa_mseg TYPE mseg,
        l_old_rsnum TYPE resb-rsnum,
        l_old_rspos TYPE resb-rspos,
        req_qty TYPE resb-enmng,
        isd_qty TYPE mseg-menge,
        out_qty TYPE resb-enmng,
        c_negative TYPE i VALUE '-1'.

  READ TABLE input WITH KEY 'MSEG-RSNUM'.
  CHECK sy-subrc = 0.
  l_rsnum = input-value.

  READ TABLE input WITH KEY 'MSEG-RSPOS'.
  CHECK sy-subrc = 0.
  l_rspos = input-value.

  CLEAR: isd, req, out.
  READ TABLE input WITH KEY 'MSEG-MENGE'.
  CHECK sy-subrc = 0.
  isd_qty = input-value.

  READ TABLE input WITH KEY 'MSEG-BWART'.
  CHECK sy-subrc = 0.
  mvmt = input-value.


&amp;lt;b&amp;gt;    if ( l_old_rsnum ne l_rsnum  and l_old_rspos ne l_rspos ).
    SELECT SINGLE * INTO wa_resb
                    FROM resb
                    WHERE rsnum = l_rsnum
                    AND   rspos = l_rspos.
    avlbl   = wa_resb-bdmng - wa_resb-enmng.
    req_qty = avlbl - out_qty.
    MOVE l_rsnum TO l_old_rsnum.
    MOVE l_rspos TO l_old_rspos.
  ELSE.
    req_qty = out_qty.
  ENDIF.&amp;lt;/b&amp;gt;

  req = req_qty.
  IF ( mvmt = '201' OR mvmt = '261' OR mvmt = '281' ).
* If GOODS ISSUE
* Outstanding qty is diff of Issued qty &amp;amp; Requirements qty
    out_qty = req_qty - isd_qty.
* Issued qty should be shown with a 'minus' sign
    MULTIPLY isd_qty BY c_negative.
  ELSE.
* If GOODS RETURN
* Outstanding qty is sum of Returned qty &amp;amp; Requirements qty
    out_qty = req_qty + isd_qty.
  ENDIF.
  isd = isd_qty.
  out = out_qty.

  output-name = 'REQ_QTY'.
  output-value = req.
  MODIFY output INDEX 1.

  output-name = 'ISD_QTY'.
  output-value = isd.
  MODIFY output INDEX 2.

  output-name = 'OUT_QTY'.
  output-value = out.
  MODIFY output INDEX 3.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 May 2006 00:46:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-05-18T00:46:17Z</dc:date>
    <item>
      <title>Problem with external PERFORM in SAPscripts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320629#M165244</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;In my custom form, i have the following code in MAIN window. This external routine call has to fetch certain fields for each line item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do see in my print that each line item carry diff values for RSNUM &amp;amp; RSPOS. For some reason i believe this PERFORM is either executed only once or it is passing the values of item1 and hence its value gets copied on to other items. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is my routine to be shifted place ? or some other reason......Appreciate help on same.Thanks!&lt;/P&gt;&lt;P&gt;/E   POS_ZEILE                                                &lt;/P&gt;&lt;P&gt;/:   PERFORM P_GET_QTY IN PROGRAM ZRAM_TEST2                       &lt;/P&gt;&lt;P&gt;/:   USING &amp;amp;MSEG-RSNUM&amp;amp;                                            &lt;/P&gt;&lt;P&gt;/:   USING &amp;amp;MSEG-RSPOS&amp;amp;                                            &lt;/P&gt;&lt;P&gt;/:   USING &amp;amp;MSEG-MENGE&amp;amp;                                            &lt;/P&gt;&lt;P&gt;/:   USING &amp;amp;MSEG-BWART&amp;amp;                                            &lt;/P&gt;&lt;P&gt;/:   CHANGING &amp;amp;REQ_QTY&amp;amp;                                            &lt;/P&gt;&lt;P&gt;/:   CHANGING &amp;amp;ISD_QTY&amp;amp;                                            &lt;/P&gt;&lt;P&gt;/:   CHANGING &amp;amp;OUT_QTY&amp;amp;                                            &lt;/P&gt;&lt;P&gt;/:   ENDPERFORM                                               &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/:   PROTECT      &lt;/P&gt;&lt;P&gt;L    &amp;amp;MSEG-ZEILE&amp;amp;,,&amp;amp;MSEG-MATNR&amp;amp;,,&amp;amp;MABDR-MAKTX(28)&amp;amp;,,&amp;amp;MSEG-LGORT&amp;amp;/  &lt;/P&gt;&lt;P&gt;=    &amp;amp;MABDR-LGPBE&amp;amp;,,   &amp;amp;MSEG-CHARG&amp;amp; &amp;amp;MSEG-RSNUM&amp;amp; &amp;amp;MSEG-RSPOS&amp;amp;      &lt;/P&gt;&lt;P&gt;L3   ,,&amp;amp;REQ_QTY&amp;amp;,,&amp;lt;b&amp;gt;&amp;amp;ISD_QTY&amp;amp;&amp;lt;/&amp;gt;,,&amp;amp;OUT_QTY&amp;amp;&lt;/P&gt;&lt;P&gt;/:   ENDPROTECT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 16:32:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320629#M165244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-17T16:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with external PERFORM in SAPscripts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320630#M165245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please do check whether you are correctly clearing the variables being passed after they have been used. There could be a disconnect there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 16:37:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320630#M165245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-17T16:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with external PERFORM in SAPscripts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320631#M165246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can we see the corresponding code in your ABAP program?&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>Wed, 17 May 2006 16:39:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320631#M165246</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-05-17T16:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with external PERFORM in SAPscripts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320632#M165247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anand,&lt;/P&gt;&lt;P&gt;Following is my code for the FORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM p_get_qty TABLES input  STRUCTURE itcsy&lt;/P&gt;&lt;P&gt;                      output STRUCTURE itcsy.&lt;/P&gt;&lt;P&gt;  DATA: avlbl TYPE resb-bdmng,&lt;/P&gt;&lt;P&gt;        wa_resb TYPE resb,&lt;/P&gt;&lt;P&gt;        req(16) TYPE c,&lt;/P&gt;&lt;P&gt;        out(16) TYPE c,&lt;/P&gt;&lt;P&gt;        isd(16) TYPE c,&lt;/P&gt;&lt;P&gt;        c_negative TYPE i VALUE '-1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_resb-rsnum.&lt;/P&gt;&lt;P&gt;  READ TABLE input WITH KEY 'MSEG-RSNUM'.&lt;/P&gt;&lt;P&gt;  CHECK sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  wa_resb-rsnum = input-value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_resb-rspos.&lt;/P&gt;&lt;P&gt;  READ TABLE input WITH KEY 'MSEG-RSPOS'.&lt;/P&gt;&lt;P&gt;  CHECK sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  wa_resb-rspos = input-value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  READ TABLE input WITH KEY 'MSEG-MENGE'.&lt;/P&gt;&lt;P&gt;  CHECK sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  isd_qty = input-value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  READ TABLE input WITH KEY 'MSEG-BWART'.&lt;/P&gt;&lt;P&gt;  CHECK sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  mvmt = input-value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF l_old_rsnum NE wa_resb-rsnum AND l_old_rspos NE wa_resb-rspos.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT SINGLE * INTO wa_resb&lt;/P&gt;&lt;P&gt;                  FROM resb&lt;/P&gt;&lt;P&gt;                  WHERE rsnum = wa_resb-rsnum&lt;/P&gt;&lt;P&gt;                  AND   rspos = wa_resb-rspos.&lt;/P&gt;&lt;P&gt;  CHECK sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  avlbl   = wa_resb-bdmng - wa_resb-enmng.&lt;/P&gt;&lt;P&gt;  req_qty = avlbl - out_qty.&lt;/P&gt;&lt;P&gt;  l_old_rsnum = wa_resb-rsnum.&lt;/P&gt;&lt;P&gt;  l_old_rspos = wa_resb-rspos.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    req_qty = out_qty.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;    out_qty = req_qty - isd_qty.&lt;/P&gt;&lt;P&gt;  req = req_qty.&lt;/P&gt;&lt;P&gt;  isd = isd_qty.&lt;/P&gt;&lt;P&gt;  out = out_qty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  output-name = 'REQ_QTY'.&lt;/P&gt;&lt;P&gt;  output-value = req.&lt;/P&gt;&lt;P&gt;  MODIFY output INDEX 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  output-name = 'ISD_QTY'.&lt;/P&gt;&lt;P&gt;  output-value = isd.&lt;/P&gt;&lt;P&gt;  MODIFY output INDEX 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  output-name = 'OUT_QTY'.&lt;/P&gt;&lt;P&gt;  output-value = out.&lt;/P&gt;&lt;P&gt;  MODIFY output INDEX 3.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 16:43:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320632#M165247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-17T16:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with external PERFORM in SAPscripts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320633#M165248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can we see the code around the WRITE_FORM for the POS_ZEILE  element?&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>Wed, 17 May 2006 16:51:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320633#M165248</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-05-17T16:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with external PERFORM in SAPscripts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320634#M165249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The print program is standard one. SAPM07DR -&amp;gt;Include M07DRA03-&amp;gt;FORM WA03_AUSGABE using lgortsplit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 17:03:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320634#M165249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-17T17:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with external PERFORM in SAPscripts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320635#M165250</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 got to spend some more time on the code and its now working fine except for couple of issues.&lt;/P&gt;&lt;P&gt;a) when i issue a print the program prints 'N' copies (N = no. of items on the GI). &lt;/P&gt;&lt;P&gt;b) this is my corrected code, here upon on every new rsnum/rspos combination i need to query from resb table. but currently it queries every time. the values in l_old_rsnum and l_old_rspos for some reason is lost when the routine is called the next time. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT zram_test2 .

TABLES resb.

DATA:   mvmt    TYPE mseg-bwart,
        l_rsnum TYPE mseg-rsnum,
        l_rspos TYPE mseg-rspos.

DATA:   req(16) TYPE c,
        out(16) TYPE c,
        isd(16) TYPE c.
*---------------------------------------------------------------------*
*       FORM p_get_qty                                                *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  --&amp;gt;  RSNUM                                                         *
*  --&amp;gt;  RSPOS                                                         *
*---------------------------------------------------------------------*
FORM p_get_qty TABLES input  STRUCTURE itcsy
                      output STRUCTURE itcsy.

  DATA: avlbl TYPE resb-bdmng,
        wa_resb TYPE resb,
        wa_mseg TYPE mseg,
        l_old_rsnum TYPE resb-rsnum,
        l_old_rspos TYPE resb-rspos,
        req_qty TYPE resb-enmng,
        isd_qty TYPE mseg-menge,
        out_qty TYPE resb-enmng,
        c_negative TYPE i VALUE '-1'.

  READ TABLE input WITH KEY 'MSEG-RSNUM'.
  CHECK sy-subrc = 0.
  l_rsnum = input-value.

  READ TABLE input WITH KEY 'MSEG-RSPOS'.
  CHECK sy-subrc = 0.
  l_rspos = input-value.

  CLEAR: isd, req, out.
  READ TABLE input WITH KEY 'MSEG-MENGE'.
  CHECK sy-subrc = 0.
  isd_qty = input-value.

  READ TABLE input WITH KEY 'MSEG-BWART'.
  CHECK sy-subrc = 0.
  mvmt = input-value.


&amp;lt;b&amp;gt;    if ( l_old_rsnum ne l_rsnum  and l_old_rspos ne l_rspos ).
    SELECT SINGLE * INTO wa_resb
                    FROM resb
                    WHERE rsnum = l_rsnum
                    AND   rspos = l_rspos.
    avlbl   = wa_resb-bdmng - wa_resb-enmng.
    req_qty = avlbl - out_qty.
    MOVE l_rsnum TO l_old_rsnum.
    MOVE l_rspos TO l_old_rspos.
  ELSE.
    req_qty = out_qty.
  ENDIF.&amp;lt;/b&amp;gt;

  req = req_qty.
  IF ( mvmt = '201' OR mvmt = '261' OR mvmt = '281' ).
* If GOODS ISSUE
* Outstanding qty is diff of Issued qty &amp;amp; Requirements qty
    out_qty = req_qty - isd_qty.
* Issued qty should be shown with a 'minus' sign
    MULTIPLY isd_qty BY c_negative.
  ELSE.
* If GOODS RETURN
* Outstanding qty is sum of Returned qty &amp;amp; Requirements qty
    out_qty = req_qty + isd_qty.
  ENDIF.
  isd = isd_qty.
  out = out_qty.

  output-name = 'REQ_QTY'.
  output-value = req.
  MODIFY output INDEX 1.

  output-name = 'ISD_QTY'.
  output-value = isd.
  MODIFY output INDEX 2.

  output-name = 'OUT_QTY'.
  output-value = out.
  MODIFY output INDEX 3.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 May 2006 00:46:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-external-perform-in-sapscripts/m-p/1320635#M165250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-18T00:46:17Z</dc:date>
    </item>
  </channel>
</rss>

