<?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 class in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/class/m-p/3196057#M761572</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how to create a screen in a class (for example BADI)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Dec 2007 10:55:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-07T10:55:28Z</dc:date>
    <item>
      <title>class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class/m-p/3196057#M761572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how to create a screen in a class (for example BADI)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 10:55:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class/m-p/3196057#M761572</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T10:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class/m-p/3196058#M761573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The user then views the data required. Compare your existing program to SAP standard program.&lt;/P&gt;&lt;P&gt;At the specific request of the customer, you are to enhance this function to allow the user &lt;/P&gt;&lt;P&gt;Follow the steps to accomplish that:-&lt;/P&gt;&lt;P&gt;Create a subscreen area in your main program(calling program). Let, the name is &amp;#145;SUB&amp;#146;.&lt;/P&gt;&lt;P&gt;Then, create a BADI definition for a single-use BADI( single implementation) from SE18.&lt;/P&gt;&lt;P&gt;After that, create two methods as shown below with the parameters mentioned:-&lt;/P&gt;&lt;P&gt;The specifications for the method are as follows:-&lt;/P&gt;&lt;P&gt;Method:&lt;/P&gt;&lt;P&gt;PUT_DATA_IN_SCREEN&lt;/P&gt;&lt;P&gt;GET_DATA_FROM_SCREEN&lt;/P&gt;&lt;P&gt;Parameter:	Type:	Reference type:&lt;/P&gt;&lt;P&gt;MATERIALS	IMPORTING	MARA&lt;/P&gt;&lt;P&gt;MATERIALS	EXPORTING	MARA&lt;/P&gt;&lt;P&gt;Create an instance attribute in the interface. This attribute is used for passing data. &lt;/P&gt;&lt;P&gt;Then, in the tab for subscreens, enter the name of the calling program,screen number, subscreen area.&lt;/P&gt;&lt;P&gt;The code of the calling program should be changed as follows:-&lt;/P&gt;&lt;P&gt;Top Include:-&lt;/P&gt;&lt;P&gt;        DATA : w_prog type program ,&lt;/P&gt;&lt;P&gt;                w_dynnr type dynnr.&lt;/P&gt;&lt;P&gt; data : l_badi type ref to YIF_EX_SUBMATQRY.&lt;/P&gt;&lt;P&gt;PBO events:-&lt;/P&gt;&lt;P&gt;MODULE STATUS_1001 OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; IF l_badi IS INITIAL.&lt;/P&gt;&lt;P&gt;  CALL METHOD cl_exithandler=&amp;gt;get_instance&lt;/P&gt;&lt;P&gt;    CHANGING&lt;/P&gt;&lt;P&gt;      instance = l_badi.&lt;/P&gt;&lt;P&gt; ENDIF.&lt;/P&gt;&lt;P&gt; CALL METHOD cl_exithandler=&amp;gt;set_instance_for_subscreens&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      instance = l_badi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  w_prog = sy-repid.&lt;/P&gt;&lt;P&gt;  w_dynnr = sy-dynnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD cl_exithandler=&amp;gt;get_prog_and_dynp_for_subscr&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      exit_name       = 'YSUBMATQRY'&lt;/P&gt;&lt;P&gt;      calling_program = w_prog&lt;/P&gt;&lt;P&gt;      calling_dynpro  = w_dynnr&lt;/P&gt;&lt;P&gt;      subscreen_area  = 'SUB'&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      called_program  = w_prog&lt;/P&gt;&lt;P&gt;      called_dynpro   = w_dynnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD l_badi-&amp;gt;put_data_in_screen&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      materials   = mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMODULE.                 " STATUS_1001  OUTPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You declare the instance using the public static method SET_INSTANCE_FOR_SUBSCREEN to allow the data for display on the screen to be used in the function group of the user or in the module pool. &lt;/P&gt;&lt;P&gt;The method GET_PROG_AND_DYNP_FOR_SUBSCR and the input/output parameters specified above are used to determine the name of the customer program and the name of the subscreen. The method PUT_DATA_IN_SCREEN which is called at PBO as well as the method GET_DATA_FROM_SCREEN which is called at PAI are used to transport the data to be displayed. These methods are implemented by the user. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The screen flow logic of the calling program should call the subscreen:-&lt;/P&gt;&lt;P&gt;PROCESS BEFORE OUTPUT.&lt;/P&gt;&lt;P&gt; MODULE STATUS_1001.&lt;/P&gt;&lt;P&gt; call subscreen SUB  including w_prog w_dynnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;1.1.1.1	Develop the program to be called&lt;/P&gt;&lt;P&gt;Then, create a module pool program with a subscreen and put the elements in the subscreen. This program will be the called program. Let, the program be YSUBMATCALLED with subscreen 1002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program will be as follows:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROGRAM  YSUBMATCALLED                           .&lt;/P&gt;&lt;P&gt;tables : mara.&lt;/P&gt;&lt;P&gt;DATA: l_badi TYPE REF TO YIF_EX_SUBMATQRY,&lt;/P&gt;&lt;P&gt;      w_mara TYPE mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Module  STATUS_1002  OUTPUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE STATUS_1002 OUTPUT.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; SET PF-STATUS 'xxxxxxxx'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; SET TITLEBAR 'xxx'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; IF l_badi IS INITIAL.&lt;/P&gt;&lt;P&gt;    CALL METHOD cl_exithandler=&amp;gt;get_instance_for_subscreens&lt;/P&gt;&lt;P&gt;     CHANGING&lt;/P&gt;&lt;P&gt;       instance  = l_badi&lt;/P&gt;&lt;P&gt;     EXCEPTIONS&lt;/P&gt;&lt;P&gt;       OTHERS    = 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  CALL METHOD l_badi-&amp;gt;get_data_from_screen&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      materials   = mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT SINGLE  mtart&lt;/P&gt;&lt;P&gt;                 meins&lt;/P&gt;&lt;P&gt;                 FROM mara&lt;/P&gt;&lt;P&gt;                 into (mara-mtart,mara-meins)&lt;/P&gt;&lt;P&gt;    WHERE matnr = mara-matnr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMODULE.                 " STATUS_1002  OUTPUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Module  USER_COMMAND_1002  INPUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE USER_COMMAND_1002 INPUT.&lt;/P&gt;&lt;P&gt;  CALL METHOD l_badi-&amp;gt;put_data_in_screen&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      materials = mara.&lt;/P&gt;&lt;P&gt;ENDMODULE.                 " USER_COMMAND_1002  INPUT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.1.1.2	Create a  BADI Instance&lt;/P&gt;&lt;P&gt;Finally, create an instance of the BADI. Mention the following lines of code for the methods:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method YIF_EX_SUBMATQRY~PUT_DATA_IN_SCREEN .&lt;/P&gt;&lt;P&gt;  me-&amp;gt;YIF_EX_SUBMATQRY~materials = materials.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method YIF_EX_SUBMATQRY~GET_DATA_FROM_SCREEN .&lt;/P&gt;&lt;P&gt;materials = me-&amp;gt;YIF_EX_SUBMATQRY~materials.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the subscreens tab page of SE19, mention clearly the calling and called program information as shown below:-&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 11:51:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class/m-p/3196058#M761573</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T11:51:13Z</dc:date>
    </item>
  </channel>
</rss>

