Workflow DAY1

40
JH SOFTECH SAP WORKFLOW - 1 - www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555 For Online SAP Classes contact us at Skype ID - Aditya.jhsoftech Whats App - 7842000555 For Free Online Material Like us on www.fb.com/jhsoftech1 Follow us in www.twitter.com/jhsoftech https://plus.google.com/+JhSoftech/

description

workflow

Transcript of Workflow DAY1

  • JH SOFTECH SAP WORKFLOW

    - 1 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    For Online SAP Classes contact us at Skype ID - Aditya.jhsoftech Whats App - 7842000555 For Free Online Material Like us on www.fb.com/jhsoftech1 Follow us in www.twitter.com/jhsoftech https://plus.google.com/+JhSoftech/

    http://www.fb.com/jhsoftech1http://www.twitter.com/jhsoftechhttps://plus.google.com/+JhSoftech/

  • JH SOFTECH SAP WORKFLOW

    - 2 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    JH SOFTECH Your partner to excel

    SAP WORKFLOW

    JH SOFTECH ISO 9001 2008 Certified

    301,Pavani Anasuya Towers, Opp HUDA Complex, Tarnaka, Hyderabad.INDIA

    Ph: 040 66310555, 66311555, 07842000555

    www.jhsoftech.com

  • JH SOFTECH SAP WORKFLOW

    - 3 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    - Basics of Workflow

    - Basics of BOR objects - Steps to create workflow

    - Followed by practical

  • JH SOFTECH SAP WORKFLOW

    - 4 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    Procedures

    Procedures contain a set of statements, and are called from other ABAP programs.

    The processing blocks that you call from ABAP programs are called procedures

    You define procedures in ABAP programs. When the program is generated, they remain as standalone modules. You can call procedures in the program in which they are defined, or from external programs. Procedures have an interface for passing data, and can also contain local data.

    ABAP contains the following kinds of procedures:

    Subroutines

    Subroutines are principally for local modularization, that is, they are generally called from the program in which they are defined. You can use subroutines to write functions that are used repeatedly within a program. You can define subroutines in any ABAP program.

    Function Modules

    Function modules are for global modularization, that is, they are always called from a different program. Function modules contain functions that are used in the same form by many different programs. They are important in the R/3 System for encapsulating processing logic and making it reusable. Function modules must be defined in a function group, and can be called from any program.

    Methods

    Methods describe the functions and behavior of classes and their instances in ABAP Objects. Methods must be defined in classes. When you call them, you must observe certain special rules of object-oriented programming.

    BOR

    Error! Reference source not found.Error! Reference source not found.Error! Reference source not found.Error! Reference source not found.Definition

    The Business Object Repository (BOR) is the object oriented repository in the R/3 System. It contains, among other objects, SAP Business Objects and their methods.

    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db975c35c111d1829f0000e829fbfe/content.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htmhttp://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm

  • JH SOFTECH SAP WORKFLOW

    - 5 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    In the BOR a Business Application Programming Interface (BAPI) is defined as an API method of an SAP Business Object. Thus defined, the BAPIs become standard with full stability guarantees as regards their content and interface.

    Use

    With regard to SAP Business ObjectsError! Reference source not found. and their BAPIs, the BOR has the following functions:

    Provides an object oriented view of R/3 System data and processes.

    R/3 application functions are accessed using methods (BAPIs) of SAP Business Objects. Implementation information is encapsulated; only the interface functionality of the method is visible to the user.

    arranges the various interfaces in accordance with the component hierarchy, enabling functions to be searched and retrieved quickly and simply.

    Manages BAPIs in release updates.

    BAPI interface enhancements made by adding parameters are recorded in the BOR. Previous interface versions can thus be reconstructed at any time.

    When a BAPI is created the release version of the new BAPI is recorded in the BOR. The same applies when any interface parameter is created.

    The version control of the function module that a BAPI is based on is managed in the Function Builder.

    Ensures interface stability.

    Any interface changes that are carried out in the BOR, are automatically checked for syntax compatibility against the associated development objectsError! Reference source not found. in the ABAP Dictionary.

    Error! Reference source not found.Error! Reference source not found.Error! Reference source not found.Error! Reference source not found.Error! Reference source not found.Error! Reference source not found.Error! Reference source not found.Error! Reference source not found.Error! Reference source not found.Definition

    Some BAPIs and methods provide basic functions and can be used for most SAP Business Objects. These BAPIs are:

    BAPIs for Reading Data

    The following BAPIs provide you with read-only access to data in the associated Business Object:

    GetList

    With this BAPI you can select a range of objectError! Reference source not found. key values, for example, company codes and material numbers. To specify appropriate selection requirements the calling program must pass the relevant parameters to the interface.

    The key values selected by the BAPI GetList are returned to the calling program in a table, together with other useful information, for example, short texts. The key values can then be passed on to another BAPI for further processing, for example, the BAPI GetDetail, as listed below.

  • JH SOFTECH SAP WORKFLOW

    - 6 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    For further information on programming GetList BAPIsError! Reference source not found. see Programming Value Ranges.

    GetDetail

    The BAPI GetDetail uses a key to retrieve details about a specific instance of an objectError! Reference source not found. and returns this data to the calling program.

    GetStatus

    The BAPI GetStatus is used to query the status of an SAP Business Object, for example, to determine the processing status of a sales order. This BAPI is used only for displaying the status of an object and does not retrieve full details like the BAPI GetDetail.

    ExistenceCheck

    The BAPI ExistenceCheck checks whether an entry exists for an SAP Business Object, for example, whether the customer master has been created. You should implement this method as a workflow method and not as a BAPI (RFC capable function module).

    The method CompanyCode.ExistenceCheck of the business objectError! Reference source not found. CompanyCode (BUS0002) is an example of this. This workflow method is indirectly invoked when the calling program instantiates an object, for example, by using GetSAPObject("CompanyCode") from within Visual Basic.

    Example of a Function Module

    This exampleError! Reference source not found. function module implements the BAPI CompanyCode.GetDetail of the SAP Business Object CompanyCode (BUS0002).

    The BAPI CompanyCode.GetDetail reads details of a company code.

    Note the following in the source code:

    The name of the function module is in the format: BAPI__.

    Specific BAPI data structures are used, identified by the prefix BAPI.

    The key field parameter "COMPANYCODEID" is defined as the import parameter.

    The function module performs authorization checks.

    The function module covers all exceptions.

    Source Code

    function bapi_companycode_getdetail.

    *"------------------------------------------------------

    *"*"Local interface:

    *" IMPORTING

    *" VALUE(COMPANYCODEID) LIKE BAPI0002_2-COMP_CODE

  • JH SOFTECH SAP WORKFLOW

    - 7 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    *" EXPORTING

    *" VALUE(COMPANYCODE_DETAIL) LIKE BAPI0002_2 STRUCTURE BAPI0002_2

    *" VALUE(COMPANYCODE_ADDRESS) LIKE BAPI0002_3 STRUCTURE BAPI0002_3

    *" VALUE(RETURN) LIKE BAPIRETURN STRUCTURE BAPIRETURN

    *"------------------------------------------------------

    * authority check: S_TABU_DIS V_T001

    perform check_authority_t001 changing return.

    check return is initial.

    * company code

    call function 'FI_COMPANY_CODE_DATA'

    exporting

    i_bukrs = companycodeid

    importing

    e_t001 = t001

    exceptions

    error_message = 1

    others = 0.

    if sy-subrc ne 0.

    perform set_return using '10' changing return.

    endif.

    check return-code is initial.

    endfunction.

    SWO1

  • JH SOFTECH SAP WORKFLOW

    - 8 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

  • JH SOFTECH SAP WORKFLOW

    - 9 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

  • JH SOFTECH SAP WORKFLOW

    - 10 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

  • JH SOFTECH SAP WORKFLOW

    - 11 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

  • JH SOFTECH SAP WORKFLOW

    - 12 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    SWC_SET_ELEMENT CONTAINER 'Return' RETURN. SWC_SET_TABLE CONTAINER 'NetworkList' NETWORKLIST. END_METHOD.

    Extending Object Types: Inheritance and Delegation

    Use

    In particular situations you will need to modify an object type in conjunction with delegation rather than create a new object type. This applies whenever you want to add components to an object type which are not provided in the standard version and at the same time need to ensure that productive scenarios with the original SAP object type remain operational.

    If no modifications are required, you can use any released object type provided by SAP as it is.

    Conventions for the other sections of the tutorial

    The procedure described below consisting of create subtype and delegation is always required when you have to extend an SAP object type to meet your requirements.

    However, within this tutorial it is always assumed that the object type to be maintained did not exist in the Business Object Repository and therefore is created from scratch. This section therefore informs you about the procedure involved in certain extensions, but does not really belong to the tutorial.

    Procedure

    Creating a subtype

    Create a new object type as the subtype of the object type you want to extend. This subtype automatically inherits all the components (methods, attributes, and events) of the original object type including its implementation.

    1. Choose Business Workflow Business Object Builder.

    2. In the field Object type, enter the object type you want to extend. This is then the supertype in the inheritance hierarchy.

    3. Choose Subtype.

    http://help.sap.com/saphelp_nw70/helpdata/en/fb/135be4457311d189440000e829fbbd/frameset.htm

  • JH SOFTECH SAP WORKFLOW

    - 13 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    4. For the new object type, enter:

    A unique name that can be used to identify it An object name A name A short description

    1. Enter the name of the implementation program of the object type and assign the code letter of your application.

    2. Confirm your entries with and save the object type created as a local object or with package in a transport request.

    Entering a delegation type

    Before you process "your" object type any further, define it as the delegation type of the supertype.

    1. Exit maintenance of the object type and go back to the Business Object Builder. Choose Settings Delegation System-wide.

    2. Add a new entry to the table. To do this, choose Table view Display Change, then Edit New entries.

    3. Enter the name of the object type (supertype) for which you want to specify a delegation type.

    4. Enter the name of the subtype as the delegation type.

    5. Choose .

    The delegation entered is cross-client.

    In all SAP Business Workflow definition tools, you still have to use the "old" object type (supertype). However, when the definition is read and evaluated (at runtime, for F4 input help, and so on), the definition of the delegation type (subtype) is used.

    STEP BY STEP Creation of BAPI

    Scenario: Step-by-step creation of a BAPI to retrieve fields from table T001.

    Procedure: Go to transaction SE11 and create a structure as shown or as per your requirement.

    Give the name in the Data type field and click create.

    http://help.sap.com/saphelp_nw70/helpdata/en/35/26b0bcafab52b9e10000009b38f974/content.htm

  • JH SOFTECH SAP WORKFLOW

    - 14 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    In the pop-up that comes up, select the radio button structure.

  • JH SOFTECH SAP WORKFLOW

    - 15 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    In the components tab of the structure, give the different fields and their corresponding field types and press enter to check the compatibility and corrective ness.

    Do not forget to save it in a package. You can even save it as a local object. For my example, I save it in a package.

  • JH SOFTECH SAP WORKFLOW

    - 16 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    Check the structure (ctrl + F2) and activate (ctrl + F3) the structure.

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Now we are done with the creation of a Structure. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Go to transaction SE37 where you create function modules. Click on create after you enter the name of the Function module.

  • JH SOFTECH SAP WORKFLOW

    - 17 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    A screen as shown above would pop-up where you mention the function group to save the function module and also provide some short text describing your function module.

    In the next pop-up that follows, click on continue as shown above.

  • JH SOFTECH SAP WORKFLOW

    - 18 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    The function module screen would look like the one above.

    Go to the Attributes tab and select the radio button reading remote-enabled module. Come back to the imports tab and provide the import parameters as shown or as per your requirement.

  • JH SOFTECH SAP WORKFLOW

    - 19 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    Now in the Export tab, provide the export parameters as shown or as per your requirement.

    In the tables tab, provide the information as shown or as per your requirement.

    The next screen you visit is the source code. It would look like this.

  • JH SOFTECH SAP WORKFLOW

    - 20 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    In the source code tab, write the following code in order to pick the data based on the input you provide.

    Now, save and check the code and activate the function module.

    After successful activation, Go to the attributes tab. Go to Function moduleReleaseRelease.

  • JH SOFTECH SAP WORKFLOW

    - 21 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    +++++++++++++++++++++++++++++++++++++++++++++++ Now we are done with the creation of a Function Module. +++++++++++++++++++++++++++++++++++++++++++++++

    Go to transaction SWO1 and enter the name of the BAPI you would like to create or as shown in the screen and click the create button.

    Give the name of the BAPI as above and click on create.

  • JH SOFTECH SAP WORKFLOW

    - 22 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    Give the above-mentioned details and click on the continue icon.

    Save in a package.

  • JH SOFTECH SAP WORKFLOW

    - 23 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    The resulting screen is as follows.

    Now click on the methods to drop down and see what methods are provided by default. There would be two methods, showing in red color which come by default while creating the BAPI.

  • JH SOFTECH SAP WORKFLOW

    - 24 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    Click or select the method as shown above and go to the path UtilitiesAPI methodsAdd methods.

    On the screen that follows, provide the function module name and click on the continue icon.

  • JH SOFTECH SAP WORKFLOW

    - 25 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    In the ultimate pop-up, click the next step icon. We observe that the information is predefined in the fields.

    This is the next screen where you would just click on the next icon.

  • JH SOFTECH SAP WORKFLOW

    - 26 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    Click on Yes. You can see an information message reading ZBAPIFMT001 inserted.

    Now save after you add the method. Select & Double click on the API method.

    Go to Tab: ABAP Check 'API Function'.

  • JH SOFTECH SAP WORKFLOW

    - 27 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    The above screen is displayed. Go to the ABAP tab as shown below.

  • JH SOFTECH SAP WORKFLOW

    - 28 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    Select the Radio button reading API Function as already said above.

  • JH SOFTECH SAP WORKFLOW

    - 29 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    click on the continue icon to proceed further.

    Now select the Object ZBAPI_T001 as shown below.

  • JH SOFTECH SAP WORKFLOW

    - 30 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    Go to : EditChange Release StatusObject type To Modeled.

    The above shown screen will be displayed. Click on yes.

    The message shows, The object type status set to modeled. (or already modeled)

    Go to : EditChange Release StatusObject type To Implemented.

  • JH SOFTECH SAP WORKFLOW

    - 31 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    You can see a message reading Object type status set to implemented

    Now, go to: EditChange Release StatusObjectTo Released.

    There would be two pop ups coming up. Click continue on the Pop Ups.

    Keep the cursor on the 'Method'.

    Go to: EditChange Release StatusObject type componentTO Modeled.

  • JH SOFTECH SAP WORKFLOW

    - 32 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    You can see the message reading status for method zbapifmt001 set to modeled.

    Now, go to: EditChange Release StatusObject type component TO Implemented

    You can see the message reading status for method zbapifmt001 set to implemented.

    Now go to: EditChange Releasse Status Object type component To Released

  • JH SOFTECH SAP WORKFLOW

    - 33 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    You can see the message reading status for method zbapifmt001 set to Released.

    Click on Generate Button. (the red ball kind of button is the Generate button)

    After clicking on the generate button, you can see the message reading Object type 'ZBAPI_T001' generated successfully.

    Now go to BAPI Tcode (BOR) there we can find the BAPI (our BAPI)

    The BAPI browser would look like the screen below.

  • JH SOFTECH SAP WORKFLOW

    - 34 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    You can click on the Alphabetical tab so that you can browse the BAPIs in an alphabetical order. Find your BAPI as shown.

  • JH SOFTECH SAP WORKFLOW

    - 35 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Now we are done with the creation of a BAPI. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Test Your BAPI.

    Enter the name of your BAPI in the transaction SWO1 and click on Test.

    The above screen is displayed. Click on the Execute icon against the BAPI as shown.

  • JH SOFTECH SAP WORKFLOW

    - 36 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    The above screen is displayed where you would require entering the data against the empty input fields.

    We have entered some data in the Field.

    After entering the data, click on the execute icon as shown below.

  • JH SOFTECH SAP WORKFLOW

    - 37 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    The following screen is displayed which has some values as is indicated by the ITEMTAB.

    Click on the Edit table icon as shown below.

  • JH SOFTECH SAP WORKFLOW

    - 38 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    The results as per our input are as shown below.

    By this, we would get it confirmed that our BAPI is working properly.

    We can even check it by passing different values again. Come back to the input and execution screen.

  • JH SOFTECH SAP WORKFLOW

    - 39 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    After executing the BAPI based on the input provided, we get the following screen.

    Hit on the execute icon.

  • JH SOFTECH SAP WORKFLOW

    - 40 -

    www.jhsoftech.in Pavani Anasuya Towers, Tarnaka, Hyderabad, INDIA.Ph: +91 040- 66310555, 66311555

    In the above shown screen, hit on the edit table icon.

    The above is the output we get from the input we provided.

    We are now done with the creation and successful execution of a BAPI.

    BORExample of a Function Module