[SAP NetWeaver Gateway] oData in Practice – Part 2

Objective: Retrieving Association Data from an OData service

Create Association Between EntitySet

  • Create New Entity Type with Detail Item Data
  • Create New Association

on folder icon named Association, right click > create

then following the wizard,

Principal Entity -> Header

Where table contain Header Records (ZET_USER_PROFILE)

Dependent Entity -> Detail Item

Where table contain Detail Item (ZET_USER_SKILL)

Cardinality means relation between table, here we set the relation between header->item are one to many.

So we set cardinality header with 1 then cardinality for item 1..n

The key we set into pernr.

  • Generate Runtime Object
  • Redefine Method ZETXXX_GET_ENTITYSET with below source code

  METHOD zet_user_skillse_get_entityset.

“Declaration of Local Navigation
DATAlt_nav_path TYPE /iwbep/t_mgw_tech_navi,
ls_nav_path TYPE /iwbep/s_mgw_tech_navi.

“Declaration of Input Parameter Structure
DATAlx_key_tab   LIKE LINE OF it_key_tab,
lx_entityset LIKE LINE OF et_entityset.

“Declaration of Internal Table
DATAlx_user_skill TYPE zta_fio_skill,
lt_user_skill TYPE TABLE OF zta_fio_skill.

“Local Variable
DATAlv_pernr        TYPE char5,
lv_where_clause TYPE string.

lt_nav_path io_tech_request_context->get_navigation_path).

READ TABLE lt_nav_path INTO ls_nav_path WITH KEY nav_prop ‘TOSKILLS’.
IF sysubrc 0.

“1) Request URI using Association

READ TABLE it_key_tab INTO lx_key_tab WITH KEY name ‘Pernr’.
IF sysubrc 0.
lv_pernr lx_key_tabvalue.

FROM zta_fio_skill
WHERE pernr lv_pernr.
IF lt_user_skill[] IS NOT INITIAL.

LOOP AT lt_user_skill INTO lx_user_skill.

TO lx_entityset.
APPEND lx_entityset TO et_entityset.




“2) Request URI using Filter 

“/sap/opu/odata/sap/ZUSER_PROFILE_SRV/ZET_USER_SKILLSet?$filter=Pernr eq ‘xxxxx’
lv_where_clause io_tech_request_context->get_osql_where_clause_convert).
FROM zta_fio_skill
WHERE (lv_where_clause).

IF lt_user_skill[] IS NOT INITIAL.

LOOP AT lt_user_skill INTO lx_user_skill.

TO lx_entityset.
APPEND lx_entityset TO et_entityset.





  • Testing go to /n/IWFND/MAINT_SERVICE > your_service_srv > SAP Gateway Service

>Request URI using Association

IMPORTANT: make sure the navigation property is set correctly.

Navigation Property is used for Relation between Entity Types that used as Request URI using Association. To check that open SEGW, check under Entity Types > Header Entity Types (ZET_USER_PROFILE) > Navigation Properties



>Request URI using Filter

/sap/opu/odata/sap/ZUSER_PROFILE_SRV/ZET_USER_SKILLSet?$filter=Pernr eq ‘00001’


Debug Story – BAdI not implemented for appset …

It was started couple days ago. Two of my colleagues reporting issue regarding write back data on a BPC Environment Model. We’ve never have this problem before. The write back engine run smoothly on every model in every situation.

So I start to debug several spots to understand what’s going on.

The error caused by Exception cx_badi_not_implemented which generated by method,
Find BAdI implementation,
GET BADI lo_badi
appset_id = d_appset_id
application_id = d_appl_id
module_id = ds_wb_param-work_status-module_id.

So, my first attempt I try to by pass this procedure by change flag ds_wb_param-execute_badi into abap_false.
But, on the following step there is more validation for this exception.

My second attempt would be checking the the object of lo_badi which reference into BAdI badi_ujr_write_back. There are two implementations using this enhancement spot. I’m guessing since this implementation we need to input appset_id, application_id, & module_id so we get the right implementation.
But the write back we used comes from standard process, it doesn’t make any sense if the implementation doing something wrong with standard process. So I crossed this possibility and start to think another option.

Then I tried to debug deeper.
The next guess would be my third attempt.
I found the same exception showed on method CL_UJV_VALIDATION_MGR -> CHECK_VALIDATION.
Try to dig deeper, I found the table UJV_MODULES which for BPC Validations – Module On/Off Table.
And there is only one record for that model. *AHA

So i googled little bit then found out that TCode UJ_VALIDATION which generate the record for tables UJV_MODULES.

Then I ask permission one of my senior if he still using the validation or not. Then Turning off validation for that model. It works like a charm.
Problem Solved

for further information on how UJ_VALIDATION works or how to use it check:

BW – Collection Run for Entries Delta Update

So we found this problem regarding Delta Update on BW server.
After BW running on production phase for a couple days we saw the update are not running as they should. They’re some extraction that remain on yellow light. It seems like there are no data coming through anymore from ECC to BW side.

It turned out there are a lot of entries Queue-ing on ECC side. Using transaction SMQ1, we could see some entries are waiting in line to be extracted.

It’s like a ‘Clogged Pipes’.
So how do we overcome the clogged pipes? we need to take out the plug.
But, where is the plug in terms of data flow from ECC to BW?

What we don’t know is, there is a difference process to update Full/Initial Datasource and Delta Datasource. Full/Initial data extracted are store in Setup-Table.
If initialization is successfully extracted into BW PSA, delta generated on ECC. From then on, data collection stored in Delta Queue (RSA7) before extracted by Infopackage.

And now for the best part, Unclogging.
It turned out we need to do the V3 job, releasing the entries data delta into queue delta before delta info package is triggered from BW-side.
Go to LBWE.
By clicking the job control and scheduling the job. Data Entries that stuck on SMQ1 are flowing into Delta Queue RSA7.

After setting up the background job process( I think I need to create a blog post on how I do this) for every time delta infopackage requested, the ‘Clogged Pipes’ never seen anymore.

Multi Tenancy in Enterprise Resource Planning Trends

What is Multi Tenancy?

According to Gartner

Multitenancy is a reference to the mode of operation of software where multiple independent instances of one or multiple applications operate in a shared environment.

Single-Tenant vs Multi-Tenant?

> Single Tenant Model – Each customer gets a separate instance of the software which runs on a logically isolated hardware environment.
> Multi-Tenant Model – All the customers are served from the same common software instance and hardware infrastructure.

What’s the difference from today environment?

Quoting from Bill Harmer, Gooddata

In the old days, hosted systems were very common. IBM, CGI, and others allocated servers and provisioned software to run systems for customers–meaning one installation of the binary for each customer. Systems were accessed over dedicated connections, and the “server” industry boomed. Now, the public infrastructure (the Internet) is used to access those same systems. The software, in a lot of cases, is legacy on premise software that is being run in the vendor’s data centers and typically uses a VMWare, Xen or other system-level virtualization to manage the deployments. These 20-year-old hosted-style deployments are not only in use today, but are often slapped with the ubiquitous “cloud” moniker.

What does it do with ERP?

with the popularity of salesforce.com, cornerstone on demand, and other multi-tenants. Now we can see the use of multi-tenant everywhere. It’s not all about the trend, it’s the new era of software development where the old definition of ‘Write once and use it everywhere’ change into ‘Write once and use it for everyone’.
Everyone means multiple customer using the same instance of a software, this model would be advantage for the both sides. For Developer we only need to patch the software once for all customer. For customer we don’t need to setup the infrastructure,which means it would save hell of the money for IT implementation.

And for SAP?

You think that SAP are not prepare for this trend? i’ll give you a hint, they are well prepared.
for the last years SAP already acquiring some cloud multi-tenant across the world:
http://www.ariba.com/ -> SD & FI
http://www.successfactors.com/ -> HCM
http://www.workday.com/ -> HR & FI
https://www.concur.com/ -> Travel Expense
http://www.fieldglass.com/ -> Vendor Management Systems (SD)
https://www.hybris.com/en/ -> SD

Those company acquired in the range of 2011-2014.

More over, John Appleby, stated that SAP HANA will support a ‘True Cloud Multi-Tenancy’.

“The Public Cloud version will use database multi-tenancy, which is quasi-multitenant from a cloud perspective. ABAP Code-lines, configuration tables etc. will not be shared yet between customers on one SAP HANA container database. This is expected to come in time, as SAP HANA supports true cloud multi-tenancy.”

With a lot of technology acquired across module by SAP, I think they are pretty serious to join the era of multi-tenant. Although i don’t know how they’re going to integrate all of their ‘New Acquire Product’ into SAP in the future. Either they have a independent module for travel expense, maybe? or they took all of the engine inside and put it into SAP-ABAP-HANA style?
It’s a lot of possibilities what they could do with those technology.
But, according to the history of their acquisition, I strongly believe that they’re going to do the right thing.
For instance, the acquisition of company name Outlooksoft in 2007, which turned out to be SAP BPC nowadays, integrated so well with SAP ecosystem. Now with SAP BPC 10, they have a new look SAPUI5’s style, the program looks more ‘SAPed’. They even create specific BAdI to accommodate the BPC engine so they could integrate logic script – ABAP – package (excel EPM) so well.
You get the idea, right?

So, How strategic is S/4HANA to SAP?

To put this into context, Hasso Plattner, SAP Chairman of the Executive Board, was quoted as saying:

“If this doesn’t work, we’re dead. Dead in the water.”

MM – Copy Reference PO

Why do I need to write this down?
As a ABAP sometimes we need to test the transaction in countless time. And in specific cases we need to deal with standard program which we don’t know the flow yet.
If you could cancel the document number or transaction is it okay if you have one, but there also cases where transaction are cannot be canceled.

With the help of a friend I need to make some PO, so he telling me in short of way.
So here is the step by step.

1. Go to Tcode ME21n
2. Document Overview
3. Click Selection Invariant (red, yellow, blue icon)
4. Choose Purchase Order from drop down
5. Execute
6. Screen will be back to ME21N screen
7. Click Purchase Doc
8. Click Adopt
9. Save
10. New duplicate Purchase Order number created on message.

Open File Browser from SAP

In this tutorial I would like to share about how to show explorer pop-up in SAP. Explorer pop-up is the menu that get the path of file location on computer. We used this when we want to browse file in save or open action from word. It’s the pop-up menu that show the directory of your local disk.

SAP already prepare this using function module “F4_FILENAME”.

It’s looks like this.

All we need to do is put the function module on selection screen inside a program.
When search help clicked function module called. Then the explorer pop-up going to show. Choose the file in desired location then the path of file going to show on Input Field.

PARAMETERS : p_file TYPE rlgrap-filename." DEFAULT 'C:\TEST.xls' OBLIGATORY.



      field_name = 'P_FILE'
      file_name  = p_file.

When do we use this on program?
In my experience so far,
1) FTP
I use this to locate file which I want to download or upload. We need that path of file on local or server to get and then store it.
2) Upload Data
To read the specific file format which corresponding with program. Some format that frequently used are CSV, XLS, etc.

Using this explore pop-up makes easier to user to locate the file with GUI intead of copy+paste the directory intoo program.

Analisa Into Corresponding Field vs Into Table

Dalam melakukan proses SELECT * kita sudah tau bahwa sebaiknya tidak menggunakan SELECT *, karena proses ini akan memilih semua field yang ada pada table. Agar efektif maka lebih baik kita memilih field yang diperlukan saja untuk dimasukan kedalam internal table. Untuk memasukan field ke internal table ada beberapa ABAPer yang menggunakan cara INTO TABLE dan ada yang menggunakanan INTO CORRESPONDING FIELDS OF TABLE.

Abaper yang menggunakan cara INTO TABLE beranggapan bahwa penggunaan INTO CORRESPONDING FIELDS OF TABLE tidak efektif karena akan mencocokan nama field sumber dengan semua field tujuan terlebih dulu.
Sedangkan penggunaan SELECT bsart ebeln bukrs harus disesuaikan dengan isi structure dari table internal tujuan.
Jadi penggunaan syntax SELECT diatas digunakan untuk mengisikan structure,

TYPES: BEGIN OF ty_ekko,
bsart LIKE ekko-bsart,
ebeln LIKE ekko-ebeln,
bukrs LIKE ekko-bukrs,
END OF ty_ekko.

Perhatikan urutan field yang di SELECT dengan urutan field dalam table, urutanya sama bsart ebeln bukrs. Oleh karena itu penggunaan INTO TABLE membutuhkan effort lebih dalam menempatkan urutan field.
Jika tidak sesuai dengan urutan fieldnya, sebagai contoh dengan structur yang sama kita menggunakan command SELECT bukrs bsart ebeln, maka field bsart akan terisi oleh record isian dari bukrs.
Namun hanya dengan proses pemasukan data kedalam internal table itu saja apakah proses INTO TABLE bisa lebih cepat dibandingkan dengan INTO CORRESPONDING FIELDS OF TABLE ?

Untuk pembuktianya akan dilakukan proses SQL Trace pada T-code ST05 untuk membandingkan runtime dari proses selection pada table dengan menggunakan dua cara,
Cara pertama menggunakan syntax INTO TABLE dengan snippet berikut,

SELECT bsart ebeln bukrs
INTO TABLE gi_ekko
FROM ekko
WHERE bsart = c_bsart.

Cara kedua menggunakan,

FROM ekko
WHERE bsart = c_bsart.

Jangan lupa sebelum melakukan proses selection table kita harus mengaktifkan SQL Trace terlebih dahulu dengan CALL FUNCTION 'SQLT_TRACE_ON'. Dan mematikanya dengan CALL FUNCTION 'SQLT_TRACE_OFF'. Atau jika tidak secara terprogram maka kita aktifkan dan deactive-kan secara manual lewat T-code ST05.
Dalam ST05 jika kita klik Display Trace (jangan lupa deactivate terlebih dahulu) maka akan tampil proses proses SQL yang telah dilakukan dalam rentang waktu tertentu.

SQL Trace List

Gambar 1. SQL Trace List

Dalam gambar diatas klik pada Menu item Trace List, kemudian pilih Combined Table Accesses.

Gambar 2. Combined Table Accesses

Gambar 2. Combined Table Accesses

Pada kolom Access Time terdapat runtime dalam unit miliseconds penggunaan SQL sebanyak 2 baris, sesuai dengan 2 proses SQL yang kita gunakan. Baris pertama penggunaan dengan INTO TABLE , baris kedua untuk INTO CORRESPONDING FIELDS OF TABLE.

Gambar 3. Table Summary

Gambar 3. Table Summary

Runtime keduanya jika dilihat tidak jauh berbeda, bahkan jika saya coba berulang ulang kali terkadang access time dari INTO TABLE bisa lebih cepat dari INTO CORRESPONDING FIELDS OF TABLE.
Mengapa hal ini bisa terjadi? Untuk mengetahui proses yang terjadi didalm lebih lanjut kita kembali lagi ke tampilan trace list awal pada gambar pertama. Pada operation REOPEN, klik pada bagian statement yang ada kemudian klik tombol Explain.
Pada SQL trace waktu penggunaan syntax INTO CORRESPONDING FIELDS OF TABLE , SQL statement yang diterjemahkan telah memilih field yang sesuai dengan structure yang dimiliki oleh internal table.

Gambar 4. Explain SQL Statement

Gambar 4. Explain SQL Statement

ABAP engine disini sudah pintar, sudah tau field field apa yang kita butuhkan tanpa harus memilih field field yang diperlukan sesuai dengan field yang telah di definisikan sesuai structurepada internal table.
Dapat disimpulkan bahwa penggunaan INTO CORRESPONDING FIELDS OF TABLE, tidak terlalu berbeda jauh runtimenya untuk memilih field field tertentu dari table.
Yah sejak awal belajar karena saya menggunakan INTO TABLE maka setelah membuktikan sendiri seperti ini sepertinya saya akan beralih menggunakan INTO CORRESPONDING FIELDS OF TABLE.

[Blog] Hidup Baru Sebagai Konsultan SAP

Ceritanya saya baru lulus kuliah nih, dan Alhamdulillah langsung diterima kerja sebagai IT Consultant-Enterprise Developer untuk SAP. Berikut overview-nya tentang SAP.

Apa itu SAP?
pasti belum banyak yang tau nih,
SAP (Systems Applications Products) adalah sebuah perusahaan software asal Jerman. Software yang dikembangkan dikategorikan sebagai Enterprise Resource Planning (ERP). ERP disini berarti sebuah software yang digunakan untuk mengontrol sumber daya yang dimiliki perusahaan. SAP memiliki keunggulan dalam integrasi modul-modul yang dimiliki.

Modul modul apa saja yang dimiliki SAP ?

SAP Module

Lalu, kenapa disebut konsultan?
Mengingat SAP hanyalah sebuah system, tugas kita adalah menyesuaikan system agar berjalan sesuai dengan bisnis proses tiap-tiap perusahaan. Tiap-tiap perusahaan memiliki bisnis proses yang berbeda-beda. Dari mulai urusan dengan produksi, vendor, bank, sampai ke user, tiap perusahaan memiliki treatment yang berbeda-beda.

Apa saja jobdesc dari seorang konsultan SAP?
Dalam prakteknya, konsultan SAP dibagi menjadi 2, Functional dan Technical. Seorang konsultan functional SAP biasanya memiliki spesialisasi dalam satu modul SAP. Functional ini yang berhubungan dengan user. Sehingga tugas utamanya mereka adalah menterjemahkan bisnis proses dari tiap2 divisi user ke modulnya masing2.
Sedangkan technical sendiri dibagi lagi menjadi ABAP dan Basis. ABAP (Advance Business Application Programming) adalah bahasa pemrograman khusus SAP. Kebetulan saya masih ABAP-er newbie nih. Tugas utama dari seorang ABAP-er adalah menterjemahkan keinginan user yang sudah dipahami oleh functional menjadi program. Sedangkan Basis adalah ranah teknikal yang mengurusi backend SAP.

Jadi masnya Programmer SAP atau Konsultan SAP sih?
Jadi masih banyak missconception disini, istilah programmer SAP lebih cocok untuk mendefinisikan programmer yang mendevelop system SAP di markas SAP di Waldorf,Jerman sana.
ABAP-er adalah programmer yang mengcustomize system SAP sesuai dengan permintaan user. Beberapa program, table, function, module standard dari SAP sudah di develop oleh tim dari SAP sono, dan kita tinggal make beberapa fungsi fungsi standard yang telah tersedia. Fyi aja, program-program yang telah tersedia dari SAP ini jumlahnya ribuan sehingga sebenarnya kita tidak perlu membuat program dari nol. Tinggal pintar-pintar saja mencari program yang ada dan mencari fungsi yang hampir serupa kemudian di customize sesuai kebutuhan user.
Maka dari itu saya lebih nyaman dengan istilah Enterprise Developer – IT Consultant.

Bedanya Enterprise Developer sama programmer yang lain apa dong?
dulu saya pernah baca artikel bagus di The Next Web, http://thenextweb.com/dd/2013/11/12/alpha-vs-enterprise-developers/
sedikit curcol, dulu jaman kuliah saya bercita-cita sebagai Alpha Developer, karena waktu itu smartphone baru awal2 muncul dan kelihatanya keren bikin apps yang bisa dipake tiap-tiap hari oleh semua anak muda. Namun apa daya startup-startup seperti itu belum bisa menjanjikan dan belum dapat kesempatan untuk mencoba. Namun, saya bersyukur bisa terdampar di dunia SAP.

Lalu kerjaan sehari-hari dari seorang ABAP-er apa dong?
Gak jauh beda dengan programmer lainya, namun disini kita harus berkomunikasi secara intens dengan sang functional untuk merealisasikan spec buatan mereka yang sesuai dengan permintaan user. Tugas ABAP-er secara basic mengerjakan RICEF (Report, Interface, Conversion, Enhancement, Forms). Semisal membuat form-form untuk dokumen dari perusahaan sampai dengan report-report yang dibaca oleh direksi tentang status resource mereka, menghubungkan SAP dengan environment diluar ABAP (3rd party), dll.
Sama seperti tugas engineer lainya lah, membuat apa yang belum ada menjadi mungkin dan bisa dilakukan.

© 2018 Rijdz

Theme by Anders NorenUp ↑