Hoş Geldiniz,

SAPOfis Türkiye üzerinde yer alan içeriklere erişim sağlayabilmek, projelerinizde karşılaştığınız sorunlara birlikte çözüm üretebilmek adına üye olunuz.
Unutmayalım ki, bilgi paylaşıldıkça değer kazanır.
Giriş Yap

Sorun Cevaplayalım

İşinizle ilgili öngörüler edinin, gerçek zamanlı bilgilere göre karar alın.

SAP Eğitim ve Sertifika Dönemleri

Uzmanlığınızı ve deneyiminizi SAP çözümleri kullanarak tasdik edin.

Çözüm Ekibi Başvurusu

Kullanıcılara hızlı ve pratik çözümler üreterek görev almak isteyenler.

SAP BLOG Table maintenance with ABAP in BW

SAP Blog

Kayıtlı Üye
Katılım
22 Ara 2017
Mesajlar
431
Tepki Puanı
4
Puanları
6
Summary:


In this article we will provide you how to maintain table/index/view in ABAP. Same functionality you can achieve using transaction SE14 (Utility for Database Tables).

Introduction:

There is standard transaction (SE14) in BW to maintain table. But there is not mentioned how to use this function if you want to write a custom program/solution and maintain table with ABAP code.

Target Audience:

Main target of this article are BW consultants who have basic knowledge with ABAP and realizing complex business customer requirements.

Business scenario:


We have a specific solution relevant for better performance during loading data into ODS. We use a secondary index while data are loaded into ODS with end routine and direct update of data in this end routine. For the purposes of this article, it is not necessary to describe in detail this logic of data loading

We faced problems with query performance if secondary index exists in ODS. We noticed that without secondary index performance of query was normal (data extraction takes time under one minute). When we have created the index performance went down (same query, around 15 minutes). We find out in DB02 that query select was using new index what causes performance issues. If the index was dropped everything was normal.

Solution:


After identification what causes the problem we decided to write a program which can be used in process chain to create index before data loading and after that drop the index so that query performance was not affected.

We were looking for a solution on internet but without success. I decided to debug SE14 to find out how SE14 works. After few attempts I found the right function module(FM) which provide database operations and can be used in separate custom program.

FM: DD_DB_OPERATION

You can write a simple program with few variables. For example ‘ZBW_INDEX_CREATE_DROP’:

Table maintenance with ABAP in BW


Code exeample:

PARAMETERS:
p_fct TYPE tbatg-fct,
p_oname TYPE tbatg-tabname,
p_idname TYPE dd12l-indexname,
p_otype TYPE tbatg-object DEFAULT 'INDX'.
DATA:
i_prid TYPE sy-tabix VALUE 0,
i_status TYPE ddxtt-modeflag VALUE 'D'.

CALL FUNCTION 'DD_DB_OPERATION'
EXPORTING
FCT = p_fct
ID_NAME = p_idname
OBJ_NAME = p_oname
OBJ_TYPE = p_otype
PRID = i_prid
STATUS = i_status


You have to fill at least this variables in function module:

FCT – type of action CRE = create, DEL = delete (CRE’, ‘DEL’, ‘CNV’, ‘ICN’, ‘MDF’)

ID_NAME – ID of the view od index ID

OBJ_TYPE – INDX = index, TABL = table (‘TABL’, ‘SQLT’, ‘INDX’, ‘VIEW’)

PRID – use default value 0



We will create two variants with variables for create and drop index which will be used in process chain

Table maintenance with ABAP in BW


Table maintenance with ABAP in BW


Table maintenance with ABAP in BW


Now we can use the variants in process chain in step ABAP Program

Table maintenance with ABAP in BW


One variant for create index

Table maintenance with ABAP in BW


One variant for drop index

Table maintenance with ABAP in BW


Usage in processchain:

Table maintenance with ABAP in BW


Result:


As you can see with function module DD_DB_OPERATION table can be maintained with ABAP coding. Than this logic used in process chain to automate the process. FM can used in a lot of business scenarios depend on your needs.

Okumaya devam et...
 
Üst