Download Android App of sapabap-vamsi

sapabap-vamsi : Download Android App for Mobiles

Friday, September 9, 2011

Example for creating Global Class



 Navigate to Transaction SE11.































Select Structure Radio Button









For Currency/quantity fields Reference table and Ref. field should be specified.
Maintain Enhancement Category Settings.
























Select Can be enhanced (Character-type or numeric) option. 
Save, Check and Activate.

Now Creating a Row Type.

Select Table Type.



Specify the line type name in the given field.


















Save, Check and Activate.
Now creating a Type Group.
























Navigate to SE24.



Mention the Type group name  in the Type Group / Object Type field created for using Types.

















In the Attributes tab mention the parameters required as input fields.


















In the Methods tab specify the methods for this class.
Constructor is the default method for any global class.



Select the constructor field and click on Methods button.


Navigate back .
Double Click on constructor and follow the screen below.



















Go Back.
Double Click on Get_Data.



method GET_DATA.
  SELECT lfa1~lifnr lfa1~name1 ekko~ebeln ekpo~matnr ekpo~txz01 ekpo~netwr
    FROM lfa1
    INNER JOIN ekko on lfa1~lifnr eq ekko~lifnr
    inner join ekpo on ekko~ebeln eq ekpo~ebeln
    into table itab
    where ekko~ebeln between p_low and p_high.
endmethod.


Go Back.
Double Cilck on Show_Data.

















method SHOW_DATA.
  LOOP AT  itab into wa.
write : / wa-lifnr,wa-name1,wa-ebeln,wa-matnr,wa-txz01,wa-netwr.
  ENDLOOP.
endmethod.


Go Back.
Save, Check and Activate.
Execute/Test.


 Enter Parameters Value and click on Instance.

















Click on Get_data.

Click on Show_Data.



 Back to the main screen.
Navigate to SE38.





 Create a Program to use the Global Class.


















*&---------------------------------------------------------------------*
*& Report  ZGLOBAL_CALL
*& Created By : Vamsi Vitta
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZGLOBAL_CALL line-SIZE 200.

TYPE-POOLs : zpord.

DATA : d_ebeln TYPE zpord_wa-ebeln.

SELECT-OPTIONS : s_ebeln FOR d_ebeln.

DATA : objkt TYPE REF TO zpurchase_class.

CREATE OBJECT OBJKT
  EXPORTING
    C_LOW  = s_ebeln-low
    C_HIGH = s_ebeln-high
    .
CALL METHOD OBJKT->GET_DATA
    .

CALL METHOD OBJKT->SHOW_DATA
    .


Save, Check and Activate.

Execute.

Enter the values and execute to get the output.

























It's done.
Appreciate Thanks.

4 comments:

  1. Thanks for sharing the valuable information here. sap training institutes in hyderabad in information with this content. Thank you and please keep update like this informative details.
    http://www.sapschool.in/

    ReplyDelete
  2. Great Post. The information provided is of great use as I got to learn new things. Keep Blogging.
    SAP ABAP TRAINING IN HYDERABAD

    ReplyDelete