You are on page 1of 20

*&--------------------------------------------------------------------*

*& Report ZDEMO_OPENSQL


*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*&--------------------------------------------------------------------*
*& Report Z10AM_SSCREEN
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT Z10AM_SSCREEN1.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS P1 TYPE BUKRS.
PARAMETERS P2 TYPE BUTXT.
SELECT-OPTIONS S1 FOR P1.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS C1 AS CHECKBOX.
PARAMETERS C2 AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME.
PARAMETERS R1 RADIOBUTTON GROUP G1.
PARAMETERS R2 RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B3.
IF C1 = 'X'.
WRITE / 'COURSE IS ABAP'.
ENDIF.
IF C2 = 'X'.
WRITE / 'COURSE IS BASIS'.
ENDIF.
*
IF R1 = 'X'.
WRITE / 'NORMAL TRACK'.
ELSE.
WRITE / 'FAST TRACK'.
ENDIF.
REPORT ZDEMO_OPENSQL.
data wa TYPE T001.
DATA IT TYPE TABLE OF T001.
WA-BUKRS = '1500'.
WA-BUTXT = 'IGROW SOFT'.
WA-LAND1 = 'IN'.
APPEND WA TO IT.
WA-BUKRS = '1501'.

WA-BUTXT = 'RAMS TECH'.


WA-LAND1 = 'IN'.
APPEND WA TO IT.
INSERT T001 FROM TABLE IT ACCEPTING DUPLICATE KEYS.
WRITE / SY-SUBRC.
WRITE / SY-DBCNT.
ULINE.
UPDATE T001 SET LAND1 = 'US' WHERE BUKRS = '1501'.
WRITE / SY-SUBRC.
WRITE / SY-DBCNT.
ULINE.
MODIFY T001 FROM TABLE IT.
WRITE / SY-SUBRC.
WRITE / SY-DBCNT.
ULINE.
DELETE T001 FROM TABLE IT.
WRITE / SY-SUBRC.
WRITE / SY-DBCNT.
ULINE.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&
*&--------------------------------------------------------------------*
*& Report ZDEMO_ITAB
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT ZDEMO_ITAB.
*************DEFINE STRUCTURE***************
TYPES BEGIN OF STR.
TYPES BUKRS TYPE BUKRS.
TYPES BUTXT TYPE BUTXT.
TYPES LAND1 TYPE LAND1.
TYPES END OF STR.
*************DEFINE WORK AREA******************
DATA WA TYPE STR.
************ITAB
*******************
DATA IT TYPE TABLE OF STR.
*************READ DATA******************
SELECT BUKRS BUTXT LAND1 FROM T001 INTO TABLE IT UP TO 5 ROWS.
***********DISPLAY*************************
LOOP AT IT INTO WA.
WRITE :/ SY-TABIX,WA-BUKRS,WA-BUTXT,WA-LAND1.
ENDLOOP.
ULINE.
**************APPEND*******************
WA-BUKRS = '1000'.
WA-BUTXT = 'IGROW SOFT'.
WA-LAND1 = 'IN'.
APPEND WA TO IT.
***********DISPLAY*************************
LOOP AT IT INTO WA.

WRITE :/ SY-TABIX,WA-BUKRS,WA-BUTXT,WA-LAND1.
ENDLOOP.
ULINE.
*********************INSERT**********************
WA-BUKRS = '2000'.
WA-BUTXT = 'EMAX TECH'.
WA-LAND1 = 'US'.
INSERT WA INTO IT INDEX 2.
INSERT WA INTO IT INDEX 4.
INSERT WA INTO IT INDEX 6.
***********DISPLAY*************************
LOOP AT IT INTO WA.
WRITE :/ SY-TABIX,WA-BUKRS,WA-BUTXT,WA-LAND1.
ENDLOOP.
ULINE.
******************SORT**************************
sort it by bukrs.
*SORT IT BY BUKRS DESCENDING.
***********DISPLAY*************************
LOOP AT IT INTO WA.
WRITE :/ SY-TABIX,WA-BUKRS,WA-BUTXT,WA-LAND1.
ENDLOOP.
ULINE.
*************D A D*********************
DELETE ADJACENT DUPLICATES FROM IT COMPARING BUKRS.
***********DISPLAY*************************
LOOP AT IT INTO WA.
WRITE :/ SY-TABIX,WA-BUKRS,WA-BUTXT,WA-LAND1.
ENDLOOP.
ULINE.
*****************DESCRIBE***********************
DATA V1 TYPE I.
DESCRIBE TABLE IT LINES V1.
WRITE :/ 'THE NUMBER OF RECRODS ARE', V1.
ULINE.
***************MODIFY***************************
WA-BUTXT = 'EMAX TECHNOLOGIES'.
WA-LAND1 = 'IN'.
MODIFY IT FROM WA TRANSPORTING BUTXT LAND1 WHERE BUKRS = '2000'.
***********DISPLAY*************************
LOOP AT IT INTO WA.
WRITE :/ SY-TABIX,WA-BUKRS,WA-BUTXT,WA-LAND1.
ENDLOOP.
ULINE.
*******************READ************************
*READ TABLE IT INTO WA INDEX 2.
*
READ TABLE IT INTO WA WITH KEY BUKRS = '1000'.
READ TABLE IT INTO WA WITH KEY BUKRS = '1000' BINARY SEARCH.
WRITE :/ WA-BUKRS,WA-BUTXT,WA-LAND1.
ULINE.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
*&--------------------------------------------------------------------*
*& Report Z7PM_UCOMM
*&
*&--------------------------------------------------------------------*

*&
*&
*&--------------------------------------------------------------------*
REPORT

Z7PM_UCOMM.

DATA WA TYPE T001.


DATA IT TYPE TABLE OF T001.
DATA V1.
SET PF-STATUS 'Z7PM'.
SELECT * FROM T001 INTO TABLE IT UP TO 10 ROWS.
PERFORM DISPLAY.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'DDIC'.
CALL TRANSACTION 'SE11'.
WHEN 'CLNT'.
CALL TRANSACTION 'SCC4'.
WHEN 'SALL'.
V1 = 'X'.
PERFORM DISPLAY.
WHEN 'DALL'.
V1 = ' '.
PERFORM DISPLAY.
ENDCASE.
*&--------------------------------------------------------------------*
*&
Form DISPLAY
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*---------------------------------------------------------------------*
FORM DISPLAY .
LOOP AT IT INTO WA.
WRITE :/ V1 AS CHECKBOX,WA-BUKRS,WA-BUTXT,WA-LAND1.
ENDLOOP.
ENDFORM.
" DISPLAY

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
*&--------------------------------------------------------------------*
*& Report Z10AM_IREPORT_HIDE
*&
*&--------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------

*
REPORT Z10AM_IREPORT_GETCURSOR NO STANDARD PAGE HEADING.
DATA WA1 TYPE KNA1.
DATA IT1 TYPE TABLE OF KNA1.
DATA WA2 TYPE KNBK.
DATA IT2 TYPE TABLE OF KNBK.
SELECT-OPTIONS S1 FOR WA1-KUNNR.
SELECT * FROM KNA1 INTO TABLE IT1 WHERE KUNNR IN S1.
LOOP AT IT1 INTO WA1.
WRITE :/ WA1-KUNNR,WA1-NAME1,WA1-ORT01.
ENDLOOP.
DATA F1(15).
DATA V1 TYPE KUNNR.
AT LINE-SELECTION.
GET CURSOR FIELD F1 VALUE V1.
IF F1 = 'WA1-KUNNR'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT
= V1
IMPORTING
OUTPUT
= V1
.
SELECT * FROM KNBK INTO TABLE IT2 WHERE KUNNR = V1.
LOOP AT IT2 INTO WA2.
WRITE :/ WA2-KUNNR,WA2-BANKS,WA2-BANKL,WA2-BANKN.
ENDLOOP.
ENDIF.
*&--------------------------------------------------------------------*
*& Report Z10AM_IREPORT_HIDE
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT Z10AM_IREPORT_HIDE NO STANDARD PAGE HEADING.
DATA WA1 TYPE KNA1.
DATA IT1 TYPE TABLE OF KNA1.
DATA WA2 TYPE KNBK.
DATA IT2 TYPE TABLE OF KNBK.
SELECT-OPTIONS S1 FOR WA1-KUNNR.
SELECT * FROM KNA1 INTO TABLE IT1 WHERE KUNNR IN S1.
LOOP AT IT1 INTO WA1.
WRITE :/ WA1-KUNNR,WA1-NAME1,WA1-ORT01.
HIDE WA1-KUNNR.
ENDLOOP.
AT LINE-SELECTION.
SELECT * FROM KNBK INTO TABLE IT2 WHERE KUNNR = WA1-KUNNR.
LOOP AT IT2 INTO WA2.
WRITE :/ WA2-KUNNR,WA2-BANKS,WA2-BANKL,WA2-BANKN.
ENDLOOP.

*&--------------------------------------------------------------------*
*& Report Z10AM_CREPORTS
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT Z10AM_CREPORTS NO STANDARD PAGE HEADING LINE-COUNT 10(1).
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS PBUKRS TYPE BUKRS.
PARAMETERS PBUTXT TYPE BUTXT.
SELECT-OPTIONS S1 FOR PBUKRS.
SELECTION-SCREEN END OF BLOCK B1.
DATA WA TYPE T001.
DATA IT TYPE TABLE OF T001.
initialization.
PBUKRS = '1000'.
S1-LOW = '1000'.
S1-HIGH = '2000'.
APPEND S1 TO S1.
AT SELECTION-SCREEN ON PBUKRS.
IF PBUKRS <> '1000'.
MESSAGE 'INVALID COMPANY CODE' TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN.
IF PBUTXT <> 'JK'.
MESSAGE 'INVALID NAME' TYPE 'E'.
ENDIF.
START-OF-SELECTION.
SELECT * FROM T001 INTO TABLE IT.
END-OF-SELECTION.
LOOP AT IT INTO WA.
WRITE :/ WA-BUKRS,WA-BUTXT,WA-LAND1.
ENDLOOP.
TOP-OF-PAGE.
WRITE 'COMPANY CODES' COLOR 3.
ULINE.
END-OF-PAGE.
ULINE.
***************************HIER ALVC*************************
*&--------------------------------------------------------------------*
*& Report ZDEMO_HIER_ALV
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT

ZDEMO_HIER_ALV.

TYPE-POOLS SLIS.
DATA ITF TYPE SLIS_T_FIELDCAT_ALV.
DATA IT1 TYPE TABLE OF EKKO.
DATA IT2 TYPE TABLE OF EKPO.
DATA LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA ITE TYPE SLIS_T_EVENT.
DATA KEYINFO TYPE SLIS_KEYINFO_ALV.
KEYINFO-HEADER01 = 'EBELN'.
"FIELD OF EKKO
KEYINFO-ITEM01 = 'EBELN'.
"FIELD OF EKPO
SELECT * FROM EKKO INTO TABLE IT1 UP TO 10 ROWS.
IF NOT IT1 IS INITIAL.
SELECT * FROM EKPO INTO TABLE IT2 FOR ALL ENTRIES IN IT1 WHERE EBELN =
IT1-EBELN.
ENDIF.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME
= SY-CPROG
I_INTERNAL_TABNAME
= 'IT1'
I_STRUCTURE_NAME
= 'EKKO'
CHANGING
CT_FIELDCAT
= ITF.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME
= SY-CPROG
I_INTERNAL_TABNAME
= 'IT2'
I_STRUCTURE_NAME
= 'EKPO'
CHANGING
CT_FIELDCAT
= ITF.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM
= SY-CPROG
IT_FIELDCAT
= ITF
I_TABNAME_HEADER
= 'IT1'
I_TABNAME_ITEM
= 'IT2'
IS_KEYINFO
= KEYINFO
TABLES
T_OUTTAB_HEADER
= IT1
T_OUTTAB_ITEM
= IT2.
**************************BLKED ALV********************************
*&--------------------------------------------------------------------*
*& Report ZDEMO_BLK_ALV
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT ZDEMO_BLK_ALV.
TYPE-POOLS SLIS.
DATA ITF TYPE SLIS_T_FIELDCAT_ALV.
DATA IT1 TYPE TABLE OF EKKO.
DATA IT2 TYPE TABLE OF EKPO.

DATA LAYOUT TYPE SLIS_LAYOUT_ALV.


DATA ITE TYPE SLIS_T_EVENT.
SELECT * FROM EKKO INTO TABLE IT1 UP TO 5 ROWS.
SELECT * FROM EKPO INTO TABLE IT2 UP TO 5 ROWS.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM
= SY-CPROG.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME
= SY-CPROG
I_INTERNAL_TABNAME
= 'IT1'
I_STRUCTURE_NAME
= 'EKKO'
CHANGING
CT_FIELDCAT
= ITF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT
= LAYOUT
IT_FIELDCAT
= ITF
I_TABNAME
= 'IT1'
IT_EVENTS
= ITE
TABLES
T_OUTTAB
= IT1.
REFRESH ITF.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME
= SY-CPROG
I_INTERNAL_TABNAME
= 'IT2'
I_STRUCTURE_NAME
= 'EKPO'
CHANGING
CT_FIELDCAT
= ITF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT
= LAYOUT
IT_FIELDCAT
= ITF
I_TABNAME
= 'IT2'
IT_EVENTS
= ITE
TABLES
T_OUTTAB
= IT2.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
********************CUSTOM FCAT***************************
*&--------------------------------------------------------------------*
*& Report ZDEMO_ALV_CFCAT
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*

REPORT ZDEMO_ALV_CFCAT.
TYPE-POOLS SLIS.
DATA ITS TYPE SLIS_T_SORTINFO_ALV.
DATA WAS TYPE slis_sortinfo_alv.
WAS-FIELDNAME = 'EBELN'.
WAS-SUBTOT = 'X'.
APPEND WAS TO ITS.
DATA ITF TYPE SLIS_T_FIELDCAT_ALV.
DATA WAF TYPE slis_fieldcat_alv.
WAF-COL_POS = 1.
WAF-FIELDNAME = 'EBELN'.
WAF-SELTEXT_L = 'PO NUMBER'.
WAF-HOTSPOT = 'X'.
APPEND WAF TO ITF.
CLEAR WAF.
WAF-COL_POS = 2.
WAF-FIELDNAME = 'EBELP'.
WAF-SELTEXT_L = 'PO ITEM'.
*WAF-NO_OUT = 'X'.
APPEND WAF TO ITF.
CLEAR WAF.
WAF-COL_POS = 3.
WAF-FIELDNAME = 'MATNR'.
WAF-SELTEXT_L = 'MAT NUM'.
WAF-EMPHASIZE = 'C311'.
APPEND WAF TO ITF.
CLEAR WAF.
WAF-COL_POS = 4.
WAF-FIELDNAME = 'NETPR'.
WAF-SELTEXT_L = 'PRICE'.
WAF-DO_SUM = 'X'.
APPEND WAF TO ITF.
CLEAR WAF.
TYPES :BEGIN OF STR,
EBELN TYPE EBELN,
EBELP TYPE EBELP,
MATNR TYPE MATNR,
NETPR TYPE NETPR,
END OF STR.
DATA IT TYPE TABLE OF STR.
SELECT EBELN EBELP MATNR NETPR FROM EKPO INTO TABLE IT UP TO 25 ROWS.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM
= SY-CPROG
*
I_STRUCTURE_NAME
=
IT_FIELDCAT
= ITF
IT_SORT
= ITS
TABLES
T_OUTTAB
= IT.
**********************ALV EVENTS&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&]
*&--------------------------------------------------------------------*

*& Report YDEMO_ALV_EVENTS


*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT YDEMO_ALV_EVENTS.
TYPE-POOLS SLIS.
DATA ITE TYPE SLIS_T_EVENT.
DATA WAE TYPE slis_alv_event.
WAE-NAME = 'TOP_OF_PAGE'.
"STANDARD EVENT NAME
WAE-FORM = 'HEADER'.
"USER DEFINED SUBROUTINES NAME
APPEND WAE TO ITE.
WAE-NAME = 'USER_COMMAND'.
"STANDARD EVENT NAME
WAE-FORM = 'SUB1'.
"USER DEFINED SUBROUTINES NAME
APPEND WAE TO ITE.
DATA IT1 TYPE TABLE OF EKKO.
DATA IT2 TYPE TABLE OF EKPO.
SELECT * FROM EKKO INTO TABLE IT1 UP TO 10 ROWS.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM
= SY-CPROG
I_STRUCTURE_NAME
= 'EKKO'
IT_EVENTS
= ITE
TABLES
T_OUTTAB
= IT1.
FORM HEADER.
DATA IT TYPE SLIS_T_LISTHEADER.
DATA WA TYPE slis_listheader.
WA-TYP = 'H'.
WA-INFO = 'PURCHASE ORDDERS'.
APPEND WA TO IT.
WA-TYP = 'S'.
WA-INFO = SY-UNAME.
APPEND WA TO IT.
WA-TYP = 'A'.
WA-INFO = SY-HOST.
APPEND WA TO IT.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY
= IT
I_LOGO
= 'ZLOGO'
*
I_END_OF_LIST_GRID
=
*
I_ALV_FORM
=
.
ENDFORM.
FORM SUB1 USING V1 LIKE SY-UCOMM V2 TYPE SLIS_SELFIELD.
IF V1 = '&IC1'.
"DOUBLE CLICK
SELECT * FROM EKPO INTO TABLE IT2 WHERE EBELN = V2-VALUE.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'


EXPORTING
I_CALLBACK_PROGRAM
= SY-CPROG
I_STRUCTURE_NAME
= 'EKPO'
IT_EVENTS
= ITE
TABLES
T_OUTTAB
= IT2.
ENDIF.
ENDFORM.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
*&--------------------------------------------------------------------*
*& Report YDEMO_BDC_CT
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT YDEMO_BDC_SESSION.
TYPES : BEGIN OF STR,
BANKS TYPE BANKS,
BANKL TYPE BANKL,
BANKA TYPE BANKA,
END OF STR.
DATA WA TYPE STR.
DATA IT TYPE TABLE OF STR.
DATA WA1 TYPE BDCDATA.
DATA IT1 TYPE TABLE OF BDCDATA.
* ***************UPLOAD***********************
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME
= 'C:\BANKS.TXT'
HAS_FIELD_SEPARATOR
= 'X'
TABLES
DATA_TAB
= IT
.
IF SY-SUBRC = 0.
WRITE :/ 'FILE UPLOADED SUCCESSFULLY'.
ULINE.
ENDIF.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT
= SY-MANDT
GROUP
= 'NIKIL'
KEEP
= 'X'
USER
= SY-UNAME.
*************BDC PROGRAM*******************
LOOP AT IT INTO WA.
WA1-PROGRAM = 'SAPMF02B'.
WA1-DYNPRO = '0100'.

WA1-DYNBEGIN = 'X'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_CURSOR'.
WA1-FVAL = 'BNKA-BANKL'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_OKCODE'.
WA1-FVAL = '/00'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BNKA-BANKS'.
WA1-FVAL = WA-BANKS.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BNKA-BANKL'.
WA1-FVAL = WA-BANKL.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-PROGRAM = 'SAPMF02B'.
WA1-DYNPRO = '0110'.
WA1-DYNBEGIN = 'X'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_CURSOR'.
WA1-FVAL = 'BNKA-BANKA'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_OKCODE'.
WA1-FVAL = '=UPDA'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BNKA-BANKA'.
WA1-FVAL = WA-BANKA.
APPEND WA1 TO IT1.
CLEAR WA1.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE
= 'FI01'
TABLES
DYNPROTAB
= IT1.
REFRESH IT1.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
*&--------------------------------------------------------------------*
*& Report YDEMO_BDC_CT
*&
*&--------------------------------------------------------------------*
*&

*&
*&--------------------------------------------------------------------*
REPORT YDEMO_BDC_CT.
TYPES : BEGIN OF STR,
BANKS TYPE BANKS,
BANKL TYPE BANKL,
BANKA TYPE BANKA,
END OF STR.
DATA WA TYPE STR.
DATA IT TYPE TABLE OF STR.
DATA WA1 TYPE BDCDATA.
DATA IT1 TYPE TABLE OF BDCDATA.
* ***************UPLOAD***********************
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME
= 'C:\BANKS.TXT'
HAS_FIELD_SEPARATOR
= 'X'
TABLES
DATA_TAB
= IT
.
IF SY-SUBRC = 0.
WRITE :/ 'FILE UPLOADED SUCCESSFULLY'.
ULINE.
ENDIF.
*************BDC PROGRAM*******************
LOOP AT IT INTO WA.
WA1-PROGRAM = 'SAPMF02B'.
WA1-DYNPRO = '0100'.
WA1-DYNBEGIN = 'X'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_CURSOR'.
WA1-FVAL = 'BNKA-BANKL'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_OKCODE'.
WA1-FVAL = '/00'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BNKA-BANKS'.
WA1-FVAL = WA-BANKS.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BNKA-BANKL'.
WA1-FVAL = WA-BANKL.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-PROGRAM = 'SAPMF02B'.
WA1-DYNPRO = '0110'.
WA1-DYNBEGIN = 'X'.
APPEND WA1 TO IT1.
CLEAR WA1.

WA1-FNAM = 'BDC_CURSOR'.
WA1-FVAL = 'BNKA-BANKA'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_OKCODE'.
WA1-FVAL = '=UPDA'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BNKA-BANKA'.
WA1-FVAL = WA-BANKA.
APPEND WA1 TO IT1.
CLEAR WA1.
DATA V1(100).
CALL TRANSACTION 'FI01' USING IT1 MODE 'N'.
IF SY-SUBRC <> 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID
= SY-MSGID
LANG
= SY-LANGU
NO
= SY-MSGNO
V1
= SY-MSGV1
V2
= SY-MSGV2
V3
= SY-MSGV3
V4
= SY-MSGV4
IMPORTING
MSG
= V1
*
EXCEPTIONS
*
NOT_FOUND
= 1
*
OTHERS
= 2
.
IF SY-SUBRC = 0.
WRITE V1.
ULINE.
ENDIF.
ENDIF.
REFRESH IT1.
ENDLOOP.
&&&&&&&&&&&&&&&&&&&&&&&&&LCL1&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
*&--------------------------------------------------------------------*
*& Report ZYDEMO_LCL1
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------&&&&&&&&&&&&&&&CLASSES&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*
REPORT ZYDEMO_LCL1.
CLASS C1 DEFINITION.
PUBLIC SECTION.
METHODS :M1 IMPORTING V1 TYPE I V2 TYPE I EXPORTING V3 TYPE I.
CLASS-METHODS:M2.

ENDCLASS.
CLASS C1 IMPLEMENTATION.
METHOD M1.
V3 = V1 + V2.
ENDMETHOD.
METHOD M2.
WRITE :/ 'STAIC METHOD'.
ULINE.
ENDMETHOD.
ENDCLASS.
DATA O1 TYPE REF TO C1.
START-OF-SELECTION.
CREATE OBJECT O1.
CALL METHOD C1=>M2.
DATA N1 TYPE I.
CALL METHOD O1->M1
EXPORTING
V1 = 67
V2 = 56
IMPORTING
V3 = N1.
WRITE N1.
ULINE.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
*&--------------------------------------------------------------------*
*& Report ZYDEMO_LCL1
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT ZYDEMO_LCL1.
CLASS C1 DEFINITION.
PUBLIC SECTION.
METHODS :M1 IMPORTING CCODE TYPE BUKRS EXPORTING WA TYPE T001.
ENDCLASS.
CLASS C1 IMPLEMENTATION.
METHOD M1.
SELECT SINGLE * FROM T001 INTO WA WHERE BUKRS = CCODE.
ENDMETHOD.
ENDCLASS.
DATA O1 TYPE REF TO C1.
START-OF-SELECTION.
CREATE OBJECT O1.
DATA WA1 TYPE T001.
PARAMETERS P1 TYPE BUKRS.
CALL METHOD O1->M1
EXPORTING
CCODE = P1
IMPORTING
WA = WA1.

WRITE :/ WA1-BUKRS,WA1-BUTXT,WA1-LAND1.
ULINE.
*&--------------------------------------------------------------------*
*& Report ZYDEMO_LCL1
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT ZYDEMO_LCL1.
TYPES TY_EKPO TYPE TABLE OF EKPO.
CLASS C1 DEFINITION.
PUBLIC SECTION.
METHODS :M1 IMPORTING PONO TYPE EBELN EXPORTING IT TYPE TY_EKPO.
ENDCLASS.
CLASS C1 IMPLEMENTATION.
METHOD M1.
SELECT * FROM EKPO INTO TABLE IT WHERE EBELN = PONO.
ENDMETHOD.
ENDCLASS.
DATA O1 TYPE REF TO C1.
START-OF-SELECTION.
CREATE OBJECT O1.
DATA WA TYPE EKPO.
DATA IT1 TYPE TY_EKPO.
*
DATA IT1 TYPE TABLE OF EKPO.
PARAMETERS P1 TYPE EBELN.
CALL METHOD O1->M1
EXPORTING
PONO = P1
IMPORTING
IT = IT1.
LOOP AT IT1 INTO WA.
WRITE :/ WA-EBELN,WA-EBELP,WA-MATNR,WA-NETPR.
ENDLOOP.
ULINE.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*&--------------------------------------------------------------------*
*& Report ZYDEMO_INTERFACES
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT

ZYDEMO_INTERFACES.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

PARAMETERS CUSTOMER RADIOBUTTON GROUP G1.


PARAMETERS VENDER RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS CREATE RADIOBUTTON GROUP G2.
PARAMETERS CHANGE RADIOBUTTON GROUP G2.
SELECTION-SCREEN END OF BLOCK B2.
INTERFACE I1.
METHODS :CREATE,CHANGE.
ENDINTERFACE.
CLASS C1 DEFINITION.
PUBLIC SECTION.
INTERFACES :I1.
ENDCLASS.
CLASS C1 IMPLEMENTATION.
METHOD I1~CREATE.
CALL TRANSACTION 'XD01'.
ENDMETHOD.
METHOD I1~CHANGE.
CALL TRANSACTION 'XD02'.
ENDMETHOD.
ENDCLASS.
CLASS V1 DEFINITION.
PUBLIC SECTION.
INTERFACES :I1.
ENDCLASS.
CLASS V1 IMPLEMENTATION.
METHOD I1~CREATE.
CALL TRANSACTION 'MK01'.
ENDMETHOD.
METHOD I1~CHANGE.
CALL TRANSACTION 'MK02'.
ENDMETHOD.
ENDCLASS.
DATA OC TYPE REF TO C1.
DATA OV TYPE REF TO V1.
DATA OI TYPE REF TO I1.
START-OF-SELECTION.
CREATE OBJECT : OC,OV.
IF CUSTOMER = 'X'.
OI = OC.
ELSE.
OI = OV.
ENDIF.
IF CREATE = 'X'.
CALL METHOD OI->CREATE.
ELSE.
CALL METHOD OI->CHANGE.
ENDIF.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

*&--------------------------------------------------------------------*
*& Report ZDEMO_CONSTRUCTORS
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT ZDEMO_CONSTRUCTORS NO STANDARD PAGE HEADING.
CLASS C1 DEFINITION.
PUBLIC SECTION.
METHODS :CONSTRUCTOR IMPORTING NAME TYPE STRING.
CLASS-METHODS:CLASS_CONSTRUCTOR.
ENDCLASS.
CLASS C1 IMPLEMENTATION.
METHOD CONSTRUCTOR.
WRITE :/ 'HELLO',NAME.
ULINE.
ENDMETHOD.
METHOD CLASS_CONSTRUCTOR.
WRITE :/ 'STATIC CONSTRUCTOR'.
ULINE.
ENDMETHOD.
ENDCLASS.
DATA O1 TYPE REF TO C1.
DATA O2 TYPE REF TO C1.
START-OF-SELECTION.
CREATE OBJECT O1 EXPORTING NAME = 'LOKESH'.
CREATE OBJECT O2 EXPORTING NAME = 'CHANDU'.
*&--------------------------------------------------------------------*
*& Report ZYDEMO_CALL_GCL
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT

ZYDEMO_CALL_GCL.

*DATA O1 TYPE REF TO ZCL_CL1.


*START-OF-SELECTION.
*CREATE OBJECT O1.
*DATA N1 TYPE I.
*CALL METHOD O1->M1
* EXPORTING
*
V1
= 45
*
V2
= 54
* IMPORTING
*
V3
= N1
*
.

*
*WRITE N1.
*ULINE.
*CALL METHOD ZCL_CL1=>M2
*
.
DATA IT TYPE TABLE OF EKPO.
SELECT * FROM EKPO INTO TABLE IT UP TO 10 ROWS.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME
= 'C:\POITEMS.TXT'
WRITE_FIELD_SEPARATOR
= 'X'
CHANGING
DATA_TAB
= IT
.
IF SY-SUBRC = 0.
WRITE :/ 'FILE DLOADED SUCCESSFULLY'.
ENDIF.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

*&--------------------------------------------------------------------*
*& Report Z10AM_CL_EVENTS
*&
*&--------------------------------------------------------------------*
*&
*&
*&--------------------------------------------------------------------*
REPORT Z10AM_CL_EVENTS.
CLASS C1 DEFINITION.
PUBLIC SECTION.
EVENTS E1.
"defining event
METHODS :ADDS IMPORTING V1 TYPE I,
EHM FOR EVENT E1 OF C1. "event handler method
ENDCLASS.
CLASS C1 IMPLEMENTATION.
METHOD ADDS.
WRITE V1.
IF V1 > 100.
RAISE EVENT E1.
"TRIGGERRING EVENT
ENDIF.
ENDMETHOD.
METHOD EHM.
"IMPLEMENTATION OF EVENT HANDELR METHOD
WRITE / 'INPUT SHOULD BE LESS THAN 100'.
ENDMETHOD.
ENDCLASS.
DATA O1 TYPE REF TO C1.
START-OF-SELECTION.
CREATE OBJECT O1.
SET HANDLER O1->EHM FOR O1. "REGISTER EVENT HANDLER METHOD TO OBJECT
O1
CALL METHOD O1->adds

EXPORTING
V1 = 819.