Description The logical database GLG (main program SAPDBGLG) is the central programobject for the archive periphery of FI-SL, FI-LC, and EC-PCA. Depending on the release, the logical database 'GLG' can be used todesign the following report types: 1. Release 3.0D and higher: Simple reports for special purpose ledgers(this is only possible for standard ledgers via modifications)- seeexample 1 below. 2. Simple ARCHIVE read programs can be written for special purposeledgers (i.e. FI-SL) (Release 2.2H and higher), EC-PA (Release 3.0C andhigher), and FI-LC ledger (Release 3.0D). As described in example 2below, you can write these programs quickly and easily by copying andmodifying existing programs. In both cases, the read program must maintain the attributes Logical database GL FI-SL summary and line items from the application G General Ledger (in the second case, this happens automatically during the copyingprocess). The (read) reports which access data using the logical database all havethe same logical structure (see below). Without additional SELECT OPTIONS commands in the report, according tothe default, the report only has one selection screen via the 'fixedfields' LEDGER, RECORD TYPE, COMPANY CODE, GLOBAL COMPANY, FISCAL YEAR,PERIOD. The logical database automatically performs the relevant dataselection. In addition, you can define report-specific selection options(ranges (see below) or parameters) in the read program. These ranges can be called up at run time for the purpose of dataselection using the command 'CHECK ' in the readreport. The data is read according to the hierarchy in the logical database,which you can call up using transaction GAR5 or via the database initialtransaction ALDB --> Structure --> Display.
Example In each example given below, one option to create archive read programsand ordinary read programs is described: 1. Structure of an (ordinary) read report that uses the database 'GLG': REPORT ZZTESTRP. * ----- Test report for reading data in FI-SL ledgers -------------- * * ----- that 'refers' to table GLT1 -------------- * TABLES: GLT1, GLS1, GLP1. DATA: BEGIN OF COUNT, GLT1 LIKE SY-TABIX, GLS1 LIKE SY-TABIX, GLP1 LIKE SY-TABIX, END OF COUNT. * Write controls for the actual, plan, rollup actual and rollup plan * line items (the last two variables are superfluous for table * groups = (GLT1, GLS1, GLP1)): DATA: FIRST_SI(1) TYPE C VALUE 'X'. DATA: FIRST_PSI(1) TYPE C VALUE 'X'. DATA: FIRST_RSI(1) TYPE C VALUE 'X'. DATA: FIRST_RPSI(1) TYPE C VALUE 'X'. * Report-specific range definitions for table fields to be validated * additionally: for example, account, business area, * cost center: SELECT-OPTIONS: ACCT for glt1-RACCT, BUSA for glt1-RBUSA, CNTR for glt1-RCNTR. AT-SELECTION-SCREEN. * PAI of report. (Optional) START-OF-SELECTION. * This event is processed before the first database access via * 'FORM PUT_
'. (Optional) GET GLT1. " read summary records CHECK ACCT. CHECK BUSA. CHECK CNTR. COUNT-GLT1 = COUNT-GLT1 + 1. WRITE: / SY-ULINE(80). WRITE: / 'summary record', 'seq. number:', COUNT-GLT1. WRITE: / GLT1 COLOR COL_KEY. * Performs, you can call up function modules at this point that further * process the selected GLT1 data. GET GLS1. " for the summary records read above " read the accompanying actual line items COUNT-GLS1 = COUNT-GLS1 + 1. IF FIRST_SI NE SPACE. WRITE: / 'accompanying actual line items' CLEAR FIRST_SI. ENDIF. WRITE: / GLS1 COLOR COL_HEADING. * Performs, at this point, you can call up function modules which * further process the selected GLS1 data. GET GLP1. " for the summary records read above " read the accompanying plan line items * Performs, at this point, you can call up function modules which * further process the GLP1 data. COUNT-GLP1 = COUNT-GLP1 + 1. IF FIRST_PSI NE SPACE. WRITE: / 'Accompanying plan line items'. CLEAR FIRST_PSI. ENDIF. WRITE: / GLP1 COLOR COL_NORMAL. GET GLT1 LATE. " Optional WRITE: / SY-ULINE(80). FIRST_PSI = 'X'. FIRST_SI = 'X'. * Additional commands after each logical data base step * are possible at this point (in this ex. GLT1 --> GLS1 --> GLP1) . END-OF-SELECTION. " Optional DETAIL. WRITE: / 'summary records:', 25 COUNT-GLT1 COLOR COL_KEY. WRITE: / 'actual line items', COUNT-GLS1 UNDER COUNT-GLT1 COLOR COL_HEADING. WRITE: / 'plan line items:', COUNT-GLP1 UNDER COUNT-GLT1 COLOR COL_NORMAL. * This event is processed at the end of the report before the list * output.2. Example for designing a report to read archived FI-SL (EC-PCA, FI-LC)data: You can write an ad hoc archiving read program (the simplest type, withcustomer-defined execution and display logic) very easily: Take the reload program RGURELO0 (FI-SL) or RGURELO8 (EC-PCA)or RGUREL10 (FI-LC) and copy it to a program in the customer name range. Then remove all calls of the routine "PERFORM INSERT_TABLES"including the accompanying section "FORM. .... ENDFORM". For the GET statements: A) Queries of the type "IF RECORD_FLAGS(1) = 'X'. .... ENDIF." should remain so that, when saving, ONLY DELETED DATA will be read! B) Index structure statements of the form . . IF ....-AWTYP NE SPACE AND JVSO1-REFDOCCT = 'W'. MOVE-CORRESPONDING ..... TO IGLIDXA. IGLIDXA-AWREF = ....-REFDOCNR . IGLIDXA-DOCCT = ....-REFDOCCT . IGLIDXA-BUKRS = ....-RBUKRS . READ TABLE IGLIDXA WITH KEY IGLIDXA. IF SY-SUBRC NE 0. SELECT SINGLE * FROM GLIDXA WHERE AWREF = IGLIDXA-AWREF AND AWTYP = IGLIDXA-AWTYP AND AWORG = IGLIDXA-AWORG AND RLDNR = IGLIDXA-RLDNR AND DOCCT = IGLIDXA-DOCCT AND RYEAR = IGLIDXA-RYEAR AND DOCNR = IGLIDXA-DOCNR. IF SY-SUBRC NE 0. APPEND IGLIDXA. COUNT-GLIDXA = COUNT-GLIDXA + 1. ENDIF. ENDIF. ENDIF. should be removed as well. C) For each set "GET " time, there is an internal table withthe name "I" available. If you are not going to use it, you should remove statements of type MOVE TO I . APPEND I . under the GET statement in question. D) Finally, report-specific selection parameters (which are notcontrolled by the logical database concerned, GLG) can be included inparameter definitions. Parameters not relevant to the program just created may either beremoved in the program, or renamed for your own purposes and usedaccordingly.