14
ARJUN…….LEARN REAL TIME SCENARIOS DONE BY ME Page 1 A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT VIEWS IN DATA DICTONARY Many a times it is required to extract data from several tables this can be a time consuming process. To simplify the process and to increase the efficiency of the code, you can define a VIEW. Data is not stored in a VIEW physically. Here data is combined from several tables, but the data is stored in their respective tables. As the name goes a VIEW is just a VIEW of the selected/desired fields from a number of tables. Fields that are not required are hidden. For example if data needs to be extracted from 5 tables with desired fields, then you can create a VIEW of the required fields. There are 4 types of views Database view Projection view Help view Maintenance view

Views

Embed Size (px)

DESCRIPTION

views

Citation preview

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 1

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    VIEWS IN DATA DICTONARY Many a times it is required to extract data from several tables this can be a time consuming

    process. To simplify the process and to increase the efficiency of the code, you can define a

    VIEW. Data is not stored in a VIEW physically. Here data is combined from several tables, but the

    data is stored in their respective tables. As the name goes a VIEW is just a VIEW of the

    selected/desired fields from a number of tables. Fields that are not required are hidden. For

    example if data needs to be extracted from 5 tables with desired fields, then you can create a

    VIEW of the required fields.

    There are 4 types of views

    Database view

    Projection view

    Help view

    Maintenance view

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 2

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    Database view:

    A view created on two or more tables using inner join concept is

    called database view

    In this view we can only read the data

    We can provide selections to read the data

    We cannot maintain the data

    Ex on database view:

    Develop a database view on MARA and MAKT tables to display

    material number, material type, material units, language and

    description.

    1. Go to SE11

    2. Provide the view name zdb_view and click on create

    3. Select database view

    4. Click on copy

    5. Provide description

    6. Provide the table names and joining condition as below

    a.

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 3

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    7. Click on view fields tab

    8. Click on table fields button

    9. Double click on MARA and select MATNR, MTART and MEINS

    10. Click on copy

    11. Again click on table fields button

    12. Double click on MAKT and select SPRAS, MAKTX

    13. Click on copy

    14. The screen should look as below

    a.

    15. Click on condition tab

    16. Provide the condition as below

    17.

    18. Save and activate

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 4

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    19. Click on Icon and check the records

    Projection view:

    A view created on single table is called projection view.

    Projection views are mainly used to minimize the database

    interface (number of fields) and improve the system

    performance.

    In simple words, we can hide the unnecessary fields from a

    single table

    We can maintain the data in the projection views.

    We cannot provide any selections in the projection views.

    Ex on projection view:

    Go to SE11

    Provide the view name zproj_view

    Click on create, provide description

    Provide the basis table as mara

    Click on table fields button

    Select matnr, mtart, mbrsh and meins

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 5

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    Click on copy button

    Save and activate

    Click on contents and display the view

    Maintaining the data:

    To maintain the data, we have to provide the key fields i.e.

    mandt, matnr

    Go to the view and add the first field as mandt

    Click on maintenance status tab

    Select read and change radio button

    Select display maintenance allowed

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 6

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    Save, activate and display the data

    Help view:

    A view created on two or more tables using outer join concept is

    called help view.

    Help view are specially designed for search helps.

    We cannot execute help views directly, instead we have to

    include help views inside the search helps.

    We cannot maintain the data in help views.

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 7

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    Ex on help views:

    1. Go to SE11

    2. Provide the view name zhelp_view

    3. Click on create

    4. Provide description

    a. Provide the table name as makt OR mara

    b. and click on relationships button

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 8

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    c.

    5. Click on copy, the join condition will be automatically displayed

    6. Click on view fields tab

    7. Provide the field names matnr, mtart, meins and maktx by

    clicking on table fields button

    8. Provide the selection condition if required

    9. Save and activate

    10. We cannot test this help view

    11. If we want to test we should create a search help

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 9

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    Maintenance view:

    A view created on two or more tables using inner join concept is

    called maintenance views

    We can maintain the data in maintenance views

    Maintenance view are used by SAP for internal purpose

    In the real time we dont create any maintenance views because

    the data should be saved or modified in multiple tables which

    leads inconsistency

    If we want save or modify the data, we have to use standard SAP

    transactions or BAPIs

    Ex on Maintenance views:

    1. Go to SE11

    2. Provide the view name zmaint_view

    3. Click on create

    4. Provide description

    a. Provide the table name as makt OR mara

    b. and click on relationships button

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 10

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    c.

    5. Click on copy, the join condition will be automatically displayed

    6. Click on view fields tab

    7. Provide the field names as below

    a.

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 11

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    8. Provide the selection condition if required

    9. Provide the maintenance status as below

    10. 11. Save activate.

    12. Create a TMG for the view and then maintain the data.

    13.

    14. Finally, Click on Icon and check the records

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 12

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    Search Helps IN DATA DICTONARY

    Providing a help functionality or F4 functionality for an input

    field is called search help.

    There are two types of search help.

    Elementary search help

    Collective search help

    Elementary search help: Providing a single search help for an

    input field is called elementary search help.

    Collective search help: Collection of elementary search helps for

    an input filed is called collective search help.

    Assigning search helps:

    Once search helps are created we have to assign them

    At program-selection screen level

    At table-level

    At sap-screen level

    Selection-screen: Input screen to a program or search is called

    selection screen.

    Parameters: It is a keyword to declare or create an input field on

    the selection screen.

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 13

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    Ex:

    Parameters : p_kunnr(10) type c.

    Parameters : p_matnr(20) type c.

    Match code object:

    It is a keyword which is used to assign a search help to the input

    fields on the selection screen.

    By default standard SAP search help will be displayed.

    If we dont want standard search help then we use match code

    object to assign our own search help.

    Syntax:

    Parameters: (len) type match code object

    Or

    Parameters: type

    match code object

    Ex on elementary search help:

    Go to SE11

    Provide the search help name zel_sh

    Click on create and provide description

    Provide the selection method as mara

  • A R J U N . L E A R N R E A L T I M E S C E N A R I O S D O N E B Y M E

    Page 14

    A B A P & W E B D Y N P R O A B A P @ A R J U N IGROWSOFT

    Provide the search help parameter as below with

    IMP,EXP,SPOS,LPOS

    Save, activate and test it

    Assigning search help at program-selection screen level:

    Go to SE38

    Create a program by name zsh_prog

    Write the below code

    Save Act and Test