<?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 problem to make a common perform in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678043#M1449138</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;          i have code as given below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : ist_temp2  TYPE TABLE OF ZT_temp ,
          ist_temp2  type table of zt_temp .

APPEND wa_ist_temp TO ist_temp.
APPEND wa_ist_so_details TO ist_so_details.

PERFORM get_so_char_pri.
FORM get_so_char_pri .
    IF NOT ist_temp[] IS INITIAL.
    wa_ist_chars-atnam = gd_atinn.
    APPEND wa_ist_chars TO ist_chars.

      LOOP AT ist_temp ASSIGNING &amp;lt;gs_ist_temp&amp;gt;.
        ld_tabix = sy-tabix.
        READ TABLE ist_var_chars ASSIGNING &amp;lt;gs_ist_var_chars&amp;gt;
                                 WITH KEY    vbeln = &amp;lt;gs_ist_temp&amp;gt;-vbeln
                                             posnr = &amp;lt;gs_ist_temp&amp;gt;-posnr
                                 BINARY SEARCH.
        IF sy-subrc EQ 0.
          &amp;lt;gs_ist_temp&amp;gt;-atwrt = &amp;lt;gs_ist_var_chars&amp;gt;-atwrt.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDIF.
endform .
APPEND wa_ist_temp2 TO ist_temp2.

PERFORM get_so_char_alt.

FORM get_so_char_alt .
 
    
    IF NOT ist_var_chars[] IS INITIAL.
      SORT ist_var_chars BY vbeln posnr.

*     Loop at table to modify the characteristic value
      LOOP AT ist_temp2 ASSIGNING &amp;lt;gs_ist_temp2&amp;gt;.
        READ TABLE ist_var_chars ASSIGNING &amp;lt;gs_ist_var_chars&amp;gt;
                                  WITH KEY vbeln = &amp;lt;gs_ist_temp2&amp;gt;-vbeln
                                           posnr = &amp;lt;gs_ist_temp2&amp;gt;-posnr.
        IF sy-subrc EQ 0.
          &amp;lt;gs_ist_temp2&amp;gt;-atwrt = &amp;lt;gs_ist_var_chars&amp;gt;-atwrt.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDIF.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to make this both performs common how  can i do it ?&lt;/P&gt;&lt;P&gt;Plz help ... i cant use passing internal table as everything is global .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Mar 2010 10:01:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-15T10:01:52Z</dc:date>
    <item>
      <title>problem to make a common perform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678043#M1449138</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;          i have code as given below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : ist_temp2  TYPE TABLE OF ZT_temp ,
          ist_temp2  type table of zt_temp .

APPEND wa_ist_temp TO ist_temp.
APPEND wa_ist_so_details TO ist_so_details.

PERFORM get_so_char_pri.
FORM get_so_char_pri .
    IF NOT ist_temp[] IS INITIAL.
    wa_ist_chars-atnam = gd_atinn.
    APPEND wa_ist_chars TO ist_chars.

      LOOP AT ist_temp ASSIGNING &amp;lt;gs_ist_temp&amp;gt;.
        ld_tabix = sy-tabix.
        READ TABLE ist_var_chars ASSIGNING &amp;lt;gs_ist_var_chars&amp;gt;
                                 WITH KEY    vbeln = &amp;lt;gs_ist_temp&amp;gt;-vbeln
                                             posnr = &amp;lt;gs_ist_temp&amp;gt;-posnr
                                 BINARY SEARCH.
        IF sy-subrc EQ 0.
          &amp;lt;gs_ist_temp&amp;gt;-atwrt = &amp;lt;gs_ist_var_chars&amp;gt;-atwrt.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDIF.
endform .
APPEND wa_ist_temp2 TO ist_temp2.

PERFORM get_so_char_alt.

FORM get_so_char_alt .
 
    
    IF NOT ist_var_chars[] IS INITIAL.
      SORT ist_var_chars BY vbeln posnr.

*     Loop at table to modify the characteristic value
      LOOP AT ist_temp2 ASSIGNING &amp;lt;gs_ist_temp2&amp;gt;.
        READ TABLE ist_var_chars ASSIGNING &amp;lt;gs_ist_var_chars&amp;gt;
                                  WITH KEY vbeln = &amp;lt;gs_ist_temp2&amp;gt;-vbeln
                                           posnr = &amp;lt;gs_ist_temp2&amp;gt;-posnr.
        IF sy-subrc EQ 0.
          &amp;lt;gs_ist_temp2&amp;gt;-atwrt = &amp;lt;gs_ist_var_chars&amp;gt;-atwrt.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDIF.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to make this both performs common how  can i do it ?&lt;/P&gt;&lt;P&gt;Plz help ... i cant use passing internal table as everything is global .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Mar 2010 10:01:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678043#M1449138</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-15T10:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: problem to make a common perform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678044#M1449139</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;Basicly you can pass one parameter in perform for each handling...&lt;/P&gt;&lt;P&gt;lets say parameter can be  1 and 2. When it's 1 you use logic of first perform and when 2 you use logic of second one - it is only to make them one perform. &lt;/P&gt;&lt;P&gt;But to make it less lines you can do much more.&lt;/P&gt;&lt;P&gt;For exampe you can pass name of itab in loop as second parameter and you don't need to write same loop twice but only to enter (itab_name) and use same loop for both logics...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Yossi Rozenberg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Mar 2010 10:13:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678044#M1449139</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-15T10:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: problem to make a common perform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678045#M1449140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ujwal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is my understanding of your requirement, you have &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perform f1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form f1.&lt;/P&gt;&lt;P&gt; code f1...&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perform f2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form f2.&lt;/P&gt;&lt;P&gt; code f2...&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You want merge F1 and F2 into F3, As the code in the two subroutines use global variables you cannot have a single sub routine, and differentiate the sub-routine calls F1 and F2. If my understanding is correct you can proceed as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Declare a local variable l_routine_flag&lt;/P&gt;&lt;P&gt;2) Subroutine - PERFORM F3 using l_routine_flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM F3 using l_routine_flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case l_routine_flag.&lt;/P&gt;&lt;P&gt;when 'F1'.&lt;/P&gt;&lt;P&gt;  code for F1.&lt;/P&gt;&lt;P&gt;when 'F2'.&lt;/P&gt;&lt;P&gt;  code for F2.&lt;/P&gt;&lt;P&gt;when others.&lt;/P&gt;&lt;P&gt;endcase.&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;And in your main program you can call the sub routines as shown below,&lt;/P&gt;&lt;P&gt;l_routine_flag = 'F1'.&lt;/P&gt;&lt;P&gt;perform F3 using l_routine_flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_routine_flag = 'F2'.&lt;/P&gt;&lt;P&gt;perform F3 using l_routine_flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Mar 2010 10:14:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678045#M1449140</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-15T10:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: problem to make a common perform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678046#M1449141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi plz explain me suing my example .....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Mar 2010 10:15:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678046#M1449141</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-15T10:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: problem to make a common perform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678047#M1449142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi as code of both forms are similar can we make a single form and can be used by both internal tables ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Mar 2010 10:17:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678047#M1449142</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-15T10:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: problem to make a common perform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678048#M1449143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, if the code in both the forms are exactly the same, and the variables in concern are of the same type, you can have just one subroutine with no repeated code. For ex, let's say, you have two ITABs of same type "XYZ" declared globally. ITAB1 and ITAB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that case your single sub routine can be as shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM F3 USING itab STRUCTURE "XYZ" l_flag_routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE: l_flag_routine.&lt;/P&gt;&lt;P&gt;when 'F1'.&lt;/P&gt;&lt;P&gt;  itab[] = itab1[].&lt;/P&gt;&lt;P&gt;when 'F2'.&lt;/P&gt;&lt;P&gt; itab[] = itab2[].&lt;/P&gt;&lt;P&gt;when Others.&lt;/P&gt;&lt;P&gt;end case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code using itab....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in your main program call the sub routines as below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_flag_routine = 'F1'.&lt;/P&gt;&lt;P&gt;perform f3 using itab1[] l_flag_routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_flag_routine = 'F2'.&lt;/P&gt;&lt;P&gt;perform f3 using itab2[] l_flag_routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Mar 2010 10:37:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678048#M1449143</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-15T10:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: problem to make a common perform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678049#M1449144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks all for your posts .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Mar 2010 07:07:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-make-a-common-perform/m-p/6678049#M1449144</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-19T07:07:13Z</dc:date>
    </item>
  </channel>
</rss>

