Saturday, December 23, 2006

Thanks for every one

Hi All,
Thanks for your overwhelming response. Till date, this blog has attracted 400+ visitors and 2000 clicks for the last two months. The visitors are from different parts of the world. Many visitors are from India, United States, London. Thanks for one and all for your response. This gives me a great energy to continue the blog. In the following days, i will try to make this blog more interesting and helpful.
Future posts:
1) How to write technical specification
2) Planning to post ABAP Lessons

3) Real time business scenarios, at least two example objects in each division.

I request all of you to write comments on my posts.
All th
e best -
Best Regards,

Mr Reddy.


You are the Reason for the success of this blog. Please find the Visitors from different parts of the world.

Example Report 2

*-----------------------------------------------------------------------
* PROGRAM SPECIFICATION *
*----------------------------------------------------------------------*
* Consultant Name :
* Programmer Name :
* Programming Date :
* *
* Report Title : PURCHASE ORDER DETAIL
* *
* Description : This program prints out the purchase order
* detail of goods received with PO number
* posted to GR blocked stock.
* The purchase order detail include a portion
* of empty QC data fields for IQC to fill-in.
* *
* INPUT:
* Logical Database : None *
*Database Tables :
* Database Tables : MSEG, "Document Segment:
* MKPF, "Header: Material Document
* MARA, "Material Master: General Data
* MAKT, "Material Descriptions
* EKKO, "Purchasing Document Header
* EKPO, "Purchasing Document Item
* EKET, "Delivery Schedules
* CABN, "Characteristic
* AUSP, "Characteristic Values
* LFA1. "Vendor master
*
* *
* Tables : None *
* *
* SELECTION: *
* Select-Options : None *
* Parameters : docno for material document no. *
* year for material document year *
*
* PROCESS: *
* 1. Print out the report for goods receipt performed for GR Blocked
* stock.
* 2. From the Material document number generated,pick up the PO number,
* material code,received quantity,DO number, and delivery date.
* 3. From the PO number pick up the unit price,ordered qty,tracking no,
* vendor no and vendor material no from the purchasing document.
* 4. From the vendor no pick up the supplier name and county key in the
* vendor master.
* 5. From the material number,pick up the MPN,drawing number,description
* and NSN number in the material master.
* 6. Output the extracted fields to the report.
* *
* OUTPUT: *
* Database Tables : None *
* Dataset Name : None *
* Report : none *
* Sort Fields : Item no in material document *
*----------------------------------------------------------------------*
* Modification Number : *
* Analyst : *
* Specification Date : DD.MM.YYYY *
* Programmer : *
* Programming Date : DD.MM.YYYY *
* Description : *
* *
* *
*
*----------------------------------------------------------------------*
REPORT ZSOMTEST1 MESSAGE-ID M7
NO STANDARD PAGE HEADING
LINE-SIZE 218
LINE-COUNT 56.
*----------------------------------------------------------------------*
* DECLARATION SECTION *
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* TABLES *
*----------------------------------------------------------------------*

TABLES: MSEG, "Document Segment: Material
MKPF, "Header: Material Document
MARA, "Material Master: General Data
MAKT, "Material Descriptions
EKKO, "Purchasing Document Header
EKPO, "Purchasing Document Item
EKET, "Delivery Schedules
CABN, "Characteristic
AUSP, "Characteristic Values
LFA1. "Vendor master
*----------------------------------------------------------------------*
* INTERNAL TABLES *
*----------------------------------------------------------------------*
* STRUCTURE TO HOLD DATA

DATA: BEGIN OF IMSEG OCCURS 0,
MBLNR LIKE MSEG-MBLNR,
MATNR LIKE MSEG-MATNR,
LIFNR LIKE MSEG-LIFNR,
BSTMG LIKE MSEG-BSTMG,
EBELN LIKE MSEG-EBELN,
EBELP LIKE MSEG-EBELP,
ZEINR LIKE MARA-ZEINR,
MFRPN LIKE MARA-MFRPN,
EINDT LIKE EKET-EINDT,
MAKTX LIKE MAKT-MAKTX,
BEDNR LIKE EKPO-BEDNR,
CC LIKE AUSP-ATWRT,
IDNLF LIKE EKPO-IDNLF,
MENG LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
PEINH LIKE EKPO-PEINH,
BANFN LIKE EKPO-BANFN,
ATWRT LIKE AUSP-ATWRT,
ZEILE LIKE MSEG-ZEILE,
END OF IMSEG.

DATA: BEGIN OF ITLINE OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF ITLINE.

DATA: BEGIN OF ILFA1 OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
LAND1 LIKE LFA1-LAND1,
NAME1 LIKE LFA1-NAME1,
END OF ILFA1.

DATA: BEGIN OF IEKPO OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
BEDNR LIKE EKPO-BEDNR,
IDNLF LIKE EKPO-IDNLF,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
PEINH LIKE EKPO-PEINH,
END OF IEKPO.

DATA: BEGIN OF IMKPF ,
MBLNR LIKE MKPF-MBLNR,
BUDAT LIKE MKPF-BUDAT,
XBLNR LIKE MKPF-XBLNR,
END OF IMKPF.

DATA: BEGIN OF IMARA OCCURS 0,
MATNR LIKE MARA-MATNR,
ZEINR LIKE MARA-ZEINR,
MFRPN LIKE MARA-MFRPN,
END OF IMARA.

DATA: BEGIN OF IEKET OCCURS 0,
EBELN LIKE EKET-EBELN,
EBELP LIKE EKET-EBELP,
BANFN LIKE EKET-BANFN,
EINDT LIKE EKET-EINDT,
END OF IEKET.

DATA: BEGIN OF IEKKO, " OCCURS 0,
EBELN LIKE EKKO-EBELN,
BEDAT LIKE EKKO-BEDAT,
WAERS LIKE EKKO-WAERS,
END OF IEKKO.

DATA: BEGIN OF IMAKT OCCURS 0,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
END OF IMAKT.

DATA: BEGIN OF IAUSP OCCURS 0,
OBJEK LIKE AUSP-OBJEK,
ATWRT LIKE AUSP-ATWRT,
END OF IAUSP.
*----------------------------------------------------------------------*
* WORKING VARIABLES *
*----------------------------------------------------------------------*

DATA : CHARNO LIKE AUSP-ATINN.
DATA: TEXT-NAME LIKE THEAD-TDNAME.
*----------------------------------------------------------------------*
* SELECTION PARAMETERS *
*----------------------------------------------------------------------*

SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
PARAMETERS DOCNO LIKE MSEG-MBLNR MATCHCODE OBJECT MBMP.
PARAMETERS YEAR LIKE MKPF-MJAHR.
SELECTION-SCREEN END OF BLOCK BLK.
*----------------------------------------------------------------------*
* VALIDATION OF SELECTION PARAMETERS
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON DOCNO.
IF DOCNO IS INITIAL.
MESSAGE E018(M7) WITH 'Material Doc no'.
ENDIF.
IF NOT DOCNO IS INITIAL.
SELECT * FROM MKPF
WHERE MBLNR = DOCNO.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E063(M7) WITH DOCNO.
ENDIF.
ENDIF.

AT SELECTION-SCREEN ON YEAR.
IF YEAR IS INITIAL.
MESSAGE E018(M7) WITH 'Material Doc. year'.
ENDIF.
IF NOT YEAR IS INITIAL.
SELECT * FROM MKPF
WHERE MBLNR = DOCNO
AND MJAHR = YEAR.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E062(M7) WITH DOCNO YEAR.
ENDIF.
ENDIF.

AT SELECTION-SCREEN ON BLOCK BLK.
IF NOT DOCNO IS INITIAL.
SELECT * FROM MSEG
WHERE MBLNR = DOCNO
AND BWART = '103'.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E018(M7) WITH 'Doc. no of mvt type 103'.
ENDIF.
ENDIF.

*----------------------------------------------------------------------*
* HEADER TEXTS *
*----------------------------------------------------------------------*

TOP-OF-PAGE.
PERFORM TEXT.

*----------------------------------------------------------------------*
* PROCESSING *
*----------------------------------------------------------------------*

START-OF-SELECTION.

SELECT * FROM MKPF INTO CORRESPONDING FIELDS OF IMKPF
WHERE MBLNR = DOCNO
AND MJAHR = YEAR .
ENDSELECT.

SELECT ZEILE MBLNR MATNR LIFNR BSTMG EBELN EBELP
FROM MSEG INTO CORRESPONDING FIELDS OF TABLE IMSEG
WHERE MBLNR = DOCNO
AND MJAHR = YEAR
AND BWART = '103'.

LOOP AT IMSEG.
SELECT SINGLE * FROM EKKO INTO CORRESPONDING FIELDS OF IEKKO
WHERE EBELN = IMSEG-EBELN.

SELECT SINGLE * FROM LFA1 INTO CORRESPONDING FIELDS OF ILFA1
WHERE LIFNR = IMSEG-LIFNR.

ENDLOOP.

SELECT ATINN FROM CABN INTO CHARNO WHERE ATNAM = 'NSN'.
ENDSELECT.

SELECT EBELN EBELP BEDNR IDNLF MENGE MEINS NETPR PEINH
FROM EKPO INTO CORRESPONDING FIELDS OF TABLE IEKPO
FOR ALL ENTRIES IN IMSEG
WHERE EBELN = IMSEG-EBELN
AND EBELP = IMSEG-EBELP.

SELECT MATNR ZEINR MFRPN
FROM MARA INTO CORRESPONDING FIELDS OF TABLE IMARA
FOR ALL ENTRIES IN IMSEG
WHERE MATNR = IMSEG-MATNR.

SELECT EBELN EBELP EINDT BANFN
FROM EKET INTO CORRESPONDING FIELDS OF TABLE IEKET
FOR ALL ENTRIES IN IMSEG
WHERE EBELN = IMSEG-EBELN
AND EBELP = IMSEG-EBELP.

SELECT MATNR MAKTX
FROM MAKT INTO CORRESPONDING FIELDS OF TABLE IMAKT
FOR ALL ENTRIES IN IMSEG
WHERE MATNR = IMSEG-MATNR.
DATA OBJ LIKE AUSP-OBJEK.

LOOP AT IMSEG.
MOVE IMSEG-MATNR TO OBJ.
SELECT * FROM AUSP WHERE OBJEK = OBJ
AND ATINN = CHARNO
AND MAFID = 'O'
AND KLART = '001'.
MOVE-CORRESPONDING AUSP TO IAUSP.
APPEND IAUSP.
ENDSELECT.
PERFORM CRITICALITY_CODE.
CLEAR OBJ.
MODIFY IMSEG.
ENDLOOP.

LOOP AT IMSEG.
READ TABLE IMARA WITH KEY MATNR = IMSEG-MATNR.
MOVE IMARA-ZEINR TO IMSEG-ZEINR.
MOVE IMARA-MFRPN TO IMSEG-MFRPN.
READ TABLE IMAKT WITH KEY MATNR = IMSEG-MATNR.
MOVE IMAKT-MAKTX TO IMSEG-MAKTX.
READ TABLE IEKPO WITH KEY EBELN = IMSEG-EBELN EBELP = IMSEG-EBELP.
MOVE IEKPO-IDNLF TO IMSEG-IDNLF.
MOVE IEKPO-NETPR TO IMSEG-NETPR.
MOVE IEKPO-MENGE TO IMSEG-MENG.
MOVE IEKPO-MEINS TO IMSEG-MEINS.
* move iekpo-bednr to imseg-bednr.
MOVE IEKPO-PEINH TO IMSEG-PEINH.
READ TABLE IEKET WITH KEY EBELN = IMSEG-EBELN EBELP = IMSEG-EBELP.
MOVE IEKET-BANFN TO IMSEG-BANFN.
MOVE IEKET-EINDT TO IMSEG-EINDT.
READ TABLE IAUSP WITH KEY OBJEK = IMSEG-MATNR.
MOVE IAUSP-ATWRT TO IMSEG-ATWRT.
MODIFY IMSEG.
CLEAR: IMARA,IMAKT,IEKPO,IEKET,IAUSP.
ENDLOOP.

SORT IMSEG BY ZEILE.
LOOP AT IMSEG.
AT NEW ZEILE.
PERFORM VALUE.
ENDAT.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form TEXT
*&---------------------------------------------------------------------*
* FORATTING FOR HEADER TEXT
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM TEXT.
WRITE: 80 'SINGAPORE TECHNOLOGIES ELECTRONICS LIMITED'
COLOR COL_HEADING INTENSIFIED ON,
195 'DATE:'
COLOR COL_HEADING INTENSIFIED ON,
202 SY-DATUM
COLOR COL_BACKGROUND INTENSIFIED OFF.
SKIP.
WRITE: 90 'PURCHASE ORDER DETAIL'
COLOR COL_HEADING INTENSIFIED ON,
195 'PAGE:'
COLOR COL_HEADING INTENSIFIED ON,
202 SY-PAGNO
COLOR COL_BACKGROUND INTENSIFIED OFF.
SKIP 2.

WRITE: 'MAT DOC NO:'
COLOR COL_HEADING INTENSIFIED ON,
014 IMKPF-MBLNR
COLOR COL_BACKGROUND INTENSIFIED OFF,
/ 'PO NO:'
COLOR COL_HEADING INTENSIFIED ON,
014 IEKKO-EBELN
COLOR COL_BACKGROUND INTENSIFIED OFF,
150 'SUPPLIER NUMBER:'
COLOR COL_HEADING INTENSIFIED ON,
167 ILFA1-LIFNR
COLOR COL_BACKGROUND INTENSIFIED OFF,
'TYPE:'
COLOR COL_HEADING INTENSIFIED ON.
IF ILFA1-LAND1 = 'SG'.
WRITE 185 'LOCAL'
COLOR COL_BACKGROUND INTENSIFIED OFF.
ELSE.
WRITE 185 'OVERSEA'
COLOR COL_BACKGROUND INTENSIFIED OFF.
ENDIF.
WRITE: / 'PO DATE:'
COLOR COL_HEADING INTENSIFIED ON,
014 IEKKO-BEDAT
COLOR COL_BACKGROUND INTENSIFIED OFF,
150 'SUPPLIER NAME:'
COLOR COL_HEADING INTENSIFIED ON,
167 ILFA1-NAME1
COLOR COL_BACKGROUND INTENSIFIED OFF,
/ 'DO NO:'
COLOR COL_HEADING INTENSIFIED ON,
014 IMKPF-XBLNR
COLOR COL_BACKGROUND INTENSIFIED OFF,
030 'DELIVERY DATE:'
COLOR COL_HEADING INTENSIFIED ON,
IMKPF-BUDAT
COLOR COL_BACKGROUND INTENSIFIED OFF,
060 'CURRENCY:'
COLOR COL_HEADING INTENSIFIED ON,
IEKKO-WAERS
COLOR COL_BACKGROUND INTENSIFIED OFF.
ULINE.
FORMAT COLOR COL_KEY INTENSIFIED ON.
WRITE: /001 SY-VLINE,
002 'S/N',
006 'MATERIAL CODE',
043 'UOM',
055 '[_________________ FOR STORE USE ONLY
________________]',
133 '[_________________ FOR IQC USE ONLY
________________________]',
SY-VLINE,

/ SY-VLINE,
006 'NSN',
057(11) 'UNIT PRICE' RIGHT-JUSTIFIED,
069(13) 'PO QTY' RIGHT-JUSTIFIED,
083(13) 'RECEIVED QTY' RIGHT-JUSTIFIED,
101 'PR NO',
108 'EST DEL',
119 'QTY',
135 'QTY',
142 'QTY',
149 'QTY',
156 'QTY',
163 'P/N',
168 'PHY',
173 'S/L',
178 'R-NO',
187 'REMARKS',
218 SY-VLINE,
/001 SY-VLINE,
006 'VENDOR PART NO',
043 'CC',
108 'DATE',
119 'IN P/L',
135 'ACCD',
142 'REJD',
149 'O/S',
156 'CNT',
163 'FCT',
168 'DOC',
173 'PSERV',
218 SY-VLINE,
/001 SY-VLINE,
006 'MPN',
218 SY-VLINE,
/001 SY-VLINE,
006 'DRAWING NUMBER',
218 SY-VLINE,
/001 SY-VLINE,
006 'DESCRIPTION',
218 SY-VLINE.
ULINE.
ENDFORM. " TEXT

*&---------------------------------------------------------------------*
*& Form VALUE
*&---------------------------------------------------------------------*
* FORMATTING OF VALUES
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM VALUE.
FORMAT COLOR COL_BACKGROUND INTENSIFIED OFF.
RESERVE 7 LINES.
WRITE: /002(4) IMSEG-ZEILE+1(3),
006(35) IMSEG-MATNR.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE: 043(3) IMSEG-MEINS,
057(11) IMSEG-NETPR,
069(13) IMSEG-MENG,
083(13) IMSEG-BSTMG,
097(10) IMSEG-BANFN,
108(10) IMSEG-EINDT.
FORMAT COLOR COL_BACKGROUND INTENSIFIED OFF.
WRITE: 163 '[ ]',
168 '[ ]',
173 '[ ]',
/006 IMSEG-ATWRT,
119 '______',
135 '______',
142 '______',
149 '______',
156 '______',
163 '[ ]',
168 '[ ]',
173 '[ ]',
178 '______',
/006 IMSEG-IDNLF.
* 043 imseg-bednr,
* 043 imseg-cc,
IF NOT IMSEG-MATNR IS INITIAL.
WRITE: 043 IMSEG-CC.
ELSE.
CONCATENATE IMSEG-EBELN IMSEG-EBELP INTO TEXT-NAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'F07'
LANGUAGE = SY-LANGU
NAME = TEXT-NAME
OBJECT = 'EKPO'
* ARCHIVE_HANDLE = 0
* IMPORTING
* HEADER =
TABLES
LINES = ITLINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT ITLINE.
WRITE : 46 ITLINE-TDLINE.
ENDLOOP.
REFRESH ITLINE.
ENDIF.

WRITE: 119 SY-ULINE(99),
/006 IMSEG-MFRPN,
163 '[ ]',
168 '[ ]',
173 '[ ]',
/006 IMSEG-ZEINR,
119 '______',
135 '______',
142 '______',
149 '______',
156 '______',
163 '[ ]',
168 '[ ]',
173 '[ ]',
178 '______',
/006 IMSEG-MAKTX.
ULINE.
CLEAR: IMSEG,IMKPF,IEKKO,ILFA1,DOCNO.

ENDFORM. " VALUE
*&---------------------------------------------------------------------*
*& Form CRITICALITY_CODE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CRITICALITY_CODE.

IF NOT IMSEG-MATNR IS INITIAL.
CLEAR: CABN, AUSP.
SELECT SINGLE * FROM CABN WHERE ATNAM = 'CRITICALITY_CODE'.
SELECT SINGLE * FROM AUSP WHERE OBJEK = IMSEG-MATNR
AND ATINN = CABN-ATINN
AND MAFID = 'O'
AND KLART = '001'.
MOVE AUSP-ATWRT TO IMSEG-CC.
ENDIF.
ENDFORM. " CRITICALITY_CODE

Friday, December 22, 2006

Example Report

REPORT ZMMR7018
NO STANDARD PAGE HEADING
LINE-SIZE 132
LINE-COUNT 65(0)
MESSAGE-ID ZMM.
*-----------------------------------------------------------------------
* PROGRAM SPECIFICATION *
*----------------------------------------------------------------------*
* Programming Date :
* *
* Report Title : Issue Record file

* Description : This program creates a report,which list
* out all the materials issued to a service
* order with the issued qty and outstanding
* well qty.This report include planned issued as
* as unplanned issued.For unplanned issued,
* reservation no, required qty, date raised,
* qty duesout info will not be available.
*
*
* INPUT:
* Logical Database: None
* Database tables : mesg,mkpf,mara,makt,ausp,resb.
* Tables : None
*----------------------------------------------------------------------*
*SELECTION:
* Select-options : None.
* Parameters : Order like aufk-aufnr. " For Order no.
*----------------------------------------------------------------------*
*PROCESS:
* Planned issued to service order
* 1. User will enter the servie order no. to execute the report.
* 2. Select all the reservation items from RESB table using the service
* order number. There will be only one reservation no. as one service
* order can generate one reservation only.
* 3. Access the selected records sequentially. With the Order No.,
* reservation no., material code and reservation item no. access
* MSEG table, pick up records for MVT 261 and 262.
* 4. Subtract the issued quantity for records with mvmnt 261 by return
* quantity for records with mvmnt type 262.
* 5. If the item was issued from consignment stock, update the customer
* issue field else update the ST Elect issue.
* 6. Repeat step 3 to 5 until all selected records are processed.
*
* Unplanned issued to service order
* 7. With the input service order no., access MSEG table, select records
* with mvmnt type 261 and 262, reservation no is blank.
* 8. Sort the selected records by material code, special stock
* indicator and movement type.
* 9. Access the selected records sequentially.
* 10. Calculate the unplanned issue qty for an item from ST Elect stock
* to a service order, by subtracting issued qty for records with
* mvmnt 261 by returned qty for records with mvmnt 262 and special
* stock indicator equal to blank.
* 11. Calculate the unplanned issue qty for an item from Mindef stock
* to a service order, by subtracting issued qty for records with
* mvmnt 261 by returned qty for records with mvmnt 262 and special
* stock indicator equal to K.
* 12. Repeat step 8 to step 10 until all records have been proessed.
* 13. Output report as the specified format.
*
* Output:
* Database Tables : None.
* Dataset Name : None.
* Report : Issue record file
* Sort Fields : Reservation No., Desc, Matl code, Date raised
* Page Breaks : None
*----------------------------------------------------------------------*
* Modification Number :
* Analyst : *
* Specification Date : DD.MM.YYYY *
* Programmer :
* Programming Date : *
* Description : Issue Record File
*
*-----------------------------------------------------------------------
*----------------------------------------------------------------------*
* TABLES AND DATA DECLARATION *
*----------------------------------------------------------------------*
TABLES : MKPF, " Material Document - Header detail
MSEG, " Material Document - Item Detail
MARA, " Material master : General data
MAKT, " Material description
AUSP, " Characteristics Values
RESB. " Reservation/dependent requirements

DATA : C_PLAND TYPE C, " Planned issue indicator
C_UNPLND TYPE C, " Unplanned issue indicator
P_ENMNG LIKE RESB-ENMNG, " Issued qty. - Total
P_ENMNGU LIKE RESB-ENMNG, " Issued qty. - Total
P_MENGE LIKE MSEG-MENGE, " ST Elect issue qty.
P_MENGEU LIKE MSEG-MENGE, " ST Elect issue qty.
P_MENGK LIKE MSEG-MENGE, " Mindef vendor consignment issue qty.
P_MENGKU LIKE MSEG-MENGE. " Mindef vendor consignment issue qty.
*----------------------------------------------------------------------*
* Internal Table Declaration *
*----------------------------------------------------------------------*
DATA : BEGIN OF ITAB OCCURS 0,
AUFNR LIKE RESB-AUFNR, " Service order number
RSNUM LIKE RESB-RSNUM, " Reservation number
RSPOS LIKE RESB-RSPOS, " Reservation item no.
MATNR LIKE MSEG-MATNR, " Material code
BDTER LIKE RESB-BDTER, " Date raised
NSN LIKE CAWN-ATWRT, " Nato serial number
MFRPN LIKE MARA-MFRPN, " Manufacturer part number
MAKTX LIKE MAKT-MAKTX, " Material description
PDUES LIKE RESB-ENMNG, " Qty. Outstanding
ENMNG LIKE RESB-ENMNG, " Issued qty.
BDMNG LIKE RESB-BDMNG, " Requirements quantity
BWART LIKE MSEG-BWART, " Movement type
MENGE1 LIKE MSEG-MENGE, " ST Elect issue qty. mvmnt type 261
MENGE2 LIKE MSEG-MENGE, " ST Elect issue qty. mvmnt type 262
MENGK1 LIKE MSEG-MENGE, " Mindef consignment issue qty. - 261
MENGK2 LIKE MSEG-MENGE. " Mindef consignment issue qty. - 262
DATA : END OF ITAB.

DATA : BEGIN OF ITAB1 OCCURS 0,
AUFNR LIKE RESB-AUFNR, " Service order number
RSNUM LIKE RESB-RSNUM, " Reservation number
RSPOS LIKE RESB-RSPOS, " Reservation item no.
MATNR LIKE MSEG-MATNR, " Material code
NSN LIKE CAWN-ATWRT, " Nato serial number
MFRPN LIKE MARA-MFRPN, " Manufacturer part number
MAKTX LIKE MAKT-MAKTX, " Material description
BDTER LIKE RESB-BDTER, " Date raised
BWART LIKE MSEG-BWART, " Movement type
MENGEU1 LIKE MSEG-MENGE, " ST Elect issue qty. mvmnt type 261
MENGEU2 LIKE MSEG-MENGE, " ST Elect issue qty. mvmnt type 262
MENGKU1 LIKE MSEG-MENGE, " Mindef consignment issue qty. - 261
MENGKU2 LIKE MSEG-MENGE. " Mindef consignment issue qty. - 262
DATA : END OF ITAB1.

DATA: BEGIN OF REC.
INCLUDE STRUCTURE ITAB.
DATA: END OF REC.

DATA: BEGIN OF REC1.
INCLUDE STRUCTURE ITAB1.
DATA: END OF REC1.

DATA: IMAKT LIKE MAKT OCCURS 0 WITH HEADER LINE,
IMARA LIKE MARA OCCURS 0 WITH HEADER LINE,
IRESB LIKE RESB OCCURS 0 WITH HEADER LINE,
IMSEG LIKE MSEG OCCURS 0 WITH HEADER LINE.
*----------------------------------------------------------------------*
* SELECTION SCREEN *
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK BLK1
WITH FRAME TITLE TEXT-001.
PARAMETERS : P_AUFNR LIKE AUFK-AUFNR OBLIGATORY. " Service order no.
SELECTION-SCREEN END OF BLOCK BLK1.

AT SELECTION-SCREEN.
SELECT SINGLE * FROM MSEG WHERE AUFNR = P_AUFNR.
IF SY-SUBRC NE 0.
MESSAGE E201 WITH P_AUFNR. " No GI document for Order no.
ENDIF.
CLEAR C_PLAND.
SELECT SINGLE * FROM RESB WHERE AUFNR = P_AUFNR.
IF SY-SUBRC = 0.
C_PLAND = 'Y'. " planned issue indicator
ENDIF.
*----------------------------------------------------------------------*
* START OF SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
SELECT * FROM MSEG INTO TABLE IMSEG
WHERE AUFNR = P_AUFNR
AND ( BWART = '261' OR BWART = '262' ).

*/ Selecting planned issue data from tables RESB, MSEG.
IF C_PLAND EQ 'Y'.
PERFORM GET_PLANNED_ISSUE_DATA.
ENDIF.
*/ Selecting unplanned issue data from table MSEG.
PERFORM GET_UNPLANNED_ISSUE_DATA.

SELECT * FROM MAKT INTO TABLE IMAKT WHERE SPRAS = 'E'
ORDER BY MATNR.
SELECT * FROM MARA INTO TABLE IMARA ORDER BY MATNR.

LOOP AT ITAB.
CLEAR IMAKT.
READ TABLE IMAKT WITH KEY MATNR = ITAB-MATNR BINARY SEARCH.
MOVE IMAKT-MAKTX TO ITAB-MAKTX. " Material description

CLEAR IMARA.
READ TABLE IMARA WITH KEY MATNR = ITAB-MATNR BINARY SEARCH.
MOVE IMARA-MFRPN TO ITAB-MFRPN. " Manufacturer part no.

PERFORM GET_NSN_DATA USING ITAB-MATNR
CHANGING ITAB-NSN. " Nato Serial Number

MODIFY ITAB.
CLEAR ITAB.
ENDLOOP.
LOOP AT ITAB1.
CLEAR IMAKT.
READ TABLE IMAKT WITH KEY MATNR = ITAB1-MATNR BINARY SEARCH.
MOVE IMAKT-MAKTX TO ITAB1-MAKTX. " Material description

CLEAR IMARA.
READ TABLE IMARA WITH KEY MATNR = ITAB1-MATNR BINARY SEARCH.
MOVE IMARA-MFRPN TO ITAB1-MFRPN. " Manufacturer part no.

PERFORM GET_NSN_DATA USING ITAB1-MATNR
CHANGING ITAB1-NSN. " Nato Serial Number

MODIFY ITAB1.
CLEAR ITAB1.
ENDLOOP.

*----------------------------------------------------------------------*
* END OF SELECTION *
*----------------------------------------------------------------------*
END-OF-SELECTION.
PERFORM PRINT_REPORT.
PERFORM PRINT_FOOTER.

TOP-OF-PAGE.
PERFORM PRINT_TITLE.
PERFORM PRINT_HEADER.
*&---------------------------------------------------------------------*
*& Form GET_PLANNED_ISSUE_DATA
*&---------------------------------------------------------------------*
* Selecting values from tables MSEG and RESB
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_PLANNED_ISSUE_DATA.
SELECT * FROM RESB INTO TABLE IRESB WHERE AUFNR = P_AUFNR
AND ( BWART = '261' OR BWART = '262' )
AND XLOEK NE 'X'.

LOOP AT IRESB.
CLEAR IMSEG.
*/ checking planned goods issue against reservation number.
LOOP AT IMSEG
WHERE RSNUM = IRESB-RSNUM
AND RSPOS = IRESB-RSPOS.
*/ Checking for issue from vendor consignment stock.
IF IMSEG-SOBKZ EQ 'K'.
*/ Checking for issue movement type 261 and reversal mvmt 262.
CASE IMSEG-BWART.
WHEN '261'.
ADD IMSEG-MENGE TO ITAB-MENGK1.
WHEN '262'.
ADD IMSEG-MENGE TO ITAB-MENGK2.
ENDCASE.
ELSE.
CASE IMSEG-BWART.
WHEN '261'.
ADD IMSEG-MENGE TO ITAB-MENGE1.
WHEN '262'.
ADD IMSEG-MENGE TO ITAB-MENGE2.
ENDCASE.
ENDIF.
ENDLOOP.
ITAB-PDUES = IRESB-BDMNG - IRESB-ENMNG.
ITAB-BDTER = IRESB-BDTER.
ITAB-ENMNG = IRESB-ENMNG.
ITAB-MATNR = IRESB-MATNR.
ITAB-RSNUM = IRESB-RSNUM.
ITAB-RSPOS = IRESB-RSPOS.
APPEND ITAB.CLEAR ITAB.
ENDLOOP.
ENDFORM. " GET_PLANNED_ISSUE_DATA
*&---------------------------------------------------------------------*
*& Form GET_UNPLANNED_ISSUE_DATA
*&---------------------------------------------------------------------*
FORM GET_UNPLANNED_ISSUE_DATA.
LOOP AT IMSEG
WHERE RSNUM IS INITIAL
AND RSPOS IS INITIAL.
*/ Setting unplanned issue indicator.
IF SY-SUBRC = 0.
MOVE 'Y' TO C_UNPLND.
ENDIF.
*/ Checking for issue from vendor consignment stock.
IF IMSEG-SOBKZ EQ 'K'.
*/ Checking for issue movement type 261 and reversal mvmt 262.
CASE IMSEG-BWART.
WHEN '261'.
MOVE IMSEG-MENGE TO ITAB1-MENGKU1.
WHEN '262'.
MOVE IMSEG-MENGE TO ITAB1-MENGKU2.
ENDCASE.
ELSE.
CASE IMSEG-BWART.
WHEN '261'.
MOVE IMSEG-MENGE TO ITAB1-MENGEU1.
WHEN '262'.
MOVE IMSEG-MENGE TO ITAB1-MENGEU2.
ENDCASE.
ENDIF.
MOVE : IMSEG-MATNR TO ITAB1-MATNR,
IMSEG-AUFNR TO ITAB1-AUFNR,
IMSEG-BWART TO ITAB1-BWART.
APPEND ITAB1.
CLEAR ITAB1.
ENDLOOP.
ENDFORM. " GET_UNPLANNED_ISSUE_DATA
*&---------------------------------------------------------------------*
*& Form PRINT_REPORT
*&---------------------------------------------------------------------*
FORM PRINT_REPORT.
*/ Printing the item details.
IF C_PLAND EQ 'Y'.
WRITE: 46 '<<<<>>>>' COLOR 6 INVERSE ON.
SKIP.
SORT ITAB BY MATNR BDTER.
* delete adjacent duplicates from itab.
LOOP AT ITAB.
MOVE-CORRESPONDING ITAB TO REC.
AT NEW BDTER.
SUM.
CLEAR : P_MENGE, P_MENGK, P_ENMNG.
*/ Calculations.
P_MENGE = ITAB-MENGE1 - ITAB-MENGE2. " ST Elect issue
P_MENGK = ITAB-MENGK1 - ITAB-MENGK2. " Mindef issue
IF REC-MFRPN EQ SPACE.
MOVE '-' TO REC-MFRPN. " Manufacturer part no.
ENDIF.
IF REC-NSN EQ SPACE.
MOVE '-' TO REC-NSN. " Nato stock no.
ENDIF.

*/ Item serial number generation
DATA : COUNTER(4) TYPE N. " Item Serial No.
COUNTER = COUNTER + 1.
*/ Printing.
FORMAT COLOR 2.
WRITE: /(4) COUNTER NO-ZERO,
7(30) REC-MATNR,
(40) REC-NSN,
(17) REC-ENMNG NO-SIGN,
(17) REC-PDUES,
(17) P_MENGE,
/7(30) REC-MAKTX,
(40) REC-MFRPN,
(17) REC-BDTER RIGHT-JUSTIFIED,
(17) SPACE,
(17) P_MENGK.
SKIP.
ENDAT. " bdter
ENDLOOP. " itab
IF SY-LINNO NE 1.
ULINE /.
ENDIF.
ENDIF. " for c_pland

*/ Printing unplanned issue details in a new page always.
IF C_UNPLND EQ 'Y' AND C_PLAND EQ 'Y'.
NEW-PAGE NO-TITLE.
ENDIF.
IF C_UNPLND EQ 'Y'.
FORMAT COLOR OFF.
WRITE: 45 '<<<<>>>>' COLOR 6 INVERSE ON.
SKIP.

SORT ITAB1 BY MATNR.
LOOP AT ITAB1.
MOVE-CORRESPONDING ITAB1 TO REC1.
AT NEW MATNR.
SUM.
CLEAR : P_MENGEU, P_MENGKU, P_ENMNGU.
*/ Calculations.
P_MENGEU = ITAB1-MENGEU1 - ITAB1-MENGEU2. " ST Elect issue
P_MENGKU = ITAB1-MENGKU1 - ITAB1-MENGKU2. " Mindef issue
P_ENMNGU = P_MENGEU + P_MENGKU." Issued qty -total unplnd
IF REC1-MFRPN CA '?' OR REC1-MFRPN IS INITIAL.
MOVE '-' TO REC1-MFRPN. " Manufacturer part no.
ENDIF.
IF REC1-NSN CA '?' OR REC1-NSN EQ SPACE.
MOVE '-' TO REC1-NSN. " Nato stock no.
ENDIF.
*/ Item serial number generation
DATA : COUNTERU(4) TYPE N. " Item Serial No.
COUNTERU = COUNTERU + 1.
*/ Printing.
FORMAT COLOR 2.
WRITE: /(4) COUNTERU NO-ZERO,
7(30) REC1-MATNR,
(40) REC1-NSN,
(17) P_ENMNGU NO-SIGN,
(17) '0.00' RIGHT-JUSTIFIED,
(17) P_MENGEU,
/7(30) REC1-MAKTX,
(40) REC1-MFRPN,
(17) REC1-BDTER RIGHT-JUSTIFIED,
(17) SPACE,
(17) P_MENGKU.
SKIP.
ENDAT.
ENDLOOP. " itab1
ENDIF.
IF SY-LINNO NE 1.
ULINE /.
ENDIF.
ENDFORM. " PRINT_REPORT

*&---------------------------------------------------------------------*
*& Form PRINT_TITLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PRINT_TITLE.
FORMAT COLOR 3 INTENSIFIED ON.
WRITE : /.
WRITE : /5 'PROG ID :',SY-REPID,
44 'SINGAPORE TECHNOLOGIES ELECTRONICS LIMITED',
114 'DATE :', SY-DATUM,
/51 'ISSUE RECORDS FILE',
114 'PAGE :', SY-PAGNO.

WRITE : /.
FORMAT COLOR 4.
WRITE : /5 'SERVICE ORDER NO. :', P_AUFNR.
FORMAT COLOR OFF.
ENDFORM. " PRINT_TITLE

*&---------------------------------------------------------------------*
*& Form GET_NSN_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_NSN_DATA USING F_MATNR LIKE ITAB-MATNR
CHANGING F_NSN LIKE ITAB-NSN.

DATA: V_OBJEK LIKE AUSP-OBJEK,
F_SMBEZ LIKE CLOBJDAT-SMBEZ.

DATA: BEGIN OF ISCLASS OCCURS 0.
INCLUDE STRUCTURE SCLASS.
DATA: END OF ISCLASS.

DATA: BEGIN OF ICLOBJDAT OCCURS 0.
INCLUDE STRUCTURE CLOBJDAT.
DATA: END OF ICLOBJDAT.

MOVE F_MATNR TO V_OBJEK+0(18).

CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
* CLASS = ' '
* CLASSTEXT = 'X'
CLASSTYPE = '001'
* CLINT = ' '
* FEATURES = 'X'
* LANGUAGE = SY-LANGU
OBJECT = V_OBJEK
* OBJECTTABLE = ' '
* KEY_DATE = SY-DATUM
* INITIAL_CHARACT = 'X'
* NO_VALUE_DESCRIPT =
* CHANGE_SERVICE_CLF = 'X'
INHERITED_CHAR = 'X'
TABLES
T_CLASS = ISCLASS
T_OBJECTDATA = ICLOBJDAT
* I_SEL_CHARACTERISTIC =
EXCEPTIONS
NO_CLASSIFICATION = 1
NO_CLASSTYPES = 2
INVALID_CLASS_TYPE = 3
OTHERS = 4.


IF SY-SUBRC EQ 0.
APPEND ICLOBJDAT.
CLEAR ICLOBJDAT.
LOOP AT ICLOBJDAT
WHERE SMBEZ+0(17) = 'Nato Stock Number'.
MOVE ICLOBJDAT-AUSP1 TO F_NSN.
ENDLOOP.
REFRESH ICLOBJDAT.
ELSE.
REFRESH ICLOBJDAT.
ENDIF.

ENDFORM. " GET_NSN_DATA
*&---------------------------------------------------------------------*
*& Form PRINT_FOOTER
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PRINT_FOOTER.
FORMAT COLOR 6.
IF SY-PAGNO = 1
AND SY-LINNO = 1
AND SY-COLNO = 1.
IF SY-LINSZ > 80.
WRITE: /51 '*** NO DATA TO REPORT ***', 132 ' ' .
ELSE.
WRITE: /27 '*** NO DATA TO REPORT ***', 80 ' '.
ENDIF.
ELSE.
IF SY-LINSZ > 80.
WRITE: /53 '*** END OF REPORT ***', 132 ' '.
ELSE.
WRITE: /29 '*** END OF REPORT ***', 80 ' '.
ENDIF.
ENDIF.
FORMAT COLOR OFF.
ENDFORM. " PRINT_FOOTER

*&---------------------------------------------------------------------*
*& Form PRINT_HEADER
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PRINT_HEADER.
*/ Printing the Header.
FORMAT COLOR 1.
ULINE /.
WRITE: /(5) 'S/NO.' LEFT-JUSTIFIED,
(30) 'MATERIAL CODE' LEFT-JUSTIFIED,
(40) 'NSN' LEFT-JUSTIFIED,
(17) 'ISSUE QTY' RIGHT-JUSTIFIED,
(17) 'QTY DUESOUT' RIGHT-JUSTIFIED,
(16) 'ST Elect ISSUE' RIGHT-JUSTIFIED,
/7(30) 'DESCRIPTION' LEFT-JUSTIFIED,
(40) 'MPN' LEFT-JUSTIFIED,
(17) 'DATE RAISED' RIGHT-JUSTIFIED,
(17) ' ',
(16) 'MINDEF ISSUE' RIGHT-JUSTIFIED.
ULINE /.

ENDFORM. " PRINT_HEADER

Thursday, December 21, 2006

Transaction Codes

Development Transaction Codes
S001 Abap Workbench
SE09 Workbenche organizer (Transports)
SE11 ABAP/4 Dictionary
SE16 Data browser
SE24 Class builder
SE30 ABAP Runtime analyzes
SE32 ABAP/4 Text Element Maintenance
SE35 ABAP/4 Dialog Modules Maintenance
SE36 Logical Databases
SE37 Function builder

SE38 ABAP/4 Editor
SE39 Program Comparison
SE41 Menu Painter
SE43 Area Menu editor
SE48 Call hierarchy
SE49 Program analysis: Table Manipulation
SE51 Screen Painter: Initial Screen.
SE55 Table maintenance dialog
SE80 Repository browser
SE91 Message Classes
SE93 Maintain transaction

SHDB Batch input recorder
SM30 Maintain table views
SM35 Monitor batch input

ST22 Short dump analysis

2. Monitoring

ST05 SQL Trace

ST07 Application monitor

3.System

SM04 User overview ( Possible to end sessions)
SM12 Table lock Entries
SM21 System log for viewing dumps
SM36 Define background jobs
SM37 View background jobs
SM50 Process Overview

SU53 Display Authorization Values for User

SLG1 View application log
SLG2 Delete application log

SPAD Output devices
SP01 See spool


4. SapScript

SE71 Form painter
SE72 Style maintenance
SE73 SAPscript font maintenance.
SE74 SAPscript format conversion

SE75 SAPscript Settings
SE76 SAPscript Form Translation
SE77 SAPscript Style Conversion
SE78 SapScript Graphics Management
SO10 Create standard text module


5. Workflow
SWDM Workflow explorer
SWDD Workflow builder
SWUS Start workflow - Test enviromnent
SWU0 Simulate event
SBWP Business workplace
PFTC_INS Create Task/Task group
PFTC_CHG Change Task/Task group
SWUD Dagnosis
SWI1 Work item selection

6. Enhancements and modifications

CMOD Enhancementprojects
SMOD List SAP enhancements to use in CMOD
SHD0 Transaction variant maintenance


7. Other

ABAPDOCU ABAP coding examples supplied by SAP

AL11 Look at directories on the host system ( With drill down )

LSMW LSM Workbench

OSS1 OSS

SA38 Submit batch job

SE01/STMS Transport system

SPRO Start SAP IMG
SPAM Support packet manage

SU03 Maintain Authorizations: Object Classes
SU51 Display Authorization Data (Can be called after failed authorization)

SWEC Events for change documents

SW01 Business Object Builder
SWO4 Display Businesss Object Types

VOK2 Maintain Output Determination

SNRO Number range object maintenance.

Tuesday, December 19, 2006

Where Used List

Have you ever used Where-used list button?
Imagine you want to use a standard SAP Function module. You have just joined a company and you were asked to work on a object. You don't have documentation for that function module. In such cases, just click on where-used list button to find out where the function module is used in SAP. Certainly you will find entries which may help you. See below the experience of a developer.
There is this much powerful capability of where-used list which I had not realized until few days back. It all started when I had to use a BAPI namely BAPI_DELIVERYPROCESSING_EXEC to create an item delivery. After going through its documentation and interface, I was totally confused. I searched SDN, Internal SAP documentation, but could not find a single code example. Without any clue, I logged on to one of Sandbox testing servers and was TRYING to use this BAPI successfully, but was unable to do it. Out of my wits, I clicked on where-used list and fortunately there were 4 programs to my rescue.

Monday, December 18, 2006

What is ERP?

What is ERP?

Enterprise Resource Planning systems (ERPs) integrate (or attempt to integrate) all data and processes of an organization into a unified system. A typical ERP system will use multiple components of computer software and hardware to achieve the integration. A key ingredient of most ERP systems is the use of a unified database to store data for the various system modules. The term ERP originally implied systems designed to plan the utilization of enterprise-wide resources. Although the acronym ERP originated in the manufacturing environment, today's use of the term ERP systems has much broader scope. ERP systems typically attempt to cover all basic functions of an organization, regardless of the organization's business or charter. Business, non-profit organizations, non governmental organizations, governments, and other large entities utilize ERP systems.

Additionally, it may be noted that to be considered an ERP system, a software package generally would only need to provide functionality in a single package that would normally be covered by two or more systems. Technically, a software package that provides both Payroll and Accounting functions (such as QuickBooks) would be considered an ERP software package.

However, the term is typically reserved for larger, more broadly based applications. The introduction of an ERP system to replace two or more independent applications eliminates the need for external interfaces previously required between systems, and provides additional benefits that range from standardization and lower maintenance (one system instead of two or more) to easier and/or greater reporting capabilities (as all data is typically kept in one database).

Advantages
In the absence of an ERP system, a large manufacturer may find itself with many software applications that do not talk to each other and do not effectively interface. Tasks that need to interface with one another may involve:

Change how a product is made, in the engineering details, and that is how it will now be made. Effective dates can be used to control when the switch over will occur from an old version to the next one, both the date that some ingredients go into effect, and date that some are discontinued. Part of the change can include labeling to identify version numbers.

Computer security is included within an ERP to protect against both outsider crime, such as industrial espionage, and insider crime, such as embezzlement. A data tampering scenario might involve a terrorist altering a Bill of Materials so as to put poison in food products, or other sabotage. ERP security helps to prevent abuse as well.

Disadvantages
Many problems organizations have with ERP systems are due to inadequate investment in ongoing training for involved personnel, including those implementing and testing changes, as well as a lack of corporate policy protecting the integrity of the data in the ERP systems and how it is used.

Limitations of ERP include:

  • Success depends on the skill and experience of the workforce, including training about how to make the system work correctly. Many companies cut costs by cutting training budgets. Privately owned small enterprises are often undercapitalized, meaning their ERP system is often operated by personnel with inadequate education in ERP in general, such as APICS foundations, and in the particular ERP vendor package being used.
  • Personnel turnover; companies can employ new managers lacking education in the company's ERP system, proposing changes in business practices that are out of synchronization with the best utilization of the company's selected ERP.
  • Customization of the ERP software is limited. Some customization may involve changing of the ERP software structure which is usually not allowed.
  • Re-engineering of business processes to fit the "industry standard" prescribed by the ERP system may lead to a loss of competitive advantage.
  • ERP systems can be very expensive to install.
  • ERP vendors can charge sums of money for annual license renewal that is unrelated to the size of the company using the ERP or its profitability.
  • Technical support personnel often give replies to callers that are inappropriate for the caller's corporate structure. Computer security concerns arise, for example when telling a non-programmer how to change a database on the fly, at a company that requires an audit trail of changes so as to meet some regulatory standards.
  • ERPs are often seen as too rigid and too difficult to adapt to the specific workflow and business process of some companies—this is cited as one of the main causes of their failure.
  • Systems can be difficult to use.

Major ERP Packages:

  • SAP R/3 from SAP
  • mySAP from SAP
  • Peoplesoft from Oracle
  • Oracle e-business suite from Oracle
  • JD Edwards EnterpriseOne from Oracle

Sunday, December 17, 2006

Performance Tuning

Performance Tuning
In the world of SAP programming, ABAP is the universal language. Often due to the race against schedule and deliveries, focus of making efficient programs is overlooked. A performance optimized ABAP program saves the time of the end user, thus increasing the productivity of the user, and in turn keeping the user and the management happy .

1. Use of selection criteria
Instead of fetching all the data and then filtering unwanted data, filter out unwanted data during selection itself.
Not Recommended:
Select * from zflight. Check : zflight-airln = ‘LF’ and zflight-fligh = ‘BW222’. Endselect.
Recommended:
Select f1 f2 f3 … fn from zflight into table itab_flight where airln = ‘LF’ and fligh = ‘222’.

2. Usage of Aggregate Functions.
Use already provided aggregate functions instead of manually coding it in ABAP.
Not Recommended
Maxnu = 0. Select * from zflight where airln = ‘LF’ and cntry = ‘IN’.
Check zflight-fligh > maxnu. Maxnu = zflight-fligh. Endselect.
Recommended
Select max( fligh ) from zflight into maxnu where airln = ‘LF’ and cntry = ‘IN’.
Similarly use MIN, AVG,COUNT,and SUM as needed.

3. Usage of Views.
Instead of using multiple select statements or joins to fetch data from multiple tables, use views.
Not recommended
Select * from zcntry where cntry like ‘IN%’. Select single * from zflight where cntry = zcntry-cntry and airln = ‘LF’.
Endselect.
Recommended
Select * from zcnfl where cntry like ‘IN%’ and airln = ‘LF’. Endselect.

4. Use INTO clause instead of appending record by record during database selection.

5. Avoid appending corresponding fields of table during database selection
Not Recommended
Refresh: itab_flight.
Select * from zflight into intab_flight.
Append intab_flight.
Clear intab_flight.
Endselect.

Recommended
Refresh: intab_flight.
Select * from zflight into table intab_flight

6. Modifying lines of internal table
Not Recommended
Loop at int_fligh.
If int_fligh-flag is initial.
Int_fligh-flag = ‘X’.
Endif.
Modify int_fligh.
Endloop.

Recommended
Int_fligh-flag = ‘X’.
Modify int_fligh transporting flag where flag is initial.

7. Read internal table with binary search
Read table makes use of sequential search which slows down the processing. Instead sort the internal table and then read with binary search.
Not Recommended
Read table int_fligh with key airln = ‘LF’.

Recommended
Read table int_fligh with key airln = ‘LF’ binary search.

8. Appending two internal tables
Instead of loop at one internal table and then append, use variation of APPEND statement.
Not Recommended
Loop at int_fligh1.
Append int_fligh1 to int_fligh2.
Endloop.

Recommended
Append lines of int_fligh1 to int_fligh2.

9. Table Buffering
Use buffered tables as far as possible however buffering is bypassed while using :
Select distinct
Select … for update
Order by, group by, having clause
Joins

10. Usage of FOR ALL ENTRIES.
Not Recommended
Loop at int_cntry.
Select single * from zfligh into int_fligh where cntry = int_cntry-cntry.
Append int_fligh.
Endloop.

Recommended
if not int_cntry[] is initial.
Select * from zfligh appending table int_fligh For all entries in int_cntry Where cntry = int_cntry-cntry.
endif.

11. Usage of Table indexes
While building the where clause take extra care to use the key fields in the order in which index is built so that it helps optimizer use the appropriate index while fetching data.

12. Usage of Joins
When multiple SAP tables are logically joined, it is always advisable to use inner join to read the data from them. This certainly reduces the load on the network.
However take precaution while volume of data is too much and too many tables are involved.

13. Usage of Nested Selects and Nested Loops
Avoid nested selects and nested loops. I.e as far as possible do not use SELECT within SELECT/ENDSELECt and LOOP inside LOOP ENDLOOP.

14. Sort functionality Vs Order by
Use ABAP SORT instead of using ORDER BY during database selection.

Code Inspector

In this post I would like to talk about the “Code Inspector” tool and how it can be used to enforce naming conventions and coding standards in ABAP programs.
The Code Inspector (transaction code SCI) is a very powerful tool which can be used
to check individual objects or sets of objects for performance, security, syntax, and adherence to name conventions. You can also determine statistical information or search for certain ABAP words (tokens). In the Code Inspector, you can define inspections that, with the help of check variants examine certain sets of objects. As the result of an inspection, you receive information messages, warning messages, or error messages on different properties of the examined objects.

Steps

1. Go to SCI transaction.
2.Creation of object set
Give a name to the object set and select “create”.
Object Set can be used to group several single objects together for an inspection. Sets of objects include, for example, programs, function groups, classes, or DDIC objects. In general, any Repository objects can be included in a set of objects.Here you can either include a entire package or individual programs.



3.Creating the Check Variant
Give a name to the check set and select “Create”
With the help of the check variant, sets of objects included in the object set are checked as to whether or not certain criteria have been met.This variant can be used to enforce performance checks,syntax checks,security checks,naming conventions and ABAP keyword searches.In this example I create a check variant for enforcing program naming conventions and ABAP Keyword searches.

4.Naming Conventions

Click on the “naming conventions” node under the “programming conventions” node.A popup screen will be displayed as shown below where you can define the naming conventions for various ABAP objects.
5.Searching for ABAP tokens

Click on the “Search for ABAP Tokens” under the “Search Functions” node.A popup window will be displayed in which you can specify any specific ABAP keywords to be filtered.In this example I am searching for the ABAP keyword “LIKE” which I don’t want to be used in any of the checked programs.6.Attaching the object set and the check variant to the code inspector
Now come back to main screen in SCI and create a new code inspector by selecting “create” under the “inspection” frame.Here you attach the “object set” and “check variant” created in the earlier steps.

7.Save and Click the “Execute” button to generate the result.

8.Click on the “results” button to view the result
You can double click on the results to go to the main program.
9.Test program for checking naming conventions
enforced in check variant.


Blogger template 'YellowFlower' by Ourblogtemplates.com 2008