Friday, July 26, 2013

ABAP Program to Find UserExits for a Tcode


REPORT z_find_userexit NO STANDARD PAGE HEADING.
*&---------------------------------------------------------------------*
*&  Enter the transaction code that you want to search through in order
*&  to find which Standard SAP User Exits exists.
*&---------------------------------------------------------------------*
* Selection Text: P_TCODE: Transaction Code to Search
* Text Symbols: 001 - Enter the Transaction Code that you want to search through for a 
*  User Exit

*&---------------------------------------------------------------------*
*& Tables
*&---------------------------------------------------------------------*

TABLES : TSTC,     "SAP Transaction Codes
         TADIR,    "Directory of Repository Objects
         MODSAPT,  "SAP Enhancements - Short Texts
         MODACT,   "Modifications
         TRDIR,    "System table TRDIR
         TFDIR,    "Function Module
         ENLFDIR,  "Additional Attributes for Function Modules
         TSTCT.    "Transaction Code Texts
*&---------------------------------------------------------------------*
*& Variables
*&---------------------------------------------------------------------*

DATA : JTAB LIKE TADIR OCCURS WITH HEADER LINE.
DATA : FIELD1(30).
DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.

*&---------------------------------------------------------------------*
*& Selection Screen Parameters
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK A01 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP.
PARAMETERS : P_TCODE LIKE TSTC-TCODE OBLIGATORY.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK A01.

*&---------------------------------------------------------------------*
*& Start of main program
*&---------------------------------------------------------------------*

START-OF-SELECTION.

* Validate Transaction Code
  SELECT SINGLE FROM TSTC
    WHERE TCODE EQ P_TCODE.

* Find Repository Objects for transaction code
  IF SY-SUBRC EQ 0.
    SELECT SINGLE FROM TADIR
       WHERE PGMID    = 'R3TR'
         AND OBJECT   = 'PROG'
         AND OBJ_NAME = TSTC-PGMNA.

    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.

    IF SY-SUBRC NE 0.
      SELECT SINGLE FROM TRDIR
         WHERE NAME = TSTC-PGMNA.

      IF TRDIR-SUBC EQ 'F'.
        SELECT SINGLE FROM TFDIR
          WHERE PNAME = TSTC-PGMNA.

        SELECT SINGLE FROM ENLFDIR
          WHERE FUNCNAME = TFDIR-FUNCNAME.

        SELECT SINGLE FROM TADIR
          WHERE PGMID    = 'R3TR'
            AND OBJECT   = 'FUGR'
            AND OBJ_NAME = ENLFDIR-AREA.

        MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
      ENDIF.
    ENDIF.

* Find SAP Modifactions
    SELECT FROM TADIR
      INTO TABLE JTAB
      WHERE PGMID    = 'R3TR'
        AND OBJECT   = 'SMOD'
        AND DEVCLASS = V_DEVCLASS.

    SELECT SINGLE FROM TSTCT
      WHERE SPRSL EQ SY-LANGU
        AND TCODE EQ P_TCODE.

    FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
    WRITE:/(19) 'Transaction Code - ',
    20(20) P_TCODE,
    45(50) TSTCT-TTEXT.
    SKIP.
    IF NOT JTAB[] IS INITIAL.
      WRITE:/(95) SY-ULINE.
      FORMAT COLOR COL_HEADING INTENSIFIED ON.
      WRITE:/1 SY-VLINE,
      'Exit Name',
      21 SY-VLINE ,
      22 'Description',
      95 SY-VLINE.
      WRITE:/(95) SY-ULINE.

      LOOP AT JTAB.
        SELECT SINGLE FROM MODSAPT
        WHERE SPRSL = SY-LANGU AND
        NAME = JTAB-OBJ_NAME.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        WRITE:/1 SY-VLINE,
        JTAB-OBJ_NAME HOTSPOT ON,
        21 SY-VLINE ,
        22 MODSAPT-MODTEXT,
        95 SY-VLINE.
      ENDLOOP.

      WRITE:/(95) SY-ULINE.
      DESCRIBE TABLE JTAB.
      SKIP.
      FORMAT COLOR COL_TOTAL INTENSIFIED ON.
      WRITE:/ 'No of Exits:' , SY-TFILL.
    ELSE.
      FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
      WRITE:/(95) 'No User Exit exists'.
    ENDIF.
  ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(95) 'Transaction Code Does Not Exist'.
  ENDIF.

* Take the user to SMOD for the Exit that was selected.
AT LINE-SELECTION.
  GET CURSOR FIELD FIELD1.
  CHECK FIELD1(4) EQ 'JTAB'.
  SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
  CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

SAP ABAP PDF Creation Program

report zabap_2_pdf.
 
*-- Enhancements: only allow to be run with variant.  Then called
*-- program will be transparent to users
*-- TABLES
tables:
  tsp01.
*-- STRUCTURES
data:
  mstr_print_parms like pri_params,
  mc_valid(1)      type c,
  mi_bytecount     type i,
  mi_length        type i,
  mi_rqident       like tsp01-rqident.
*-- INTERNAL TABLES
data:
  mtab_pdf    like tline occurs 0 with header line,
  mc_filename like rlgrap-filename.
*-- SELECTION SCREEN
parameters:
  p_repid like sy-repid, " Report to execute
  p_linsz like sy-linsz default 132, " Line size
  p_paart like sy-paart default 'X_65_132'.  " Paper Format
start-of-selection.
concatenate 'c:\'
            p_repid
            '.pdf'
  into mc_filename.
*-- Setup the Print Parmaters
  call function 'GET_PRINT_PARAMETERS'
   exporting
     authority= space
     copies   = '1'
     cover_page                   = space
     data_set = space
     department                   = space
     destination                  = space
     expiration                   = '1'
     immediately                  = space
     in_archive_parameters        = space
     in_parameters                = space
     layout   = space
     mode     = space
     new_list_id                  = 'X'
     no_dialog= 'X'
     user     = sy-uname
   importing
     out_parameters               = mstr_print_parms
     valid    = mc_valid
   exceptions
     archive_info_not_found       = 1
     invalid_print_params         = 2
     invalid_archive_params       = 3
     others   = 4.
*-- Make sure that a printer destination has been set up
*-- If this is not done the PDF function module ABENDS
  if mstr_print_parms-pdest = space.
    mstr_print_parms-pdest = 'LOCL'.
  endif.
*-- Explicitly set line width, and output format so that
*-- the PDF conversion comes out OK
  mstr_print_parms-linsz = p_linsz.
  mstr_print_parms-paart = p_paart.
  submit (p_repid) to sap-spool without spool dynpro
                   spool parameters mstr_print_parms
                   via selection-screen
                   and return.
*-- Find out what the spool number is that was just created
  perform get_spool_number using sy-repid
             sy-uname
    changing mi_rqident.
*-- Convert Spool to PDF
  call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
    exporting
      src_spoolid= mi_rqident
      no_dialog  = space
      dst_device = mstr_print_parms-pdest
    importing
      pdf_bytecount                  = mi_bytecount
    tables
      pdf        = mtab_pdf
    exceptions
      err_no_abap_spooljob           = 1
      err_no_spooljob                = 2
      err_no_permission              = 3
      err_conv_not_possible          = 4
      err_bad_destdevice             = 5
      user_cancelled                 = 6
      err_spoolerror                 = 7
      err_temseerror                 = 8
      err_btcjob_open_failed         = 9
      err_btcjob_submit_failed       = 10
      err_btcjob_close_failed        = 11
      others     = 12.
call function 'DOWNLOAD'
     exporting
          bin_filesize            = mi_bytecount
          filename                = mc_filename
          filetype                = 'BIN'
     importing
          act_filename            = mc_filename
     tables
          data_tab                = mtab_pdf.
*---------------------------------------------------------------------*
*       FORM get_spool_number *
*---------------------------------------------------------------------*
*       Get the most recent spool created by user/report              *
*---------------------------------------------------------------------*
*  -->  F_REPID               *
*  -->  F_UNAME               *
*  -->  F_RQIDENT             *
*---------------------------------------------------------------------*
form get_spool_number using f_repid
     f_uname
                changing f_rqident.
  data:
    lc_rq2name like tsp01-rq2name.
  concatenate f_repid+0(8)
              f_uname+0(3)
    into lc_rq2name separated by '_'.
  select * from tsp01 where  rq2name = lc_rq2name
  order by rqcretime descending.
    f_rqident = tsp01-rqident.
    exit.
  endselect.
  if sy-subrc ne 0.
    clear f_rqident.
  endif.
endform." get_spool_number

Thursday, July 25, 2013

ABAP Coding Standards With Example



Contents

 

Document History

 



AMENDMENT HISTORY

Version
Author
Page No
Description
Reviewed By
Approved By
Review Date
Approval Date







































Objective:

The purpose of this document is to provide coding standards for the ABAP objects developed by Yash Technologies.

Definition:

Coding standards are mandatory coding procedures that should be followed as per Yash SAP's quality system to deliver manageable ABAP objects with good aesthetics.

Program Name

The program name must be in compliance with the ABAP Naming Standards document.

Program Attributes

The table below lists and describes the attributes.

Attribute
Description

1)   Title

Should contain an informative description of what the object does.

2)   Type

1 – Executable
I – Include module
M – Module Pool
F – Function Group
S – Subroutine
J – Interface Definition
K – Class Definition

3)   Status

Should be K if the object is a customer production program.

4)   Application

Should conform to the functional area that the object relates to.

5)   Fixed point arithmetic

Should be set if the object contains any arithmetic operations.

6)   Authorization Group

Should be specified if this level of security is required.

Development class and change request

All new objects must be assigned to a development class and to a change request

An existing development class should be used wherever possible and a new one should be created, if the request the object belongs to does not logically pertain to any of the existing development classes.

If an object is intended for private use, it should be assigned to the development class $TMP. The object will not be captured in a change request.

If an object is intended for use but is never to be transported to production, the program should be assigned to a development class that will not be transported to production.


Header block

The object header block must contain all the items listed in the table below. The skeleton program ZSKELETON contains an example header block that may be copied.

Description

PROJECT

Name of the project for which the object was created.

Example: GENESIS or SYMPHONY.

SERVICE REQUEST NUMBER

Number that uniquely identifies the service request. If the service request is broken down into specific task numbers, include the task number as well.

Note: During a project this will be the Request ID assigned for the development work.

DATE WRITTEN

Date on which the object was created.

Example: 9th April 2000.

AUTHOR

Name of the person who has created the object.

INPUT

List of all input data to the object.

OUTPUT

List of all outputs of the object.

SCHEDULING

The scheduling of the object. Indicate if the object is to be run online or in background.

PURPOSE

Description detailing the purpose for creating the object.

RESTRICTIONS/ ASSUMPTIONS

Description of the restrictions and assumptions contained within the object.

SPEC. PREPARED BY

Author of the design document or the contact businessperson.

PROGRAM HISTORY BLOCK

Documentation of all subsequent program changes in order to provide an accurate maintenance history.

Each change details:
Service Request Number/Task, e.g. SR1140-1
Developer making the change
Date of the change
Description of the change, and
Search string: e.g. SR2140-1.

The line of the code where changes are done, should contain the service request number as a search string.

Every amendment should follow the details mentioned in the History block.

Amendments

A search string should document every line/block of code that is changed as a part of an amendment.

The search string should follow the following convention:

Deletion of Code: The Service Request / Task Number should be prefixed with capital letter 'D'. E.g.: D-SR1140-1.

Insertion of Code: The Service Request / Task Number should be prefixed with capital letter 'I'. E.g.: I-SR1140.

On-line program documentation

The SAP on-line documentation should be maintained with a business description of the object. It should contain sufficient information for a user to understand the functionality of the object. Any requirement, input, output, restriction, scheduling and assumption should be mentioned.

Declarative elements

1)     REPORT

The REPORT element should be coded immediately after the header block. Any associated parameters should be consistently indented to the right of the REPORT element, for the purposes of readability.

Format:
REPORT ZYASHTEST [NO STANDARD PAGE HEADING]
                        [LINE-SIZE 132]
                        [LINE-COUNT 65]
                        [MESSAGE-ID ZZ].

2)     TABLES

The following is the format for declaring TABLES:

Format:
TABLES: TABLE1,       “Table description as in-line comment
        TABLE2,       “Table description as in-line comment
        TABLE3,       “Table description as in-line comment

3)     SELECT-OPTIONS

The following is the format for declaring SELECT-OPTIONS:

Format:
SELECT-OPTIONS:
  S_USERID FOR BKPF-USNAM, “Appropriate in-line comment
  S_DODATE FOR BKPF-BUDAT. “Appropriate in-line comment

4)     PARAMETERS

The following is the format for declaring selection PARAMETERS:

Format:
PARAMETERS:
  P_USERID  LIKE BKPF-USNAM. “Appropriate in-line comment

5)     RANGES

The following is the format for declaring RANGES:

Format:
RANGES
  R_USERID   FOR BKPF-USNAM, “Appropriate in-line comment
  R_DOC_DATE FOR BKPF-BUDAT. “Appropriate in-line comment

6)     WORK VARIABLES AND FLAGS

·         Wherever possible, reference to data dictionary fields and structures should be used to create work variables and flags.
·  In-line comments should be provided for explaining the purpose of the work fields
·         Underscores “_” should be used to separate words or letters that define a variable.

Format:
DATA:
  W_USERID   LIKE BKPF-USNAM, “Appropriate in-line comment
  W_DOC_DATE LIKE BKPF-BUDAT. “Appropriate in-line comment

7)     CONSTANTS

·         Wherever possible, reference to data dictionary fields and structures should be used to create constants.
·  In-line comments should be provided for explaining the purpose of the constants
·         Underscores “_” should be used to separate words or letters that define a constant.

Format:
CONSTANTS:
  C_USNAM LIKE BKPF-USNAM VALUE ‘RAOK’. “In-line comment

Program modularization

·         Large processing blocks of code should be broken down into logical units and performed as subroutines.
·         If the same block of code is used in more than one program, the following should be considered:
Ø  Function module.
Ø  Include program.
Ø  Subroutine pool.

Subroutines

Every subroutine call (PERFORM_) should have the description of the functioning of the subroutine. And the subroutine block (FORM - ENDFORM) should have the details as mentioned below.

Text elements

The standard convention of text-elements should be followed.

Block code

The keywords: IF - ENDIF, LOOP - ENDLOOP, DO – ENDDO, CASE - ENDCASE, SELECT - ENDSELECT, need to follow the standard convention.

Events

Every event should be preceded by the name of the event.



Standard Checks:


1.     Always check for Divide by Zero conditions.
2.     Always try to replace CHECK statements with IF-ENDIF blocks.
3.     Check for potential Endless Loops.
4.     Check to see if Nested Selects can be eliminated.
5.     Check for IF-ELSEIF-ENDIF blocks that can be replaced with CASE-ENDCASE blocks

Standard Template:


The following code template has been provided to illustrate the coding standards that are to be followed. The name of the code template program is ZSKELETON.

************************************************************************
* PROJECT             : John Deere                                     *
* BUSINESS FUNCTION   : Customer Freight - Theoretical Costs           *
* WORK UNIT ID / TASK : 000199-08                                      *
* DATE WRITTEN        : 04th August, 2000                              *
* AUTHOR              : XYZ                     *
* TYPE                : Report                                         *
* INPUT               : SAP Tables  : A907, TVSWZ, TVRAB, VFSCAID,     *
*                                     VFSCAR1, KONV, VFKK, VFKP, LIKP, *
*                                     VTTK, VTTP, KNA1.                *
*                       User Inputs : Logical file path,               *
*                                     Physical filename,               *
*                                     Origin plant,                    *
*                                     Shipping cost date range,        *
*                                     Output format(s).                *
* OUTPUT              : REPORT                                         *
* Purpose             : This report will provide an analysis of the    *
*                       effects of a proposed rate change for Public   *
*                       Warehouse Customer routes using historical     *
*                       shipment data.                                 *
* SCHEDULING          : On request. Executed via a reporting tree.     *
* RESTRICTIONS        : None                                           *
* SPEC.PREPARED BY    : XYZ                     *
************************************************************************
*                       *** AMENDMENTS ***                             *
*----------------------------------------------------------------------*
* Service Request/Task:                                                *
* Programmer..........:                                                *
* Date of Change......:                                                *
* Description.........:                                                *
* Search String.......:                                                *
************************************************************************

REPORT ZSKELETON MESSAGE-ID ZMIM
                 LINE-COUNT 60
                 LINE-SIZE  132
                 NO STANDARD PAGE HEADING.

* Table declarations....................................................
TABLES: TVRAB,                         " Route Stages
        VFSCAR1,                       " Freight Rates (One-Dimensional)
        KONV,                          " Conditions (Transaction Data)
        VFKP.                          " Shipment Costs: Item Data

* Selection screen elements.............................................
SELECT-OPTIONS:
  S_COSDAT    FOR VFKP-PRSDT           " Shipping cost date
              OBLIGATORY.
PARAMETERS:
  P_DOWNLD    AS CHECKBOX              " Download format
              DEFAULT 'X',
  P_SUMMRY    AS CHECKBOX.             " Summary format

* Range tables..........................................................
RANGES R_VBELN FOR VTTP-VBELN.         " Delivery documents

* Type declarations for internal tables.................................
TYPES: BEGIN OF TYPE_S_ROUTE,
         ROUTE LIKE TVRAB-ROUTE,       " Route
         KNEND LIKE TVRAB-KNEND,       " Destination point
         TDLNR LIKE TVRAB-TDLNR,       " Forwarding agent
       END OF TYPE_S_ROUTE.

TYPES: BEGIN OF TYPE_S_SCALES,
         SLFNR    LIKE VFSCAID-SLFNR,  " Scale item number
         SCAVAL_D LIKE VFSCAID-SCAVAL_D, " Gross weight
       END OF TYPE_S_SCALES.

* Work variables........................................................
DATA:
  W_PHY_FILE(255) TYPE C,              " Physical file name with path
  W_SHPPNT     LIKE TVSWZ-VSTEL.       " Shipping point

* Flags.................................................................
DATA:
  FL_PRNT_SUMMARY(1) TYPE C,           " Summary report is being printed
  FL_TOGGLE(1)       TYPE C.           " Toggle for line color

* Constants.............................................................
CONSTANTS:
  C_TRUE(1)     TYPE C                 " TRUE value of boolean flags
                VALUE 'T',
  C_FALSE(1)    TYPE C                 " FALSE value of boolean flags
                VALUE 'F'.

* Field Strings.........................................................
DATA FS_ROUTE_PRICE TYPE TYPE_S_ROUTE_PRICE.

* Internal tables.......................................................
DATA T_UPLOAD_STRUCT TYPE STANDARD TABLE " To upload data from flat file
                  OF TYPE_S_UPLOAD_STRUCT
             INITIAL SIZE 20
                WITH HEADER LINE.

*-----------------------------------------------------------------------
* AT SELECTION-SCREEN EVENT.............................................
*-----------------------------------------------------------------------
AT SELECTION-SCREEN.

  IF SY-UCOMM EQ 'ONLI' OR SY-BATCH EQ 'X'.
* Check whether atleast one output format has been selected
    IF P_DOWNLD EQ SPACE AND P_SUMMRY EQ SPACE.
      MESSAGE E999 WITH 'Select atleast one output format.'(001).
    ENDIF.                             " IF P_DOWNLD EQ SPACE AND...
* Upload the pricing information from the input file
    PERFORM UPLOAD_PRICING_INFO.
* Retrieve the routes
    PERFORM RETRIEVE_ROUTES.
  ENDIF.                               " IF SY-UCOMM EQ 'ONLI' OR...

*-----------------------------------------------------------------------
* START-OF-SELECTION EVENT..............................................
*-----------------------------------------------------------------------
START-OF-SELECTION.

* Output the report
  PERFORM OUTPUT_REPORT.

*-----------------------------------------------------------------------
* TOP-OF-PAGE EVENT.....................................................
*-----------------------------------------------------------------------
TOP-OF-PAGE.

* Output the page header and column headers on each new page if the
* Download Format has not been selected by the user
  IF P_DOWNLD NE 'X'.
    PERFORM PRINT_HDRFTR USING C_HEADER.
  ENDIF.                               " IF P_DOWNLD NE 'X'.

*-----------------------------------------------------------------------
* END-OF-SELECTION EVENT................................................
*-----------------------------------------------------------------------
END-OF-SELECTION.

* Output the report footer if the Download Format has not been selected
* by the user
  IF P_DOWNLD NE 'X'.
    PERFORM PRINT_HDRFTR USING C_FOOTER.
  ENDIF.                               " IF P_DOWNLD NE 'X'.

*&---------------------------------------------------------------------*
*&      Form  RETRIEVE_ROUTES                                          *
*&---------------------------------------------------------------------*
* This subroutine retrieves the basic route information for the public *
* customer zip-zip category (routes in the 500000 range).              *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine.   *
*----------------------------------------------------------------------*
FORM RETRIEVE_ROUTES.

  SELECT ROUTE                         " Route
    FROM TVRAB
    INTO TABLE T_ROUTE
   WHERE ROUTE BETWEEN C_LOW_ZIPZIP AND C_HIGH_ZIPZIP
     AND KNANF EQ P_OPLANT.

  CASE P_COLOR.
    WHEN ‘RED’.
      WRITE T_ROUTE-ROUTE COLOR COL_NEGATIVE.
    WHEN ‘GREEN’.
      WRITE T_ROUTE-ROUTE COLOR COL_POSITIVE.
    WHEN OTHERS.
      WRITE T_ROUTE-ROUTE COLOR COL_HEADING.
  ENDCASE.                             “CASE P_COLOR.

  CHECK SY-SUBRC NE 0.
  MESSAGE E999 WITH 'No route found for the origin plant.'(003).

ENDFORM.                               " RETRIEVE_ROUTES
*&---------------------------------------------------------------------*
*&      Form  PRINT_HDRFTR                                             *
*&---------------------------------------------------------------------*
* This subroutine prints the standard PM header and footer as required.*
*----------------------------------------------------------------------*
* PC_HEADER_FOOTER ==>  Indicator for header/footer                    *
*----------------------------------------------------------------------*
FORM PRINT_HDRFTR USING PC_HEADER_FOOTER LIKE SY-WTITL.

* Set the report title based the report being output
  IF FL_PRNT_SUMMARY EQ 'Y'.
    W_TITLE = 'Summary by Customer'(008).
  ENDIF.                               " IF FL_PRNT_SUMMARY EQ 'Y'.

* Output standard PM header/footer
  CALL FUNCTION 'Z_PM_HDR_FOOTER'
       EXPORTING
            RPT_ID      = SY-CPROG
            RPT_TITLE2  = W_TITLE
            RPT_TXT_TYP = PC_HEADER_FOOTER
       EXCEPTIONS
            ERR_RC      = 1
            OTHERS      = 2.

  IF SY-SUBRC NE 0.
    MESSAGE S999 WITH 'Call to function Z_PM_HDR_FOOTER failed.'(024).
  ENDIF.                               " IF SY-SUBRC NE 0.

* Print column headers after the page header
  CHECK PC_HEADER_FOOTER EQ C_HEADER.
  FORMAT COLOR COL_HEADING INTENSIFIED ON.
  IF FL_PRNT_SUMMARY EQ 'Y'.
    WRITE :/1   'Customer'(011),
            12  'Name'(012),
            48  '  Total Delivery Wt.'(014),
            69  '  Current Actual Cost'(016).
  ENDIF.                               " IF FL_PRNT_SUMMARY EQ 'Y'.

  FORMAT RESET.
  SKIP.

ENDFORM.                               " PRINT_HDRFTR
*&---------------------------------------------------------------------*
*&      Form  UPLOAD_PRICING_INFO                                      *
*&---------------------------------------------------------------------*
* This subroutine uploads the pricing information from the user        *
* specified flat file.                                                 *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine.   *
*----------------------------------------------------------------------*
FORM UPLOAD_PRICING_INFO.

  REFRESH T_UPLOAD_STRUCT.
  CLEAR T_UPLOAD_STRUCT.

  IF P_APPSR EQ 'X'.                   " Application server
* Upload the pricing data from the flat file
    OPEN DATASET W_PHY_FILE FOR INPUT IN TEXT MODE.
    DO.
      READ DATASET W_PHY_FILE INTO T_UPLOAD_STRUCT.
      APPEND T_UPLOAD_STRUCT.
    ENDDO.
    CLOSE DATASET W_PHY_FILE.          " SY-SUBRC check is not needed
  ENDIF.                               " IF P_APPSR EQ 'X'.

ENDFORM.                               " UPLOAD_PRICING_INFO
*&---------------------------------------------------------------------*
*&      Form  OUTPUT_REPORT                                            *
*&---------------------------------------------------------------------*
* This subroutine outputs the report.                                  *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine.   *
*----------------------------------------------------------------------*
FORM OUTPUT_REPORT.

  SORT T_DOWNLOAD.
    PERFORM LINE_TOGGLE.
    IF P_SUMMRY EQ 'X'.                " Prepare the summary data
      MOVE-CORRESPONDING T_DOWNLOAD TO T_SUMMARY.
      COLLECT T_SUMMARY.
    ENDIF.                             " IF P_SUMMRY EQ 'X'.
    WRITE :/1   T_DOWNLOAD-SHIP_TO_PARTY,
            12  T_DOWNLOAD-CUSTOMER_NAME.
  ENDLOOP.                             " LOOP AT T_DOWNLOAD.

ENDFORM.                               " OUTPUT_REPORT