DIFFERENT PROGRAMMING STRUCTURES: * * UNSTRUCTURED PROGRAMMING PROCEDURAL PROGRAMMING

* OBJECT ORIENTED PROGRAMMING UNSTRUCTURED PROGRAMMING: * * * the entire program contains only one maintained the same set of statements are placed in multiple locations of the same program its very difficult to maintain if the program becomes very large.

PROCEDURAL PROGRAMMING: * * * * the entire program is splitting into smaller programs the same set of statements are placed in a procedure and procedure can be called from multiple locations of the same program. All the procedures and function modules can access the global declarations it takes some extra time to enhance the existing program

OBJECT ORIENTED PROGRAMMING: * * * the entire program is visualized in terms of classed and object all the methods cannot access the global declarations. It takes very less time to enhance the existing program

OOPS ABAP KEY FEATURES OF OBJECT ORIENTED APPROACH: * * * * * * better programming structure the real world entity can be modeled very well more stress on data security and access data abstraction and encapsulation inheritance and polymorphism reduce the redundancy of the code

CLASS: class is the blue print or template of an object EXAMPLE: * * the plan of the farm house is called class based on the plan we built the farm house then the farm house is call object

OBJECT: object is the real entity. sujith.pelluru@gmail.com 1|Page

TYPE OF CLASSES: * * GLOBAL CLASS LOCAL CLASS

DIFFERENCE BETWEEN GLOBAL AND LOCAL CLASS GLOBAL CLASS: * * * * we can access the global class from any where in the sap global class name must starts with y or z the global class is stored in class repository global class is created through se24

LOCAL CLASS: * * * * we can access the local class with in program only local class name starts with any letter the local class is stored in a memory of abap programming local class is created in se38 transaction

A class contains two Sessions. * * CLASS DEFNITION CLASS IMPLEMENTATION

CLASS DEFINITION: * it is nothing but declaring the all components of the class under anyone of the visibility section

COMPONENTS OF CLASS: * * * * ATTRIBUTES METHODS INTERFACES EVENTS

ATTRIBUTES: these are used to declare the variables work area and internal tables which are required to implement the logic. METHODS: * methods is the collection of statements which perform particular task INTERFACES: sujith.pelluru@gmail.com 2|Page *

*

it is the collection of methods which are define not implemented

EVENTS: * events are used to handle the methods of some other class

SYNTAX OF CLASS DEFINITION:
CLASS <CLASS NAME> DEFINITION <PUBLIC/PROTECTED/PRIVATE > SECTION. ---------- DECLARE THE COMPONENTS OF THE CLASS -----ENDCLASS.

THERE ARE THREE TYPES OF VISIBILITY SECTION * * * PUBLIC SECTION PROTECTED SECTION PRIVATE SECTION

PUBLIC SECTION: we can access the public components with in the class as well as outside the class also PROTECTED SECTION: we access the protected components with in the class as well as child class also PRIVATE SECTION: we can access the private components with in the class only NOTE: in c++ private section is the default visible section, in java public section is the default visibility section, in abap there is no default visibility section.

CLASS IMPLEMENTATION: it is nothing but implementing the methods which are defined in the class definition
CLASS <CLASS NAME> IMPLEMENTATION ------- IMPLEMENTATING THE METHODS ---ENDCLASS

sujith.pelluru@gmail.com

3|Page

SYNTAX OF DECLARING THE METHOD:
METHODS <METHOD NAME> IMPORTING <IMPORT VALUE1> TYPE <DATA TYPE> <IMPORT VALUE2> TYPE <DATA TYPE> ---------------EXPORTING <EXPORTING VALUE 1> TYPE <DATA TYPE> <EXPORTING VALUE 2> TYPE <DATA TYPE> ----------CHANGING <CHANGING VALUE1> TYPE <DATA TYPE> <CHANGING VALUE2> TYPE <DATA TYPE> ------------------

SYNTAX OF IMPLEMENTING THE METHOD: if the method is defined in the class definition
METHOD <METHOD NAME> ------- BUSINESS LOGIC ---ENDMETHOD.

If the method id defined in the interface
METHOD <INTERFACE NAME> ~ <METHOD NAME>. ---------- BUSINESS LOGIC ---ENDMETHOD.

SYNTAX OF CALLING THE METHOD:
CALL METHOD < OBJECT NAME OF THE CLASS> → <METHOD NAME> EXPORTING <EXPORTING VALUE1> = <VALUE 1> <EXPORTING VALUE2> = <VALUE 2> ----------IMPORTING <VALUE 1> = <IMPORTING VALUE1> <VALUE 2> = <IMPORTING VALUE2> -----------

NOTE: * * we can access the components of a class is always through class object. We can create any number of objects to the class there are 2 step procedure to create the object 4|Page

sujith.pelluru@gmail.com

* * create the reference to the class create the object based on the reference SYNTAX OF CREATING THE OBJECT: CREATE OBJECT <REFERENCE NAME>. ENDMETHOD. C TYPE I. CLASS C1 IMPLEMENTATION. ENDMETHOD. START-OF-SELECTION. PARAMETER : P_INPUT1 TYPE I. P_INPUT2 TYPE I. NOTE: we must create the object under start-of-selection event only.pelluru@gmail. PUBLIC SECTION. *CALL METHODS CALL METHOD RC1->ADD EXPORTING M = P_INPUT1 N = P_INPUT2. *CREATE THE OBJECT DATA RC1 TYPE REF TO C1. METHOD ADD. CREATE OBJECT RC1. C = A + B. ENDCLASS. A = M.com 5|Page . DISPLAY. B = N. METHODS : ADD IMPORTING M TYPE I N TYPE I. WRITE C. METHOD DISPLAY. ********************************************************* REPORT SUJITH_7AM_OOPS_ABAP1. ENDCLASS. OBJECT: TO PERFORM THE ADDITION OF TWO NUMBERS BY USING OOPS ABAP. sujith. DATA : A TYPE I. B TYPE I. CLASS C1 DEFINITION.

CLASS C1 DEFINITION.com 6|Page . and interfaces keywords. DATA A TYPE I VALUE 10. TYPES OF COMPONENTS There are two types of components 1) instance components 2) static components DIFFERENCE BETWEEN INSTANCE COMPONENTS AND STATIC COMPONENTS: INSTANCE COMPONENTS: 1) it exists for each and every object of the class 2) instance components accessed only through class object 3) instance components are declared with data methods. CLASS-DATA B TYPE I VALUE 30. PUBLIC SECTION. WRITE / C1=>B. sujith.CALL METHOD RC1->DISPLAY. ENDCLASS. DISPLAY THE VALUES USING OOPS ABAP: REPORT SUJITH_7AM_OOPS_ABAP2. STATIC COMPONENTS: 1) static components exists only one for all the objects of the class 2) static components accessed either through class object or class name 3) static components are declared with class-data. WRITE / RC1->B. class-events. START-OF-SELECTION.pelluru@gmail. class-methods. events. MANUALLY FILLING THE INTERNAL TABLE BY USING OOPS-ABAP: REPORT SUJITH_7AM_OOPS_ABAP3. DATA RC1 TYPE REF TO C1. CREATE OBJECT RC1. WRITE RC1->A.class-interfaces.

DATA RC1 TYPE REF TO C1. DATA IT_T001 LIKE TABLE OF WA_T001. ENDCLASS. METHODS FILL_DATA IMPORTING W_BUKRS TYPE BUKRS W_BUTXT TYPE BUTXT W_ORT01 TYPE ORT01. WA_T001-BUTXT = W_BUTXT. CLEAR WA_T001. END OF WA_T001. PUBLIC SECTION. CLASS C1 DEFINITION.pelluru@gmail. WA_T001-BUKRS = W_BUKRS. APPEND WA_T001 TO IT_T001. ORT01 LIKE T001-ORT01. CLASS C1 IMPLEMENTATION. BUKRS LIKE T001-BUKRS. METHOD FILL_DATA. BUTXT LIKE T001-BUTXT.DATA : BEGIN OF WA_T001. CALL METHOD RC1->FILL_DATA EXPORTING W_BUKRS = '2000' sujith. START-OF-SELECTION. ENDCLASS. ENDMETHOD.com 7|Page . CREATE OBJECT RC1. CALL METHOD RC1->FILL_DATA EXPORTING W_BUKRS = '1000' W_BUTXT = 'TCS' W_ORT01 = 'HYD'. WA_T001-ORT01 = W_ORT01.

CLASS C1 DEFINITION. DATA : BEGIN OF WA_CUS.W_BUTXT = 'IBM' W_ORT01 = 'CHE'.ort01 by using oops abap *************************************************** REPORT SUJITH_7AM_OOPS_ABAP5. sujith. CALL METHOD RC1->FILL_DATA EXPORTING W_BUKRS = '3000' W_BUTXT = 'HCL' W_ORT01 = 'BAN'. PUBLIC SECTION. CLASS C1 IMPLEMENTATION.name1.WA_T001-ORT01. ENDCLASS. WRITE :/ WA_T001-BUKRS. ORT01 LIKE KNA1-ORT01. KUNNR LIKE KNA1-KUNNR. DATA IT_CUS LIKE TABLE OF WA_CUS.com 8|Page .WA_T001-BUTXT. METHODS UPLOAD_DATA IMPORTING W_FILE TYPE STRING EXPORTING IT TYPE STANDARD TABLE. END OF WA_CUS. NOTE: Inside the class we always use types keywords we never use like keywords (oops doesn’t accept it).pelluru@gmail. OBJECT: upload the kunnr. NAME1 LIKE KNA1-NAME1. LOOP AT IT_T001 INTO WA_T001. ENDLOOP.

ENDCLASS.TXT' HAS_FIELD_SEPARATOR = 'X' TABLES DATA_TAB . CALL METHOD RC1->UPLOAD_DATA EXPORTING W_FILE = 'C:\CUS.WA_CUS-NAME1. DATA RC1 TYPE REF TO C1. START-OF-SELECTION. LOOP AT IT_CUS INTO WA_CUS.pelluru@gmail. ENDLOOP.com 9|Page . CREATE OBJECT RC1. WRITE :/ WA_CUS-KUNNR. CLASS C1 DEFINITION. TYPES : BEGIN OF TY_T001. BUKRS TYPE BUKRS.METHOD UPLOAD_DATA. ENDMETHOD. PUBLIC SECTION. sujith. = IT MANUALLY FILLING THE INTERNAL TABLE USING OOPS ABAP IN ANOTHER WAY: REPORT SUJITH_7AM_OOPS_ABAP4. CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = 'C:\CUS.TXT' IMPORTING IT = IT_CUS.WA_CUS-ORT01.

WA_T001-ORT01 = W_ORT01.com 10 | P a g e . ENDMETHOD. METHOD DISPLAY. DATA WA_T001 TYPE TY_T001. WRITE :/ WA_T001-BUKRS. START-OF-SELECTION. WA_T001-BUTXT = W_BUTXT. CLEAR WA_T001. DATA IT_T001 TYPE TABLE OF TY_T001. WA_T001-BUKRS = W_BUKRS. APPEND WA_T001 TO IT_T001. METHODS : FILL_DATA IMPORTING W_BUKRS TYPE BUKRS W_BUTXT TYPE BUTXT W_ORT01 TYPE ORT01. ENDCLASS. CREATE OBJECT RC1.WA_T001-ORT01. ENDCLASS. DATA RC1 TYPE REF TO C1. ENDMETHOD. ORT01 TYPE ORT01. DISPLAY.BUTXT TYPE BUTXT. LOOP AT IT_T001 INTO WA_T001. METHOD FILL_DATA. CLASS C1 IMPLEMENTATION.WA_T001-BUTXT.pelluru@gmail. ENDLOOP. END OF TY_T001. CALL METHOD RC1->FILL_DATA EXPORTING W_BUKRS = '1000' sujith.

netpr by using oops abap with inheritance concept ************************************************************ REPORT ZSUJITH_OOPS_INHERITANCE.pelluru@gmail. components of class sujith. CALL METHOD RC1->FILL_DATA EXPORTING W_BUKRS = '3000' W_BUTXT = 'HCL' W_ORT01 = 'BAN'. CALL METHOD RC1->DISPLAY.ebelp. SYNTAX OF DECLARING THE CHILD CLASS: Class <class name> defnition inheriting from <parent class name> Pulic/protected/private section.com 11 | P a g e . 1) Through sub-class object we can access the components of the super class only 2) Through sub class object we can access the components of super class as well as sub class also. -----------Endclass.W_BUTXT = 'TCS' W_ORT01 = 'HYD'. OBJECT: Based on the given ebeln number to display the ebeln. CALL METHOD RC1->FILL_DATA EXPORTING W_BUKRS = '2000' W_BUTXT = 'IBM' W_ORT01 = 'CHE'. INHERITANCE: 1) it is used to derive the new class from the existing class 2) the existing class is called parent class or super class 3) the new class is called sub-class or child class or derived class 4) the sub-class can acess all the components of super class which are defined under public and protected section onlu not under private section.meins.menge.

*DECLARING METHODS IN CLASS DEFNITION. ENDCLASS. MEINS LIKE EKPO-MEINS. ENDCLASS.com 12 | P a g e . METHOD DISPLAY. METHOD GET_DATA. PUBLIC SECTION. CLASS C2 DEFINITION INHERITING FROM C1.PARAMETER P_EBELN LIKE EKPO-EBELN. END OF WA_EKPO. SELECT EBELN EBELP MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO WHERE EBELN = W_EBELN. CLASS C1 DEFINITION. EBELN LIKE EKPO-EBELN. ENDMETHOD. METHODS DISPLAY. EBELP LIKE EKPO-EBELP. METHODS GET_DATA IMPORTING W_EBELN TYPE EBELN.pelluru@gmail. NETPR LIKE EKPO-NETPR. sujith. PUBLIC SECTION. CLASS C2 IMPLEMENTATION. ENDCLASS. *DECLARING DATA INTERNAL TABLE DATA : BEGIN OF WA_EKPO. CLASS C1 IMPLEMENTATION. DATA IT_EKPO LIKE TABLE OF WA_EKPO. MENGE LIKE EKPO-MENGE.

ENDLOOP. WA_EKPO-MEINS. CALL METHOD RC2->DISPLAY. INTERFACE: 1) Interface is the collection of methods . not implemented 2) These methods are implemented through class implementation 3) Interfaces are reusable components which is used in any number of classes under public section only. first we create the reference to the interface. 4) We cant create interface object directly.WA_EKPO-EBELP. and later we assign the class object to the inheritance reference. ENDCLASS. CALL METHOD RC2->GET_DATA EXPORTING W_EBELN = P_EBELN. START-OF-SELECTION.WA_EKPO-NETPR. ENDMETHOD.com 13 | P a g e . which are defined. sujith. SYNTAX OF DECLARING THE INHERITANCE: Interface <name of the interface> ----. WRITE:/ WA_EKPO-EBELN. DATA RC2 TYPE REF TO C2.all the methods declaration --Endinterface.pelluru@gmail.LOOP AT IT_EKPO INTO WA_EKPO.WA_EKPO-MENGE. CREATE OBJECT RC2.

LOOP AT IT_LFB1 INTO WA_LFB1. INTERFACE IF1. ENDINTERFACE. LIFNR LIKE LFB1-LIFNR. SELECT BUKRS LIFNR AKONT FROM LFB1 INTO TABLE IT_LFB1 WHERE BUKRS = W_BUKRS. ENDLOOP. END OF WA_LFB1.com 14 | P a g e . METHOD GET_DATA. CLASS C1 DEFINITION. ENDCLASS. METHODS GET_DATA IMPORTING W_BUKRS TYPE BUKRS. INTERFACES IF1. BUKRS LIKE LFB1-BUKRS. METHODS DISPLAY. ************************************************** REPORT SUJITH_7AM_OOPS_ABAP6. AKONT LIKE LFB1-AKONT. PARAMETER P_BUKRS LIKE T001-BUKRS. METHOD IF1~DISPLAY. DATA IT_LFB1 LIKE TABLE OF WA_LFB1. ENDMETHOD. DATA : BEGIN OF WA_LFB1. PUBLIC SECTION.WA_LFB1-LIFNR. sujith. akont) by using oops abap with the help of interface.OBJECT: based on the given company codes to display vendors under company( bukrs.pelluru@gmail.lifnr.WA_LFB1-AKONT. CLASS C1 IMPLEMENTATION. WRITE :/ WA_LFB1-BUKRS.

RIF1 = RC1. export parameters and implement the logic. SELECT SINGLE * FROM MARA INTO WHERE MATNR = P_MATNR. sujith. CALL METHOD RIF1->DISPLAY. ENDCLASS. DATA RIF1 TYPE REF TO IF1. METHOD GET_MATERIAL.ENDMETHOD. START-OF-SELECTION. enter 4) provide short description 5) click on save 6) provide method get_material 7) click on parameter 8) provide parameter type importing exporting associated type matnr mara level instance description get the material details p_matnr wa 10) click on source code 11) click on signature in the application tool bar and identify the import. DATA RC1 TYPE REF TO C1. OBJECT: based on the given material to display all the material details by using global class and method.com 15 | P a g e . CALL METHOD RC1->GET_DATA EXPORTING W_BUKRS = P_BUKRS.pelluru@gmail. CREATE OBJECT RC1. STEPS TO CREATE GLOBAL CLASSS AND METHOD: 1) execute SE24 2) provide the class name 3) click on create .

CHECK AND ACTIVATE 13) COME BACK 14) SAVE. DATA RGC1 TYPE REF TO SUJITH_7AM_GCL1 START-OF-SELECTION sujith. STEPS TO CREATE THE OBJECT FOR GLOBAL CLASS: 1) place the cursor where we want to create the object 2) click on pattern 3) select radio button abap object patterns 4) enter 5) select the radio button create object 6) provide the instance name RGC1 7) provide the class name 8) enter STEPS TO CALL THE METHOD: 1) place the cursor where we want to call the method 2) click on pattern 3) select the radio button abap object patterns 4) select the radio button call method 5) provide instance name RGC1 6) provide class or interface name 7) provide method name GET_MATERIAL 8) enter PARAMETER PR_MATERIAL LIKE MARA-MATNR.pelluru@gmail.com 16 | P a g e . DATA WA_MARA LIKE MARA. 12) SAVE . CHECK AND ACTIVATE THE CLASS.ENDMETHOD.

with some of the fields.WA_MARA-BISMIT.check and activate the structure. if you want to declare work area. OBJECT: based on the given vendor to display vendor number. name1. STEPS TO CREATE GLOBAL CLASS: sujith. NOTE: in the global method. WA_MARA-MTART. then we must create a structure with those fields and later we refer the structure in the method. CALL METHOD RGC1->GET_MATERIAL. and ort01 by using global class and method.CREATE OBJECT RGC1.pelluru@gmail. WRITE:/ WA_MARA-MATNR.WA_MARA-MATKL. EXPORTING P_MATNR = PR_MATNR.com 17 | P a g e . WA_MARA-MEINS. STEPS TO CREATE A STRUCTURE: 1) execute se11 2) select radio button data type 3) provide structure name 4) click on create 5) select the radio button structure 6) enter 7) provide short description component lifnr name1 ort01 ort01 component type lifnr name1 8) save. IMPORTING WA = WA_MARA.

DATA RGC2 TYPE REF TO SUJITH_7AM_GCL2. ENDMEHTOD. sujith.com 18 | P a g e . DATA WA_LFA1 LIKE SUJITH_7AM_GCL2.1) execute se24 2) provide object type 3) click on create 4) enter 5) provide short description 6) enter method get_vendor level visibility instance public description get the vendor information 7) select the method 8) click on parameters parameter p_lifnr wa type importing exporting 9) click on code icon associate type lifnr zsprap_7am METHOD GET_VENDOR SELECT SINGLE LIFNR NAME1 ORT01 FROM LFA1 INTO WA WHERE LIFNR = P_LIFNR. START-OF-SELECTION CREATE OBJECT RGC2 CALL METHOD RGC2-> GET_VENDOR. check and activate the class PARAMETER PR_LIFNR LIKE LFA1-LIFNR. 11) save. check and activate 12) come back 13) save.pelluru@gmail.

EXPORTING P_LIFNR = PR_LIFNR IMPORTING WA = WA_LFA1. CREATION OF TABLE TYPE IS OF 2 STEP PROCEDURE.com 19 | P a g e . NOTE: if you want to declare an internal table with some of the fields in the method then we must create one table type with the required fields and late we refer the table type in the method. OBJECT: based on the given company code to display the knb1 details. check and activate STEPS TO CREATE GLOBAL CLASS AND METHOD: 1) execute se24 2) provide global class name 3) click on create sujith. 1) create the structure with the required fields 2) create the table type based on the structure CREATE THE STRUCTURE WITH BUKRS KUNNR AKONT SUJITH_7AM_CSTR STEPS TO CREATE TABLE TYPE: 1) execute se11 2) select radio button data type 3) provide your table type name(sujith_7am_ttype) 4) click on create 5) select the radio button table type 6) enter 7) provide short text 8) provide line type as structure name sujith_7am_cstr 9) save. WA_LFA1-NAME1. WRITE:/ WA_LFA1-LIFNR.pelluru@gmail.WA_LFA1-ORT01.

sujith. ENDMETHOD.pelluru@gmail.4) enter 5) provide description 6) enter 7) method level visibility public description customer under company get_cust_under_comp instance 8) select the method 9) click on parameters 10) parameter p_bukrs it 11) click on code METHOD GET_CUST_UNDER_COMPANY. type importing exporting associated type bukrs zspra0_7am_ttype SELECT BUKRS KUNNR AKONT FROM KNB1 INTO TABLE IT WHERE BUKRS = P_BUKRS. CL_GUI_CUSTOM_CONTAINER: It is the global class which refers the custom control screen element when ever we create the object for this class then automatically one constructor will be triggered and ask the input as container name. CL_GUI_ALV_GRID: It is the global class which refers the grid display whenever we create the object for this class then automatically one constructor will be triggered and ask the input as parent name (object name of the name of the container class) SET_TABLE_FOR_FIRST_DISPLAY: It is the method under the global class cl_gui_alv_grid which is used to display the output in a grid format. check and activate OOPS ALV: Whenever we are working with oops alv then we must design one screen and draw the custom control screen element in that only we display the alv output.com 20 | P a g e . 12) Save.

*CREATE THE REFERENCES DATA : RC TYPE REF TO CL_GUI_CUSTOM_CONTAINER.The input for the above method is 1) Data internal table 2) Field catalog internal table EVENTS OF SCREEN: PROCESS BEFORE OUTPUT(PBO): It is an event which is triggered before displaying the screen.pelluru@gmail. SET PF-STATUS 'STAT'. DATA WA_KNA1 LIKE KNA1. DATA IT_KNA1 LIKE TABLE OF WA_KNA1. START-OF-SELECTION. PROCESS AFTER INPUT (PAI) It is an event which is triggered after displaying the screen OBJECT: To display the entire customers information by using oops alv ********************************************* REPORT SUJITH_7AM_OOPS_ALV1. CREATE OBJECT RG sujith. *create the objects CREATE OBJECT RC EXPORTING CONTAINER_NAME = 'CCON' . MODULE STATUS_3000 OUTPUT. RG TYPE REF TO CL_GUI_ALV_GRID. CALL SCREEN '3000'.com 21 | P a g e .

ENDIF. 2) Manually filling the filed catalog internal table.pelluru@gmail. *Filling the data internal table SELECT * FROM KNA1 INTO TABLE IT_KNA1. *Display the data CALL METHOD RG->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING I_STRUCTURE_NAME = 'KNA1' CHANGING IT_OUTTAB ENDMODULE. " USER_COMMAND_3000 INPUT FILLING THE FIELDCATALOG Filling the field catalog internal table is done by three ways 1) If we are working with all the fields from the data base table then we no need to prepare the field catalog we simply pass our I_STRUCTURE NAME as data base table name. LEAVE TO SCREEN 0. 22 | P a g e sujith. IF SY-UCOMM = 'BACK'. " STATUS_3000 OUTPUT MODULE USER_COMMAND_3000 INPUT.EXPORTING I_PARENT = RC .com . 3) By using LVC_FIELDCATALOG_MERGE function module. = IT_KNA1 . ENDMODULE. SOME OF THE FIELDS IN FIELD CATALOG INTERNAL TABLE: 1) Fieldname name of the field.

LIFNR LIKE EKKO-LIFNR.pelluru@gmail.bsart. SELECT-OPTIONS S_EBELN FOR V1.2) Col_pos 3) Coltext 4) Emphasize 5) Hotspot 6) Edit 7) No_sign 8) No_zero 9) No_out 10) Output len column position column heading color handle symbol changeable mode remove the leading sign remove the leading zeros hide the field length of the displayed outputfield for the above fields the ACTIVE = ‘X’ and INACTIVE = ‘ ‘ .bedat. *********************************** REPORT SUJITH_7AM_OOPS_ALV3.by using oops alv.com 23 | P a g e . BSART LIKE EKKO-BSART. DATA V1 LIKE EKKO-EBELN.lifnr. *Declare the data internal table DATA : BEGIN OF WA_EKKO. Note: In data dictionary we have one table type that is LVC_T_FCAT which contains the above fields so we simply declare out fieldcatalog internal table by using LVC_T_FCAT table tab. OBJECT: Based on the given purchasing document numbers to display the ebeln. sujith. EBELN LIKE EKKO-EBELN. BEDAT LIKE EKKO-BEDAT.

pelluru@gmail. CALL SCREEN '2500'. START-OF-SELECTION. * SET TITLEBAR 'xxx'. *Filling the data internal table SELECT EBELN BSART BEDAT LIFNR FROM EKKO INTO TABLE IT_EKKO WHERE EBELN IN S_EBELN. WA_FCAT LIKE LINE OF IT_FCAT. *Create the references DATA : RC TYPE REF TO CL_GUI_CUSTOM_CONTAINER.com 24 | P a g e . DATA IT_EKKO LIKE TABLE OF WA_EKKO. MODULE STATUS_2500 OUTPUT. CREATE OBJECT RG EXPORTING I_PARENT = RC . WA_FCAT-COLTEXT = 'PUR.DOC'. sujith. RG TYPE REF TO CL_GUI_ALV_GRID. *CREATE THE OBJECTS CREATE OBJECT RC EXPORTING CONTAINER_NAME = 'CCON' . WA_FCAT-COL_POS = '1'. SET PF-STATUS 'STAT'. *Filling the fieldcatalog internal table WA_FCAT-FIELDNAME = 'EBELN'. *Declare the fieldcatalog DATA : IT_FCAT TYPE LVC_T_FCAT.END OF WA_EKKO.

com 25 | P a g e . WA_FCAT-COL_POS = '4'. CLEAR WA_FCAT. CLEAR WA_FCAT. *Display the data CALL METHOD RG->SET_TABLE_FOR_FIRST_DISPLAY CHANGING IT_OUTTAB = IT_EKKO .APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'LIFNR'. WA_FCAT-COLTEXT = 'DOC. WA_FCAT-FIELDNAME = 'BEDAT'. WA_FCAT-COLTEXT = 'VENDOR'. MODULE USER_COMMAND_2500 INPUT.DT'. WA_FCAT-COL_POS = '2'. WA_FCAT-FIELDNAME = 'BSART'. LEAVE TO SCREEN 0. APPEND WA_FCAT TO IT_FCAT.pelluru@gmail. sujith. APPEND WA_FCAT TO IT_FCAT. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-COL_POS = '3'. IF SY-UCOMM = 'BACK'.TYP'. CLEAR WA_FCAT. CLEAR WA_FCAT. IT_FIELDCATALOG = IT_FCAT ENDMODULE. WA_FCAT-COLTEXT = 'DOC.

quantity. item no. names. unit of measurements and proce by using OOPs-ALV. LIFNR LIKE LFA1-LIFNR. MESSAGE E000(ZSSS_MSG) WITH 'INVALID COMBINATION'. END OF WA_LFA1. Docc date.ENDIF. ENDSELECT. IF SY-SUBRC <> 0. DATA : BEGIN OF WA_LFA1. " USER_COMMAND_2500 INPUT ASSIGNMENT: Based on the given vendor and purchasing Docc No's to display the vendor no's. SELECT EBELN LIFNR FROM EKKO INTO (V1. EBELN LIKE EKKO-EBELN. DATA V1 LIKE LFA1-LIFNR. NAME1 LIKE LFA1-NAME1. ENDIF. SELECT-OPTIONS S_EBELN FOR V2. *************************************** REPORT ZSSS_ASSIGNMENT. DATA : BEGIN OF WA_EKKO. sujith. DATA IT_LFA1 LIKE TABLE OF WA_LFA1. SELECT-OPTIONS S_LIFNR FOR V1. V2) WHERE LIFNR IN S_LIFNR AND EBELN IN S_EBELN. DATA V2 LIKE EKKO-EBELN. SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME. ENDMODULE. purchasing docc No. SELECTION-SCREEN END OF BLOCK A.com 26 | P a g e .pelluru@gmail.

MENGE LIKE EKPO-MENGE. MENGE LIKE EKPO-MENGE. LIFNR LIKE LFA1-LIFNR. END OF WA_FINAL. DATA IT_FCAT TYPE LVC_T_FCAT.BSART LIKE EKKO-BSART. DATA : BEGIN OF WA_EKPO. EBELN LIKE EKKO-EBELN. EBELP LIKE EKPO-EBELP. END OF WA_EKKO. BEDAT LIKE EKKO-BEDAT.pelluru@gmail. DATA WA_FCAT LIKE LINE OF IT_FCAT. MEINS LIKE EKPO-MEINS. sujith. NAME1 LIKE LFA1-NAME1. LIFNR LIKE EKKO-LIFNR. DATA IT_EKKO LIKE TABLE OF WA_EKKO. BEDAT LIKE EKKO-BEDAT. EBELP LIKE EKPO-EBELP.com 27 | P a g e . END OF WA_EKPO. MEINS LIKE EKPO-MEINS. EBELN LIKE EKPO-EBELN. DATA : BEGIN OF WA_FINAL. DATA IT_FINAL LIKE TABLE OF WA_FINAL. BSART LIKE EKKO-BSART. DATA IT_EKPO LIKE TABLE OF WA_EKPO.

IF NOT IT_LFA1 IS INITIAL. SELECT LIFNR NAME1 FROM LFA1 INTO TABLE IT_LFA1 FOR ALL ENTRIES IN IT_EKKO WHERE LIFNR = IT_EKKO-LIFNR. sujith. = 'CCON'. * SET TITLEBAR 'xxx'. MODULE STATUS_2500 OUTPUT. WA_FINAL-EBELN = WA_EKKO-EBELN. IF NOT IT_EKKO IS INITIAL. SET PF-STATUS 'SSS'. ENDIF.DATA : RC TYPE REF TO CL_GUI_CUSTOM_CONTAINER. START-OF-SELECTION. LOOP AT IT_EKKO INTO WA_EKKO. CALL SCREEN '2500'. SELECT EBELN BSART BEDAT LIFNR FROM EKKO INTO TABLE IT_EKKO WHERE EBELN IN S_EBELN AND LIFNR IN S_LIFNR . ENDIF. CREATE OBJECT RC EXPORTING CONTAINER_NAME CREATE OBJECT RG EXPORTING I_PARENT = RC.pelluru@gmail.com 28 | P a g e . SELECT EBELN EBELP MENGE MEINS FROM EKPO INTO TABLE IT_EKPO FOR ALL ENTRIES IN IT_EKKO WHERE EBELN = IT_EKKO-EBELN. RG TYPE REF TO CL_GUI_ALV_GRID.

WA_FINAL-MEINS = WA_EKPO-MEINS. WA_FCAT-FIELDNAME = 'BEDAT'. APPEND WA_FCAT TO IT_FCAT. WA_FINAL-BEDAT = WA_EKKO-BEDAT.com 29 | P a g e . sujith.WA_FINAL-BSART = WA_EKKO-BSART. WA_FCAT-COL_POS = '2'.WA_LFA1. WA_FCAT-FIELDNAME = 'BSART'. CLEAR : WA_FINAL. READ TABLE IT_LFA1 INTO WA_LFA1 WITH KEY LIFNR = WA_EKKO-LIFNR.DOC'.TYPE'. WA_FCAT-COLTEXT = 'DOC. WA_FCAT-COLTEXT = 'DOC. WA_FCAT-COLTEXT = 'PUR. WA_FCAT-COL_POS = '1'. APPEND WA_FCAT TO IT_FCAT.DATE'. APPEND WA_FINAL TO IT_FINAL.pelluru@gmail. READ TABLE IT_EKPO INTO WA_EKPO WITH KEY EBELN = WA_EKKO-EBELN.WA_EKKO. APPEND WA_FCAT TO IT_FCAT. WA_FINAL-MENGE = WA_EKPO-MENGE. WA_FINAL-LIFNR = WA_EKKO-LIFNR. ENDLOOP. WA_FCAT-FIELDNAME = 'EBELN'. WA_FINAL-EBELP = WA_EKPO-EBELP. WA_FCAT-COL_POS = '3'. WA_FINAL-NAME1 = WA_LFA1-NAME1.WA_EKPO.

WA_FCAT-FIELDNAME = 'MEINS'. CALL METHOD RG->SET_TABLE_FOR_FIRST_DISPLAY CHANGING IT_OUTTAB IT_FIELDCATALOG ENDMODULE. WA_FCAT-COLTEXT = 'VEN. WA_FCAT-COLTEXT = 'UNIT OF MESURMENT'. " STATUS_2500 OUTPUT sujith.pelluru@gmail.com 30 | P a g e . WA_FCAT-COLTEXT = 'QUANTITY'.NAME'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'NAME1'. APPEND WA_FCAT TO IT_FCAT. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-COL_POS = '4'. WA_FCAT-COL_POS = '8'. WA_FCAT-COL_POS = '6'. = IT_FINAL = IT_FCAT. WA_FCAT-COLTEXT = 'DOC. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-COL_POS = '5'. APPEND WA_FCAT TO IT_FCAT.WA_FCAT-FIELDNAME = 'LIFNR'. WA_FCAT-FIELDNAME = 'EBELP'.ITEM'. WA_FCAT-FIELDNAME = 'MENGE'. WA_FCAT-COLTEXT = 'VENDOR'. WA_FCAT-COL_POS = '7'.

pelluru@gmail. ENDIF. NOTE: We always register the events before call the methods. EVENTS IN OOPS ALV: 1) PRINT_TOP_OF _PAGE 2) PRINT_TOP_OF_LIST 3) PRINT_END_OF_PAGE 4) PRINT_END_OF_LIST 5) DOUBLE_CLICK PRINT_TOP_OF_PAGE: It is an event which is trigger at the top of each page. ENDMODULE.MODULE USER_COMMAND_2500 INPUT. LEAVE TO SCREEN '0'.com 31 | P a g e . OBJ NAME OF THE CLASS Defines which class handles the events handler method name and next OBJ NAME OF THE CLASS Defines which class cotains event definition. IF SY-UCOMM = 'BACK'. SYNTAX OF DECLARRING THE EVENT HANDLER METHOD: METHOD <EM METHOD NAME> FOR EVENT < CLASS NAME BELONGS TO IN WHICH CLASS EVENT IS DEFINED EVENT NAME> OF <CLASS NAME> NOTE: When ever we are working with the events then we must register the events. sujith. "USER_COMMAND_2500 INPUT NOTE: Events contains the exporting perameters. SYNTAX OF REGESTIRING THE EVENTS: SET HANDLER <OBJECT NAME OF THE CLASS> → <EM METHOD NAME> FOR <OBJECT NAME OF THE CLASS>.

DOUBLE_CLICK: It is an event which is trigger at the time of user clicks on any record of any list this event exports E_ROW (ROW VALUES) E_COLUMN ( COLUMN VALUES). BSART LIKE EKKO-BSART. docc dates and vendor no's (EBELN. LIFNR LIKE EKKO-LIFNR. SELECT-OPTIONS S_EBELN FOR V1.PRINT_TOP_OF_LIST: It is an event which is trigger at the top of each displayed output list.BEDAT.com 32 | P a g e . *Declare the fieldcatalog internal table sujith. OBJECT: Based on the given purchasing docc no to display the purchasing docc no. END OF WA_EKKO. DATA IT_EKKO LIKE TABLE OF WA_EKKO. BEDAT LIKE EKKO-BEDAT. EBELN LIKE EKKO-EBELN. DATA V1 LIKE EKKO-EBELN.BSART. PRINT_END_OF_PAGE: It is an event which is trigger at the end of each page.LIFNR) if the user clicks on any of purchasing docc no then we display the purchasing docc details through ME23N transaction. *Declare the data internal table DATA : BEGIN OF WA_EKKO. docc types . ********************************************* REPORT SUJITH_7AM_OOPS_ALV4.pelluru@gmail. PRINT_END_OF_LIST: It is an event which is trigger at the end of displayed output list.

SET PARAMETER ID 'BES' FIELD WA_EKKO-EBELN. *Create the objects for container and grid CREATE OBJECT RC EXPORTING CONTAINER_NAME = 'CCON' . ENDMETHOD. * SET TITLEBAR 'xxx'. DATA WA_FCAT LIKE LINE OF IT_FCAT. START-OF-SELECTION. SET PF-STATUS 'ZSTAT'. CLASS C1 IMPLEMENTATION. PUBLIC SECTION. CLASS C1 DEFINITION. METHOD EHDC. ENDCLASS.DATA IT_FCAT TYPE LVC_T_FCAT. MODULE STATUS_5000 OUTPUT.com 33 | P a g e . ENDCLASS. *Create the references to grid and container DATA : RC TYPE REF TO CL_GUI_CUSTOM_CONTAINER. METHODS EHDC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN. CALL TRANSACTION 'ME23N'. READ TABLE IT_EKKO INTO WA_EKKO INDEX E_ROW-INDEX. CREATE OBJECT RG EXPORTING sujith. CALL SCREEN '5000'. RG TYPE REF TO CL_GUI_ALV_GRID.pelluru@gmail.

sujith. WA_FCAT-FIELDNAME = 'LIFNR'. APPEND WA_FCAT TO IT_FCAT. *Filling the field catalog WA_FCAT-FIELDNAME = 'EBELN'. WA_FCAT-COL_POS = '4'.TYP'. CLEAR WA_FCAT. WA_FCAT-COLTEXT = 'DOC. WA_FCAT-COLTEXT = 'PUR. WA_FCAT-COLTEXT = 'VENDOR'. CLEAR WA_FCAT. WA_FCAT-COLTEXT = 'DOC.DOC'. WA_FCAT-COL_POS = '3'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'BSART'.DT'. WA_FCAT-COL_POS = '2'. *Filling the data internal table SELECT EBELN BSART BEDAT LIFNR FROM EKKO INTO TABLE IT_EKKO WHERE EBELN IN S_EBELN.com 34 | P a g e . WA_FCAT-FIELDNAME = 'BEDAT'. WA_FCAT-COL_POS = '1'.I_PARENT = RC . APPEND WA_FCAT TO IT_FCAT.pelluru@gmail. CLEAR WA_FCAT. APPEND WA_FCAT TO IT_FCAT.

com 35 | P a g e . sales category by using OOPS ALV. KUNNR LIKE KNA1-KUNNR. LEAVE TO SCREEN 0. SET HANDLER RC1->EHDC FOR RG. *Register the events. names. MODULE USER_COMMAND_5000 INPUT.CLEAR WA_FCAT. DATA V1 LIKE KNA1-KUNNR. sujith. IF SY-UCOMM = 'BACK'. ASSIGNMENT: Based on the given customer no's to display the customer no. SELECT-OPTIONS S_KUNNR FOR V1. DATA: BEGIN OF WA_KNA1. *Display the output CALL METHOD RG->SET_TABLE_FOR_FIRST_DISPLAY CHANGING IT_OUTTAB = IT_EKKO IT_FIELDCATALOG = IT_FCAT . If the user click on any customer no's then we display the customer details by using XD03 transaction and also skip the first screen. DATA RC1 TYPE REF TO C1. ENDMODULE. sales order types. ENDMODULE. *************************************** REPORT ZSSS_ASSIGNMENT3. CREATE OBJECT RC1. sales order no's. ENDIF.pelluru@gmail. *Create the refence and object for local class.

DATA IT_KNA1 LIKE TABLE OF WA_KNA1. DATA: BEGIN OF WA_VBAK.NAME1 LIKE KNA1-NAME1. DATA RG TYPE REF TO CL_GUI_ALV_GRID. AUART LIKE VBAK-AUART. VBELN LIKE VBAK-VBELN. DATA RC TYPE REF TO CL_GUI_CUSTOM_CONTAINER. KUNNR LIKE VBAK-KUNNR. sujith. DATA IT_FCAT TYPE LVC_T_FCAT. CLASS C1 DEFINITION. END OF WA_FINAL. END OF WA_VBAK.com 36 | P a g e . NAME1 LIKE KNA1-NAME1. VBTYP LIKE VBAK-VBELN. DATA WA_FCAT LIKE LINE OF IT_FCAT. KUNNR LIKE VBAK-KUNNR. AUART LIKE VBAK-AUART. DATA: BEGIN OF WA_FINAL. VBTYP LIKE VBAK-VBTYP. DATA IT_FINAL LIKE TABLE OF WA_FINAL. DATA IT_VBAK LIKE TABLE OF WA_VBAK.pelluru@gmail. END OF WA_KNA1. VBELN LIKE VBAK-VBELN.

pelluru@gmail. START-OF-SELECTION.com 37 | P a g e . CREATE OBJECT RC EXPORTING CONTAINER_NAME = 'CON'. SELECT KUNNR NAME1 FROM KNA1 INTO TABLE IT_KNA1 WHERE KUNNR IN S_KUNNR. ENDMETHOD. CREATE OBJECT RG EXPORTING I_PARENT = RC. ENDCLASS. CALL SCREEN '2500'. SET PF-STATUS 'ZSTAT'. ENDCLASS. READ TABLE IT_FINAL INTO WA_FINAL INDEX E_ROW-INDEX. CLASS C1 IMPLEMENTATION. METHOD PASS_THROUGH. SET PARAMETER ID 'KUN' FIELD WA_FINAL-KUNNR. IF NOT IT_KNA1 IS INITIAL. sujith. METHODS PASS_THROUGH FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN. CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN. MODULE STATUS_2500 OUTPUT.PUBLIC SECTION.

WA_FCAT-COL_POS = '1'. WA_FINAL-NAME1 = WA_KNA1-NAME1. WA_FCAT-COL_POS = '2'. WA_FINAL-VBTYP = WA_VBAK-VBTYP. WA_FCAT-COLTEXT = 'SALES NUMBER'.pelluru@gmail. APPEND WA_FINAL TO IT_FINAL. ENDIF. ENDLOOP. APPEND WA_FCAT TO IT_FCAT. LOOP AT IT_KNA1 INTO WA_KNA1. CLEAR WA_FINAL. WA_FINAL-KUNNR = WA_KNA1-KUNNR. WA_FCAT-FIELDNAME = 'NAME1'. WA_FINAL-AUART = WA_VBAK-AUART.SELECT VBELN VBTYP AUART KUNNR FROM VBAK INTO TABLE IT_VBAK FOR ALL ENTRIES IN IT_KNA1 WHERE KUNNR = IT_KNA1-KUNNR. APPEND WA_FCAT TO IT_FCAT. WA_FINAL-VBELN = WA_VBAK-VBELN. WA_FCAT-FIELDNAME = 'VBELN'. WA_FCAT-COLTEXT = 'NAME'. sujith. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-COLTEXT = 'VENDOR'.com 38 | P a g e . WA_FCAT-COL_POS = '3'. WA_FCAT-FIELDNAME = 'KUNNR'. READ TABLE IT_VBAK INTO WA_VBAK WITH KEY KUNNR = WA_KNA1-KUNNR.

LEAVE TO SCREEN 0.WA_FCAT-FIELDNAME = 'VBTYP'. WA_FCAT-COL_POS = '4'. WA_FCAT-COLTEXT = 'SALES TYP'. = IT_FINAL = IT_FCAT. SET HANDLER RC1->PASS_THROUGH FOR RG.pelluru@gmail. WA_FCAT-COLTEXT = 'SALES CAT'. CALL METHOD RG->SET_TABLE_FOR_FIRST_DISPLAY CHANGING IT_OUTTAB IT_FIELDCATALOG ENDMODULE. MODULE USER_COMMAND_2500 INPUT. ENDIF. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'AUART'. APPEND WA_FCAT TO IT_FCAT. ENDMODULE.com 39 | P a g e . WA_FCAT-COL_POS = '5'. NOTE: sujith. IF SY-UCOMM = 'BACK'. CREATE OBJECT RC1. DATA RC1 TYPE REF TO C1.

pelluru@gmail.1) when ever we are working with header and footer events at the time of printing output only youget the proper events output. EBELN LIKE EKKO-EBELN. ********************************************** REPORT SUJITH_7AM_OOPS_ALV5. *Declare the fieldcatalog internal table DATA IT_FCAT TYPE LVC_T_FCAT. 3) Then we get the spool requets no.com 40 | P a g e . *Declare the data internal table DATA : BEGIN OF WA_EKKO. END OF WA_EKKO. DATA V1 LIKE EKKO-EBELN. docc dates and vendor no's (EBELN. BSART LIKE EKKO-BSART. BEDAT LIKE EKKO-BEDAT.LIFNR) if the user clicks on any of purchasing docc no then we display the purchasing docc details through ME23N transaction and display the TOP OF PAGE as SUJITH TECHNOLOGIES and TOP AF LIST as LEADER IN ABAP. 5) SP02 is the tcode to get all the spool requst no's OBJECT: Based on the given purchasing docc no to display the purchasing docc no. LIFNR LIKE EKKO-LIFNR. 2) After we execute the program click on print. SELECT-OPTIONS S_EBELN FOR V1. DATA WA_FCAT LIKE LINE OF IT_FCAT. 4) now we open the spool requst no and see the output by using SP02 transaction. DATA IT_EKKO LIKE TABLE OF WA_EKKO. enter. *Create the references to grid and container sujith.BEDAT. docc types .BSART.

START-OF-SELECTION. EHTP FOR EVENT PRINT_TOP_OF_PAGE OF CL_GUI_ALV_GRID.com 41 | P a g e . RG TYPE REF TO CL_GUI_ALV_GRID. WRITE :/ 'SUJITH Technologies'. * SET TITLEBAR 'xxx'. METHOD EHTP. ENDCLASS. SET PF-STATUS 'ZSTAT'. sujith. WRITE :/ 'The Leader in SAP-ABAP'. CALL SCREEN '5000'. PUBLIC SECTION. ENDCLASS. MODULE STATUS_5000 OUTPUT. METHOD EHTL. *Create the objects for container and grid CREATE OBJECT RC EXPORTING CONTAINER_NAME = 'CCON' . CLASS C1 IMPLEMENTATION. METHODS : EHTL FOR EVENT PRINT_TOP_OF_LIST OF CL_GUI_ALV_GRID. ENDMETHOD. ENDMETHOD.pelluru@gmail. CLASS C1 DEFINITION.DATA : RC TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

WA_FCAT-COLTEXT = 'VENDOR'. WA_FCAT-COLTEXT = 'PUR.TYP'.pelluru@gmail. *Filling the data internal table SELECT EBELN BSART BEDAT LIFNR FROM EKKO INTO TABLE IT_EKKO WHERE EBELN IN S_EBELN. WA_FCAT-FIELDNAME = 'LIFNR'. WA_FCAT-COL_POS = '1'. WA_FCAT-FIELDNAME = 'BSART'. CLEAR WA_FCAT. CLEAR WA_FCAT. WA_FCAT-FIELDNAME = 'BEDAT'. APPEND WA_FCAT TO IT_FCAT.DOC'. WA_FCAT-COL_POS = '2'. sujith. WA_FCAT-COL_POS = '4'. APPEND WA_FCAT TO IT_FCAT. *Filling the field catalog WA_FCAT-FIELDNAME = 'EBELN'. WA_FCAT-COL_POS = '3'. CLEAR WA_FCAT. WA_FCAT-COLTEXT = 'DOC.DT'.CREATE OBJECT RG EXPORTING I_PARENT = RC . WA_FCAT-COLTEXT = 'DOC. APPEND WA_FCAT TO IT_FCAT.com 42 | P a g e .

DATA RC1 TYPE REF TO C1.com 43 | P a g e . STEPS TO WORK WITH THE ROW COLOUR: sujith. IF SY-UCOMM = 'BACK'. *Create the refence and object for local class. ENDIF.APPEND WA_FCAT TO IT_FCAT. SET HANDLER RC1->EHTP FOR RG. SET HANDLER RC1->EHTL FOR RG. 3) ZEBRA -> DISPLAY THE OUTPUT IN A STRIPPED PATTERN. FEILDS IN THE LAYOUT WORK AREA: 1 ) INFO_FNAME -> COLOUR FEILD 2) CWIDTH_OPT -> COMPRESS THE FEILDS OUTPUT. LEAVE TO SCREEN 0. *Register the events. IT_FIELDCATALOG = IT_FCAT ENDMODULE. CLEAR WA_FCAT. ENDMODULE. CREATE OBJECT RC1. MODULE USER_COMMAND_5000 INPUT.pelluru@gmail. *Display the output CALL METHOD RG->SET_TABLE_FOR_FIRST_DISPLAY CHANGING IT_OUTTAB = IT_EKKO .

pelluru@gmail. MENGE LIKE EKPO-MENGE. DATA : IT_FCAT TYPE LVC_T_FCAT. ******************************************** REPORT SUJITH_7AM_OOPS_ALV7. MEINS LIKE EKPO-MEINS. 2) After filling the data internal tabble modify the colour field based on the condition. DATA V1 LIKE EKKO-EBELN. sujith. SELECT-OPTIONS S_EBELN FOR V1. END OF WA_EKPO. and net price and alp display the row in red colour which is amount is more than 1000 rs. DATA : BEGIN OF WA_EKPO. DATA WA_LAYOUT TYPE LVC_S_LAYO. DATA IT_EKPO LIKE TABLE OF WA_EKPO. NETPR LIKE EKPO-NETPR. 3) Pass the colour feildname into the layout work area. COL(4) TYPE C. OBJECT: Based on the given purchasing docc no to display the purchasing dooc no's. EBELN LIKE EKPO-EBELN. NOTE: LVC_S_LAYO is the structure which contains all the layout work area fields.com 44 | P a g e . 4) Prepare the field catalog abd display the output.1) Declare one additional colour feild in the data internal table which is CHAR and the length is 4. WA_FCAT LIKE LINE OF IT_FCAT. unit of measurements. EBELP LIKE EKPO-EBELP. quantity. docc names. so we simply declare our layout work area with LVC_S_LAYO.

START-OF-SELECTION. WA_FCAT-COL_POS = '1'. WA_FCAT-COLTEXT = 'PUR. MODULE STATUS_8888 OUTPUT. *Pass the color field into layout workarea WA_LAYOUT-INFO_FNAME = 'COL'. SET PF-STATUS 'ZSTAT'. APPEND WA_FCAT TO IT_FCAT. * SET TITLEBAR 'xxx'. = 'CCON' . = 'X'. CREATE OBJECT RC EXPORTING CONTAINER_NAME CREATE OBJECT RG EXPORTING I_PARENT = RC . CALL SCREEN '8888'. SELECT EBELN EBELP MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO WHERE EBELN IN S_EBELN.pelluru@gmail. RG TYPE REF TO CL_GUI_ALV_GRID.com 45 | P a g e . sujith. MODIFY IT_EKPO FROM WA_EKPO TRANSPORTING COL WHERE NETPR > 1000. *Modify the color field WA_EKPO-COL = 'C610'.*Create the references for container and grid DATA : RC TYPE REF TO CL_GUI_CUSTOM_CONTAINER. *WA_LAYOUT-ZEBRA *Filling the fieldcatalog WA_FCAT-FIELDNAME = 'EBELN'.DOC'.

*Display the output CALL METHOD RG->SET_TABLE_FOR_FIRST_DISPLAY sujith. WA_FCAT-FIELDNAME = 'NETPR'. WA_FCAT-COL_POS = '5'.CLEAR WA_FCAT. CLEAR WA_FCAT. APPEND WA_FCAT TO IT_FCAT. CLEAR WA_FCAT. WA_FCAT-COLTEXT = 'PRICE'. WA_FCAT-COLTEXT = 'ITEM'. WA_FCAT-COLTEXT = 'QTY'. WA_FCAT-COL_POS = '2'. APPEND WA_FCAT TO IT_FCAT. CLEAR WA_FCAT.com 46 | P a g e .pelluru@gmail. APPEND WA_FCAT TO IT_FCAT. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'MEINS'. WA_FCAT-COL_POS = '3'. WA_FCAT-FIELDNAME = 'EBELP'. WA_FCAT-COL_POS = '4'. WA_FCAT-FIELDNAME = 'MENGE'. WA_FCAT-COLTEXT = 'UOM'. CLEAR WA_FCAT.

2) If we use the class name with put defining then the class is called deffered class 3) If you are not generating our child class for the existing class then the existing class is called final class. IF SY-UCOMM = 'BACK'. " USER_COMMAND_8888 INPUT NOTE: 1) If the class is not ully implemented then the class is called abstract class. LEAVE TO SCREEN 0.pelluru@gmail.com 47 | P a g e . ENDMODULE. ENDIF. MODULE USER_COMMAND_8888 INPUT. = WA_LAYOUT IT_FIELDCATALOG = IT_FCAT ENDMODULE.EXPORTING IS_LAYOUT CHANGING IT_OUTTAB = IT_EKPO . sujith.

Sign up to vote on this title
UsefulNot useful