<?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 smartform in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309831#M505765</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in the smartform, right click to "create" an element, and select "program lines" (in ECC6, this is flow logic-&amp;gt;program lines".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will see three areas on the screen. One for inbound parameters, one for outbound parameters and one for code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any data local to the routine (your "data" statements) does not have to be in the input or output parameter areas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anything you want to use from the outside (a global variable, for example, or something from the form interface) must be declared as input, output, or both.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Insert the code lines element someplace BEFORE you want to use the output from the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to use the XVALUES outside of the code, for instance, to create a table of data on the form, you will need to define it globally to the form.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 May 2007 15:16:53 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-14T15:16:53Z</dc:date>
    <item>
      <title>Subroutine in smartform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309829#M505763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my smartform I need to write a sub routine and compute a value to be displayed in smartform. I have been able to accomplish this as a test program but unable to integrate it as a sub routine in my smart form partly because I am new to sub routines. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to find J_3AFCC value from MARA where matnr = gs_it_gen-material&lt;/P&gt;&lt;P&gt;Do I have to declare an internal table to put the J_3AFCC and how to do it &lt;/P&gt;&lt;P&gt;Also do I have to declare structure gs_it_gen as currently it says gs_it_gen-material field is unknown&lt;/P&gt;&lt;P&gt;Then I need to use the xvalues field and pass it in my smartform. Any help will be greatly appreciated. Thank you &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  fcc_values
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM fcc_values.

  DATA: BEGIN OF xvalues OCCURS 100,
        text(64) TYPE c,
        END OF xvalues,

        ij_3afcco  LIKE j_3afcco  OCCURS 20 WITH HEADER LINE,
        ij_3afcfab LIKE j_3afcfab OCCURS 50 WITH HEADER LINE,
        ij_3afabt  LIKE j_3afabt  OCCURS 10 WITH HEADER LINE,
        h_fcctext  LIKE j_3amatdi-fcctext,
        h_fcc2     LIKE j_3amatdi-fcctext,
        h_text     LIKE j_3amatdi-fcctext,
        h_tabix    LIKE sy-tabix.
        
        data: lv_j_3afcc like mara-j_3afcc.

* Using IT_GEN-MATERIAL find J_3AFCC from MARA
  "SELECT J_3AFCC from mara into lv_j_3afcc where matnr = gs_it_gen-material.
  SELECT * FROM j_3afcco  INTO TABLE ij_3afcco  WHERE j_3afcc = '004'.
  SELECT * FROM j_3afcfab INTO TABLE ij_3afcfab WHERE j_3afcc = '004'.
  SELECT * FROM j_3afabt  INTO TABLE ij_3afabt  WHERE spras = sy-langu.

  SORT ij_3afcfab BY j_3afcc j_3afcseq.
  CLEAR xvalues.
  LOOP AT ij_3afcco.
    MOVE ij_3afcco-j_3afcc TO xvalues.
    APPEND xvalues.
    CLEAR xvalues.
    CLEAR h_text.
    CLEAR h_tabix.
    LOOP AT ij_3afcfab WHERE j_3afcc = ij_3afcco-j_3afcc.
      ADD 1 TO h_tabix.
      READ TABLE ij_3afabt WITH KEY j_3afabr = ij_3afcfab-j_3afabr.
      IF sy-subrc NE 0.
        CLEAR ij_3afabt.
      ENDIF.
      h_fcc2 = h_text.
      WRITE ij_3afcfab-proz TO h_fcctext NO-ZERO.
      h_fcctext+6 = '%'.
      CONDENSE h_fcctext NO-GAPS.
      h_fcctext+10 = ij_3afabt-text.
      CONDENSE h_fcctext.
      IF h_tabix = 1.
        CONCATENATE h_fcc2 h_fcctext INTO h_text.
      ELSE.
        CONCATENATE h_fcc2 h_fcctext INTO h_text
                    SEPARATED BY '/'.
      ENDIF.
    ENDLOOP.
    MOVE h_text TO xvalues.
    APPEND xvalues.
  ENDLOOP.

  WRITE xvalues.

ENDFORM.                    "fcc_values
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 14:47:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309829#M505763</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-14T14:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine in smartform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309830#M505764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps we can do this first in a test program. I think I should be able to integrate this into my form then. All I want is to be able to convert this into form perform&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 14:53:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309830#M505764</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-14T14:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine in smartform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309831#M505765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in the smartform, right click to "create" an element, and select "program lines" (in ECC6, this is flow logic-&amp;gt;program lines".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will see three areas on the screen. One for inbound parameters, one for outbound parameters and one for code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any data local to the routine (your "data" statements) does not have to be in the input or output parameter areas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anything you want to use from the outside (a global variable, for example, or something from the form interface) must be declared as input, output, or both.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Insert the code lines element someplace BEFORE you want to use the output from the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to use the XVALUES outside of the code, for instance, to create a table of data on the form, you will need to define it globally to the form.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 15:16:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309831#M505765</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-14T15:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine in smartform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309832#M505766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right now I am just looking at making a subroutine out of my code and be able to display xvalues after running the subroutine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 15:18:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309832#M505766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-14T15:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine in smartform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309833#M505767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wrong solution, will post this again in another thread&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 15:30:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-in-smartform/m-p/2309833#M505767</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-14T15:30:06Z</dc:date>
    </item>
  </channel>
</rss>

