Intro to ABAP - Chapter 12

Document Sample
Intro to ABAP - Chapter 12 Powered By Docstoc
					              Authorizations,
        Passing Between Programs,
         Catching Runtime Errors




BC170_2.12.1
                          Objectives

 • The participants will be able to:
       – Define Authority Objects and how they are used
         in SAP
       – Describe how to use the following commands in
         an ABAP Program:
               • EXPORT
               • IMPORT
       – Describe how to catch run time errors in SAP

BC170_2.12.2
               Authority Objects in SAP




BC170_2.12.3
 The AUTHORITY-CHECK Statement
         AUTHORITY-CHECK OBJECT ‘S_DEVELOP’
                         ID ‘DEVCLASS’ FIELD ‘YLJS’
                         ID ‘OBJTYPE’ DUMMY
                         ID ‘OBJNAME’ DUMMY
                         ID ‘P_GROUP’ DUMMY
                         ID ‘ACTVT’    ‘03’.



  The AUTHORITY-CHECK              The option DUMMY
  lists the fields to be checked   suppresses the check for
  and verifies what the user is    the specified field. The net
  attempting to do against         effect is that the user can
  what the user is authorized      perform any activity on
  to do.                           development class YLJS.
BC170_2.12.4
          Reacting to the AUTHORITY-
              CHECK Statement

         AUTHORITY-CHECK OBJECT ‘S_DEVELOP’
                             ID ‘DEVCLASS’ FIELD ‘YLJS’
                             ID ‘OBJTYPE’ DUMMY
                             ID ‘OBJNAME’ DUMMY
                             ID ‘P_GROUP’ DUMMY
                             ID ‘ACTVT’       ‘01’.
         IF SY-SUBRC <> 0.
          WRITE: / ‘You are not authorized to development’,
                   ‘class YLJS.’.
          EXIT.
         ENDIF.


BC170_2.12.5
               Authority Check Timing

               PARAMETERS: CO_CODE LIKE BSIK-BUKRS.
               SELECT *
               FROM BSIK
               WHERE BUKRS = CO_CODE
               ORDER BY PRIMARY KEY.
                AUTHORITY-CHECK OBJECT ‘F_KNA1_BUK’
                        ID ‘BUKRS’ VALUE CO_CODE
                        ID ‘ACTVT’ ‘03’.
                IF SY-SUBRC <> 0.
                 EXIT.
                ENDIF.
               ENDSELECT.
BC170_2.12.6
                 The EXPORT Statement




                                 EXPORT SY-SUBRC
                                  TO MEMORY ID ‘LJS1’.
EXPORT KNA1-KUNNR
      KNA1-BUKRS
 TO MEMORY.
  BC170_2.12.7
                The IMPORT Statement
IMPORT <variable name>
 FROM MEMORY.




 BC170_2.12.8
                  Catching Runtime Errors


               CATCH SYSTEM-EXCEPTIONS
                          ARITHMETIC_ERRORS = 5
                          CONVERSION_ERRORS = 6.
               […..]
               ENDCATCH.




BC170_2.12.9
         Completing the CATCH Code
DATA:           int type I,
                char(3) type C value ‘ABC’.
[…..]

CATCH SYSTEM-EXCEPTIONS
        CONVERSION_ERRORS = 1.
 […..]
 MOVE char TO int. “MOVE keyword to trigger CATCH
  […..]
ENDCATCH.

IF SY-SUBRC = 1.
 WRITE: / ‘Conversion error has occurred’.
ENDIF.

BC170_2.12.10
                           Summary

 • The participants should be able to:
       – Define Authority Objects and how they are used
         in SAP
       – Describe how to use the following commands in
         an ABAP Program:
                • EXPORT
                • IMPORT
       – Describe how to catch run time errors in SAP

BC170_2.12.11
BC170_2.12.12

				
DOCUMENT INFO
Shared By:
Stats:
views:10
posted:12/3/2012
language:Unknown
pages:12
Description: sap abap introduction, very specific,welcome download
201212 29 201212 29
About download professional profile