The report displays information about internal orders. It has two parts: one for reporting data based on document information in BSIS and BSEG, and one for reporting data based on purchasing order information. The user selects which report to run with the appropriate radio button. For PO data, this report simply prepares and submits a set of parameters to the Outstanding Purchase Order report. For document information, this report prepares and lists the appropriate information from BSIS and BSEG.
Report By Document Data: The report looks up data in BSIS and BSEG that meets the user's selection criteria, and lists the data (one line per BSIS entry). Purchase order and cost object data resides in BSEG; the rest of the data resides in BSIS.
Report By PO Data: The report looks up purchase order information by referencing BSIS, and then referencing BSEG. It then keeps a list of purchase orders po_doc, which is passed on to the Outstanding Order report to limit its selection, and a list of (Purchase Order, Item Number) pairs (fields ebeln and ebelp in BSEG). In addition, it keeps a list of (Purchase Order, Internal Order) pairs (fields BSEG-ebeln and BSIS-aufnr), so that the Outstanding PO report can quickly look up the internal order numbers without another database call. These two lists are kept in the select-options po_itemp and po_aufnr. It was convenient to do it this way, because select-options are easy to pass on using submit...with. The limitation is that, in pur_itemp, ebelp must always be less than ebeln, and in po_order, aufnr must always be less than ebeln, otherwise an error will occur when passing the parameters. If this happens, and the program needs to be modified, then the info will have to be passed using an internal table exported to memory in this report (using export) and then imported in the Outstanding PO report (using import). The Outstanding PO report report behaves slightly different when called from this report. Namely:
the compare parameter is set to 'A' (an arbitrary value), which is a flag indicating that the report was called by this report, and to process as described here
After looking up records for PO documents, limited by the PO numbers in the po_doc selection criteria passed to it, the report makes a further check on each line item, listing only those items found in the PO/Item pairs list po_itemp
the report lists items with IR < gr =" IR"> GR)
the report's output list contains an additional field Internal Order, which is looked up in the PO/Internal Order pairs list po_order that is passed to it
For further details, see documentation in the Outstanding PO report.
Project Expense Report
*&---------------------------------------------------------------------*
*& Report ZPRJEXP2 *
*& Author: Matt Wong, SNI Taiwan, Aug 1998 *
*& *
*& Report for displaying expense data for internal orders/projects. *
*& PO_ITEMP contains PO/item pairs to be passed onto the Outstanding PO*
*& report, since we may only want to access certain items of a PO (not *
*& all items). *
*& Using a select-option to do this makes it easier to pass the info to*
*& the report *
*& *
*& PO_AUFNR is also for passing data between programs. It passes *
*& PO/Internal Order number pairs *
*&---------------------------------------------------------------------*
REPORT ZPRJEXP2 LINE-SIZE 250 LINE-COUNT 65 NO STANDARD PAGE HEADING.
TABLES: BSIS, BSEG.
PARAMETERS: COMPANY LIKE BSIS-BUKRS OBLIGATORY,
BYDOC RADIOBUTTON GROUP REPT,
BYPO RADIOBUTTON GROUP REPT.
SELECT-OPTIONS: ORDER FOR BSIS-AUFNR OBLIGATORY NO-EXTENSION,
POSTDATE FOR SY-DATUM NO-EXTENSION,
YEAR FOR BSIS-GJAHR NO-DISPLAY,
PO_DOC FOR BSEG-EBELN NO-DISPLAY,
PO_ITEMP FOR BSEG-EBELN NO-DISPLAY, "PO/item pair
PO_AUFNR FOR BSIS-AUFNR NO-DISPLAY.
DATA:
BSEG_FIELDS LIKE RSFS_STRUC OCCURS 10 WITH HEADER LINE,
BEGIN OF MYBSEG,
EBELN LIKE BSEG-EBELN,
EBELP LIKE BSEG-EBELP,
KSTRG LIKE BSEG-KSTRG,
END OF MYBSEG,
LASTAUFNR LIKE BSIS-AUFNR,
AUFNRSUBTOTAL LIKE BSIS-DMBTR,
TOTAL LIKE BSIS-DMBTR.
AT SELECTION-SCREEN ON POSTDATE.
CLEAR YEAR. REFRESH YEAR.
IF NOT POSTDATE-LOW IS INITIAL.
YEAR-SIGN = 'I'.
YEAR-OPTION = 'EQ'.
YEAR-LOW = POSTDATE-LOW(4).
IF NOT POSTDATE-HIGH IS INITIAL AND
( POSTDATE-LOW(4) <> POSTDATE-HIGH(4) ) .
MESSAGE E003(ZS).
ENDIF.
APPEND YEAR.
ENDIF.
INITIALIZATION.
BSEG_FIELDS = 'ebeln'. APPEND BSEG_FIELDS.
BSEG_FIELDS = 'ebelp'. APPEND BSEG_FIELDS.
BSEG_FIELDS = 'kstrg'. APPEND BSEG_FIELDS.
REFRESH PO_DOC.
PO_DOC-SIGN = 'I'.
PO_DOC-OPTION = 'EQ'.
REFRESH PO_ITEMP.
TOP-OF-PAGE.
WRITE: SY-DATUM.
WRITE: 85 'Project Expenditure Tracing Report (by Document),'.
WRITE: 'Posting date'.
IF POSTDATE-HIGH IS INITIAL.
WRITE: POSTDATE-LOW.
ELSE.
WRITE: 'Between', POSTDATE-LOW, 'and', POSTDATE-HIGH.
ENDIF.
WRITE: 240 'Page:', 248(2) SY-PAGNO, / SY-ULINE.
START-OF-SELECTION.
* should do authorization checking here **
SELECT * FROM BSIS WHERE
BUKRS = COMPANY AND
GJAHR IN YEAR AND
AUFNR IN ORDER AND
BUDAT IN POSTDATE
ORDER BY AUFNR BELNR.
IF BYPO = ' ' AND LASTAUFNR <> BSIS-AUFNR.
PERFORM WRITE_ORDER_HEADER.
ENDIF.
LASTAUFNR = BSIS-AUFNR.
* should do authorization checking here **
SELECT SINGLE (BSEG_FIELDS) FROM BSEG INTO MYBSEG WHERE
BUKRS = COMPANY AND
BELNR = BSIS-BELNR AND
GJAHR = BSIS-GJAHR AND
BUZEI = BSIS-BUZEI.
IF BYPO = 'X'. "output by PO doc: report zgmpo-05
LOOP AT PO_AUFNR WHERE HIGH = MYBSEG-EBELN AND LOW = BSIS-AUFNR.
ENDLOOP.
IF SY-SUBRC = 4. "no entry already exists
PO_AUFNR-HIGH = MYBSEG-EBELN.
PO_AUFNR-LOW = BSIS-AUFNR.
APPEND PO_AUFNR.
ENDIF.
IF MYBSEG-EBELN <> SPACE.
PERFORM ADD_PO_ITEM.
ENDIF.
ELSE. "output by document
IF BSIS-SHKZG = 'H'.
ELSE.
BSIS-DMBTR = - BSIS-DMBTR.
ENDIF.
PERFORM WRITE_OUTPUT.
TOTAL = TOTAL + BSIS-DMBTR.
AUFNRSUBTOTAL = AUFNRSUBTOTAL + BSIS-DMBTR.
ENDIF.
ENDSELECT.
IF BYPO = 'X'.
SUBMIT ZGMPO-05 WITH COMPARE = 'A'
WITH PO_ITEMP IN PO_ITEMP
WITH PO_DOC IN PO_DOC
WITH POSTDAT IN POSTDATE
WITH PO_AUFNR IN PO_AUFNR AND RETURN.
ELSE.
PERFORM WRITE_AUFNRSUBTOTAL.
PERFORM WRITE_TOTAL.
ENDIF.
*&---------------------------------------------------------------------*
*& Form WRITE_OUTPUT
*&---------------------------------------------------------------------*
FORM WRITE_OUTPUT.
WRITE: / BSIS-BELNR UNDER TEXT-001, "Document
BSIS-BUDAT UNDER TEXT-002, "Posting Date
BSIS-KOSTL UNDER TEXT-003, "Cost Center
BSIS-SGTXT UNDER TEXT-004, "Description
BSIS-DMBTR UNDER TEXT-005, "Amount
MYBSEG-KSTRG UNDER TEXT-006, "Cost Object
MYBSEG-EBELN UNDER TEXT-007. "PO Number
ENDFORM. " WRITE_OUTPUT
*&---------------------------------------------------------------------*
*& Form WRITE_COL_HEADERS
*&---------------------------------------------------------------------*
FORM WRITE_COL_HEADERS.
WRITE: / TEXT-001, "Document
16 TEXT-002, "Posting Date
28 TEXT-003, "Cost Center
36 TEXT-004, "Description
87 TEXT-005, "Amount
107 TEXT-006, "Cost Object
123 TEXT-007. "PO Number
ENDFORM.
*&---------------------------------------------------------------------*
*& Form WRITE_TOTAL
*&---------------------------------------------------------------------*
FORM WRITE_TOTAL.
WRITE: / SY-ULINE.
WRITE: / 'Total:' UNDER TEXT-004, TOTAL UNDER TEXT-005.
ENDFORM. " WRITE_TOTAL
*&---------------------------------------------------------------------*
*& Form ADD_PO_ITEM
*&---------------------------------------------------------------------*
FORM ADD_PO_ITEM.
LOOP AT PO_DOC WHERE LOW = MYBSEG-EBELN.
ENDLOOP.
IF SY-SUBRC = 4. "entry does not already exist
PO_DOC-LOW = MYBSEG-EBELN.
APPEND PO_DOC.
ENDIF.
* add po/item pair to list. PO goes into high, item into low
LOOP AT PO_ITEMP WHERE HIGH = MYBSEG-EBELN AND LOW = MYBSEG-EBELP.
ENDLOOP.
IF SY-SUBRC = 4. "entry does not already exist
PO_ITEMP-HIGH = MYBSEG-EBELN.
PO_ITEMP-LOW = MYBSEG-EBELP.
APPEND PO_ITEMP.
ENDIF.
ENDFORM. " ADD_PO_ITEM
*&---------------------------------------------------------------------*
*& Form WRITE_ORDER_HEADER
*&---------------------------------------------------------------------*
FORM WRITE_ORDER_HEADER.
IF NOT AUFNRSUBTOTAL IS INITIAL.
PERFORM WRITE_AUFNRSUBTOTAL.
ENDIF.
SKIP 1.
WRITE: / 'Project No:', BSIS-AUFNR.
WRITE: / SY-ULINE.
PERFORM WRITE_COL_HEADERS.
ENDFORM. " WRITE_ORDER_HEADER
*&---------------------------------------------------------------------*
*& Form WRITE_AUFNRSUBTOTAL
*&---------------------------------------------------------------------*
FORM WRITE_AUFNRSUBTOTAL.
WRITE: / SY-ULINE.
WRITE: / 'Project Total:' UNDER TEXT-004, AUFNRSUBTOTAL UNDER TEXT-005.
AUFNRSUBTOTAL = 0.
ENDFORM. " WRITE_AUFNRSUBTOTAL
Friday, November 23, 2007
ABAP/4 Program: Project Expense Report
Labels:
Project Expense Report
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2007
(952)
-
▼
November
(716)
- SAP Paper Documents
- SAP Repository
- SAP R/3 Implementation and Maintenance Tips
- ABAP/4 programming language overview
- The interactive eLearning system for ABAP™
- Helpful System Administration ABAPS
- free download abap programmin pdf book
- examples of real time objects in sap abap(1)
- examples of real time objects in sap abap
- work flow example2
- Workflow tips
- Miscellaneous sap abap faq
- BDC , LSMW, Conversions faq in abap
- Sap Scripts & Smart forms faqs in abap
- performance tuning in abap faqs
- Real Time BDC & LSMW faqs
- Real Time ABAP Internal Tables faqs
- Real Time ABAP Reports faqs
- Real Time questions ..in sap ABAP
- SAP ABAP FAQ (Technical)
- ABAP and Unicode
- ABAP and JavaScript
- ABAP Objects
- ABAP Database Access
- Running ABAP Programs
- ABAP User Dialogs
- The ABAP Programming Language
- Creating and Changing ABAP Programs
- Overview of the Components of Application Programs
- Introduction to ABAP
- ABAP Programming Documentation
- FREE DOWNLOAD ALE, EDI & IDOCS
- Conversion of IDOCs to XML.pdf
- FREE DOWNLOAD IDOC Interface Technology
- FREE DOWNLOAD EDI, IDOC Interface
- FREE DOWNLOAD IDOC BOOK
- FREE DOWNLOAD LSMW - Idoc Inbound Processing
- FREE DOWNLOAD SAP ABAP Idoc Interface
- FREE DOWNLOAD Java for SAP
- FREE DOWNLOAD Java for ABAP Programmers
- FREE DOWNLOAD Java and BAPI technology for EP
- free download Building Web Services with Java and ...
- free download Enable SAP with the power of Javascript
- FREE DOWNLOAD ABAP Training Simulator
- FREE DOWNLOAD SAP Accounting Training Simulators
- free download SAPScripts Made Easy
- CONDENSE
- CONSTANTS
- ABAP Quick Viewer
- sap abap XXL (EXtended Export of Lists)
- Some ABAP/4 Query header line variable
- Understanding SAP Query
- ABAP/4 Query
- ABAP/4 Query Hints and Tips
- SAP Website Links Exchange for ABAP, Basis or Cons...
- sap abap Program for Generate IDoc
- sap abap program for Reads an existing Idoc and di...
- List of ABAP Function modules
- sap abap FTP programming
- sap abap program for Issuing an Unix Command from ...
- sap abap program for RFC call to get Server List
- sap abap program for A SAP Pop-out Calculator
- sap ABAP program for Timers and Auto-refresh
- sap abap program for WS_EXECUTE to called External...
- sap abap programming Execute DOS Command from ABAP...
- To execute a dos command from ABAP
- sap abap program for Make your SAPGUI Disappear an...
- sap abap program for Using Function Modules F4_FIL...
- abp program for How to Restrict the Select Options
- sap abap program for Take Values from Selection-Sc...
- sap abap program for Change Text Into Password
- sap abap program for Function Module for Encryptio...
- sap abap program for FM VRM_SET_VALUE To List Box
- sap abap program for Value Request For Parameter
- sap abap program for Pop a Message to specific SAP...
- ABAP Pop-out box for user confirmation
- sap ABAP program for POP-UP Window
- sap abap program Sample XML Source Code For SAP
- sap abap XML file to word document through SAP
- sap abap program for How to Write Web Reports in SAP
- sap abap conversion Program to Test Line Selection...
- sap abap program for String Handling in ABAP - Rem...
- sap abap program for Split String into two parts a...
- sap abap conversion Program For Printing Prime Number
- sap abap program for How can I get Ascii value of ...
- sap abap program for Figure to Words for India but...
- sap abap conversion program for Print Number Value...
- sap abap conversion program for Insert a special T...
- sap abap program for String Handling in ABAP - Rem...
- sap abap program for Split String into two parts a...
- sap abap conversion Program For Printing Prime Number
- sap abap program for How can I get Ascii value of ...
- sap abap program for Figure to Words for India but...
- sap abap conversion program for Print Number Value...
- sap abap conversion program for Insert a special T...
- sap abap program for Convert SAP Spool List to HTML
- sap program for Convert Month to Word in ABAP
- ABAP function to convert Number to Words
- sap abap program for How to Create Tree Control
- sap abap A sample Tree Programming
-
▼
November
(716)
No comments:
Post a Comment