Quantcast
Channel: SCN : All Content - ABAP for SAP HANA
Viewing all 831 articles
Browse latest View live

How to convert a timestamp to date/time in CDS View?

$
0
0

Dear experts,

 

I would like to convert a timestamp to a date and time within a CDS view.

This is what I tried to do:

 

Cast (Cast(<timestamp> as abap.dec(8,0)) as abap.dats) as <date>

 

I also thought about first converting the timestamp into a plain numerical character, then using substring and then casting it to abap.dats. Then its giving me an error that says: "dec can't be converted into numc".

 

The above written code also throws an error - "function not allowed/ no cast within a cast".

It is quite nasty not being able to write a cast within a cast - how else am i supposed to achieve a date here?

 

I am looking forward to have your answers!

 

Thanks and BR

Anja


SAP connection to SAP HANA

$
0
0

Hi,

 

I am on a HANA database sandbox using HANA studio and I am trying to determine which SAP systems (i.e. ECC) are connected to the SAP HANA database and what the settings are:

- Hosts

- Instance

- SID

 

I don't see a perspective called ABAP. (see attached). Could this be due to missing privileges?

 

Aam looking in wrong place?

 

Thanks

Create CDS view using HANA live view

$
0
0

I was working on couple of LIVE views (ex. "_SYS_BIC"."sap.hba.ecc/WorkCenterCapacity"). I converted this into external view and while trying to consume it in CDS view it's showing an generic error ( ‘An error occurred while creating view <ZXXXX> in the database.’).

 

Few more scenarios I tried:

1. While using DDIC view in CDS, it's working.

2. While converting customized HANA view to external view, I can consume the same external view to CDS without any error.

3. Even encapsulating Live view into HANA view and using that converted ext view to CDS- throwing same generic error.

 

Not sure what is the special about those external view converted from LIVE view directly or indirectly.

 

Any suggestion/comment will be really appropriated.

Consumption of ABAP CDS view.

$
0
0

Hi All,

 

Is it possible to consume the ABAP CDS view to other reporting tool i.e. analysis for office, lumira, Dashboard etc.

If yes, Can you please guide how to achieve it.

 

Many thanks in advance.

 

Gaurav

Filtered association in ABAP CDS

$
0
0

Hi colleagues,

 

is it possible to access attributes of the projection list in an association, so that the hard coded value is replaced by the value in "WorkflowPhase"?

pic1.png

The syntax check allows that, but the filtering does not work:

pic2.png

 

 

accessing the field by $projection or via the table directly (ROOT.workflow_phase) does not work either.

 

Any ideas?

 

Thanks & regards,

Ilijana

Other then ABAP, can CDS consumed by others reporting tools? e.g Bobj, Lumira

$
0
0

Dear Expert,

 

Other then ABAP, can CDS (core data services) consumed by other reporting tools? e.g Bobj, Lumira or HANA modeling join with other hana view. I googled but can't find any.

 

Thank you.

Cannot access nested CDS view using path expressions

$
0
0

Hi,

I'm trying to leverage the functionality of path expressions in a following scenario:

 

We have a simple [0..*] association of an entity business transaction header with another entity business partner. The ABAP CDS View for a business transaction could look something like this:

 

@AbapCatalog.sqlViewName: 'BTRAN'
define view btran_ddl as     select from crmd_orderadm_h as btrn_header     association [1..*] to bt_bp as partners on $projection.guid = partners.header_guid
{     key btrn_header.guid as guid,     btrn_header.object_id as h_object_id,     ... // further fields from crmd_orderadm_h     partners // publishing association for use in other CDS views
}

The target data source BT_BP is another CDS view containing data on business partner. In the last line of SELECT list, the association PARTNERS is stated to be accessible by other CDS views which build on top of BTRAN.

 

Now let's say I want to create another view CONTRACT. A contract is a special case of a business transaction with a specific transaction type. In this view I'd like to access the association PARTNERS to display information on different business partners:

 

@AbapCatalog.sqlViewName: 'CONTRACT'
define view contract_ddl as     select from btran
{     key btran.guid as guid,     ... // further fields     partners.name as partner_name,               // accessing PARTNERS     partners.function as partner_function        // accessing PARTNERS
}
where btran.object_type = 'BUS2000113'

The syntax check on this view returns the error message: Component PARTNERS does not exist or is not active

 

Am I missing something?

 

Thanks,

Marek

Dynamic insert statement to update cross schema tables

$
0
0

Can any one help me to write a dynamic  INSERT statement in AMDP  method.

Requirement is ,  I have to update the cross schema table  from another  system.

 

I have to Update Z-Table in BW system  .

I created a method in CAR system and  run the program to update a table in BW  system.

 

INSERT INTO SAPSD1.ZTABLE    select * from :ITAB;

 

This is updating  in BW related Ztable  from  CAR system .  SAPSD1  is  BW  dev  schema.  To work  this  same  statement in BW  qa and PRD I have written like below.

 

LV_SQL  := 'INSERT INTO'  ||:IV_TABLE||    ' select * from :ITAB';

EXEC LV_SQL;

 

There is no syntactical error  in method , but  when I execute the program from CAR system I am getting  error  :  SQL Code 257.

 

NOTE   :     IV_TABLE.        will  have the  value  :  SAPSC1.ZTABLE ( when the program execute  from  CAR DEV)

                                                                                 SAPSQ1.ZTABLE  ( When the program execute from CAR QA )

                                                                                 SAPSP1.ZTABLE ( When the program execute from CAR Prod).

Can anyone help me to solve this ?


Doubt regarding SAP HANA-ABAP

$
0
0

Hi Experts,

Can anybody guide what will happen to skills like BDCs, BAPIs, workflows, Smartforms,screen exits,user exits,customer exits,BADIs etc on migration to S4-HANA.

Will these skills be obsolete?Kindly guide.

 

 

Thanks,

SD

hi

ABAP Correction for HANA compliance

$
0
0

Hello,

I have to manually correct ABAP code for HANA compliance for 'Analysis of WHERE condition for SELECT'.

Here in the below code I have to add WHERE clause, please suggest how to find out that what can be added with the Where clause.

Actually the code is a part of a program, and I don't know how that program is working.

CODE:

SELECT * INTO TABLE lt_hfm FROM Ztf_hfm.

 

Plz ask if any clarification is needed.

 

Regards,

AMAN

HANA Development: Asterisk (*) vs. detailed field specification in select statements

$
0
0

Dear all,

 

I have learned that using the asterisk / star * select Statements is a Performance Problem when using a HANA database.

 

 

For example,

------------------------------------------------------

data lt_t100 type table of t100.

select * from t100 into lt_t100 where sprsl = 'EN'.

------------------------------------------------------

 

is a critical coding.

 

 

What I am asking myself is whether the following construction is an improvement:

------------------------------------------------------

data lt_t100 type table of t100.

select SPRSL ARGBG MSGNR TEXT from t100 into lt_t100 where sprsl = 'EN'.

------------------------------------------------------

Actually, this does select the same fiields, but not using the * Syntax.

 

 

My question is:

 

Will that improve selection performance ?

 

 

 

Or will it only prevent the code inspector from grouching ?

 

Any help or comment is welcome !

 

 

 

 

 

 

Regards,

Martin

How to start working on Eclipse using ABAP?

$
0
0

Hi,

 

I need some reference or basic fundamental to start working on Eclipse using ABAP.

Please let me know if anybody can help in this.

HANA secondary database connections are exhausted.

$
0
0

Hi All,

 

 

 

We are running BW application on HANA 85.02.

 

 

 

Some background job failed with  DBIF_RSQL_INVALID_RSQL dump. It showing The rescources for further secondary database connections are exhausted.

 

 

 

Please help us where to check secondary database connections details.

 

 

 

 

 

Regards,

MK

Should an ABAP CDS be 1:1 to a business req?

$
0
0

As a beginner using CDS I have one basic question.

While creating CDS should we treat it like a report that satisfies one business requirement or should it be open to enhancements?

For eg. Can I use an existing view defn and extend it to hold more fields instead of creating a brand new CDS if the selection criteria is more or less the same. 

 

What are the consequences?

 

Thanks.

Meera


Not able to open any ABAP programs in SAP Hana Studio

$
0
0

Hi,

 

An error has occurred. See error log for more details.

Method getSourceFile, argument project: the argument has an illegal value: null

 

Not able to open any programs - Updated all in Juno /Luno please help me out.

 

Capture.PNG

What does "Currently you can only define one CDS entity per DDL source." really mean?

$
0
0

Hello HANA gurus

 

What does Currently you can only define one CDS entity per DDL source. really mean?

Can we not create more than one CDS view for a corresponding DDIC table?


Please explain. Thanks.

Meera

Complete End-To-End ABAP For HANA 7.4 SP 09 Development

$
0
0

Hi All,

 

Simply this blog contains complete end to end development of Fiori-Like Application......and I hope, it will be helpful for beginners

 

Steps Involved For Displaying Flight Details:

 

  1. Creation of ABAP CDS view.
  2. Creation of Gateway O Data service.
  3. Testing of GW service in Gateway client.
  4. Creation of FIORI-Like App.
  5. Deployment of SAP UI5 Application to ABAP Back-End.

 

 

Lets start......

 

1. Creation of ABAP CDS view.


          -  Go to HANA studio ABAP perspective and Choose the package in which you want to create CDS view. Right click on package - New - Other ABAP                Repository object - DDL source - Next

          -  Provide Name and Description

          -  It seems like below

 

 

     cds.JPG

  • Check & Activate.
  • Right click on new created DDL source i.e. ZCDS_FL and click on open data preview.

 

cds.JPG

  • Same CDS view physically available/accessible in SE11

  cds.JPG

 

2.  Creation of Gateway O Data services


  • Now let's create O Data service which will fetch data (i.e. Query) from ZCDS_FL_SQL.
  • In terms of O Data, HTTP and ABAP we need apply operation QUERY, GET and Select * from <Table> into @data(ITAB) respectively.
  • Go to SEGW t-code and create new project ZFlight_Detail
    O data.JPG
  • Now right on Data Model and Import - DDIC structure option - Provide ABAP DDIC structure name i.e.ZCDS_FL_SQL as well as Entity Name.

O data.JPG

 

  • Click Next and select required fields.

O data.JPG

 

  • In next step mark check as key for FLIGHT_ID and CONNID and click Finish.
  • At a same time Entity Set has been created because earlier we have marked check box for create default entity set(it's SP 09 ).
  • Now let's play with runtime artifacts - Click on generate runtime objects(red and white circle) and it will pop up below screen - click enter button.

O data.JPG

  • On successful creation we will see the below screen(plenty of green symbols )

O data.JPG

  • Now register you service under service maintenance folder.

     O data.JPG

  • Click ok will get message service created....Yah we have maintained service...
  • Now for fetching data from DDIC artifacts ZCDS_FL_SQL we need to implement Query operation i.e. code based implementation.......
  • Now Open runtime artifacts and right click on class ZCL_FLIGHT_DETAIL_DPC_EXT - click on Go To ABAP Workbench.
  • In Edit mode redefine ZFLIGHT_DETAILSE_GET_ENTITYSET i.e. nothing but a implementation Query operation that results multiple rows.

O data.JPG

 

  • We are fetching complete set of records. Below is the code.

O data.JPG

  • Yahhh... we have done with coding part. Lets move toward for testing GW service

 

3. Testing of gateway service in gateway client.


  • Now click on SAP Gateway Client under IFC Nodes box screen either you can use t-code /IWFND/GW_CLIENT

O data.JPG

  • Click on entity set name - select Zflight_DetailSet
  • It will generate automatic URI like below and hit execute button.

O data.JPG



4. Creation of FIORI-Like App.

 

  • Open ABAP Prespective - Right click in the project explorer - New - Others
  • Type SAPUI and select application project

Capture.JPG

 

  • Hit next and provide project name.

Capture.JPG

 

Capture.JPG

 

  • After creation of project it seems like below.

Capture.JPG

  • Double click on MAIN.view.xml and paste below code

 

<core:Viewxmlns:core="sap.ui.core"xmlns:mvc="sap.ui.core.mvc"xmlns="sap.m"

              controllerName="zcds_fiori.MAIN"xmlns:html="http://www.w3.org/1999/xhtml">

       <Pagetitle="Flight Details">

              <content>

       <Tableid="idProductsTable"

              inset="false"

              items="{path:/Zflight_DetailSet',

              sorter:{path:'FlightId',

              descending:false}

              }">

              <columns>

                     <Column><Texttext="Flight ID"/></Column>

                     <Column><Texttext="Flight Number"/></Column>

                     <Column><Texttext="Flight Date"/></Column>

                     <Column><Texttext="Plane Type"/></Column>

                     <Column><Texttext="Price"/></Column>

                     <Column><Texttext="Currency"/></Column>

                     <Column><Texttext="Flight Name"/></Column>

              </columns>

              <items>

                     <ColumnListItem>

                           <cells>

                                  <Texttext="{FlightId}"/>

                                  <Texttext="{Connid}"/>

                                  <Texttext="{Fldate}"/>

                                  <Texttext="{Planetype}"/>

                                  <Texttext="{Price}"/>

                                  <Texttext="{Currency}"/>

                                  <Texttext="{RhFligntName}"/>

                           </cells>

                     </ColumnListItem>

              </items>

       </Table></content>

       </Page>

</core:View>



  • Now go to MAIN.controller.js and paste below code.

 

 

 

onInit: function() {

   

       var oModel = new sap.ui.model.odata.ODataModel("http://XXXXXXXX/sap/opu/odata/sap/ZFLIGHT_DETAIL_SRV/",false);

       sap.ui.getCore().setModel(oModel);

       this.getView().setModel(oModel);


       },

 

Note : 'XXXXXXXXX' would be your server path.




  • Save and right click on ZCDS_FIORI -  Run As - Web App Preview and result is below

Capture.JPG

 



  • Now go to browser and paste URL which is generated in index.html
  • If everything went right then its time to celebrate.....


Result :

Capture.JPG

 

 

5.Deployment of SAP UI5 Application to ABAP Back-End

 

  • Well for deployment option you can refer below document.

 

          http://scn.sap.com/docs/DOC-42820

 

 

Most welcome for expert suggestions......

 

 

- Cheers

   Amol

ABAP on HANA Optimization - Step by Step Remediation

$
0
0

  TUNE YOUR CUSTOM ABAP CODE – HANAFIED

 

SAP ABAP on HANA

 

Prasana Ravichandran

prasana101990@gmail.com

 

 

                                                                       Table of Content

 

1.  STEP BY STEP TUNE YOUR CUSTOM ABAP CODE – HANAFIED

 

1.1 Introduction

 

1.2 Requirements

 

1.3    Step by Step Process

 

2. Steps  Involved


3. Conclusion

 

1. STEP BY STEP TUNE YOUR CUSTOM ABAP CODE – HANAFIED

 

 

1.1 Introduction

 

Before Migrating to Suite on HANA or ABAP on HANA environment we need to analyse which of my ABAP code must be changed to avoid potential functional issues. In general existing ABAP code runs on SAP HANA as before

Only if ABAP code relies on technical specifics of the old database, ABAP code changes might be necessary.

 

Technical changes with SAP HANA that may affect existing DB specific ABAP code.

 

 

paste.jpg

 

To avoid such confusions and technical redundancies follow the below mentioned step by step analysis to make custom development of ABAP code more optimized in HANA environment.

 

1.2 Requirements

 

To start with the optimization process the basic requirements are as follows

 

               1. ABAP Programming Knowledge

 

               2. SAP Development System with SCI/ATC checklist and SQLM transaction access

 

               3. Basics of SQLM and SWLT transaction processing.

 

               4. ABAP on HANA environment.

 

1.3 Step By Step Process

 

STEP BY STEP - TUNE YOUR CUSTOM ABAP CODE – HANAFIED.

 

We will see step by step how you get your custom code ready for SAP HANA and in parallel how this brings the performance and quality of your custom code on a new level right now. Also how this is facilitated through SCI results imposed on SQLM along with SWLT (SQL Performance Tuning Worklist).

 

 

 

Approach on Tuning ABAP code for optimization (HANAfication).

 

                               paste.jpg 

 

2.  STEPS:

 

Step 1: Go to Transaction SCI and perform an SCI inspection for the object list for which you want to perform analysison optimization using a custom variant or PERFORMANCE_DB.

 

                          paste.jpg

Step2: Go to SQLM (SQL Monitor)Manage/Create Snapshots (Make sure Server is Active. Else select and activate allservers)

 

                             paste.jpg

Step3: Give some Description. Select Local System from data source tab and give the Package detailsPress F8/

Create Snapshot. You will get the success message as “Snapshot successfully created”.

                           paste.jpg

Step4: Go to SE38 .Execute the report program that you want to analyse with the required test data.

 

                            paste.jpg                           

The SQLM monitor will record and analyse the SQL profile of the executed program. (Time delay happens).

 

  Step5: Goto SE38 - executethe program ‘RSQLM_UPDATE_DATAand check all the options while executing to finish SQLM update manually.

 

                                 paste.jpg      

  Step6: We need to feed the SQLM snapshot to SWLT configuration (SQL Monitor tab). Goto SQLM Export thesnapshot data from SQLM as zip file.

 

                                    paste.jpg

Step7: Now Goto SWLT transactionOn General TabGive package/Object details and select ‘Show all details’.

             

                                paste.jpg

On Static checks tab - Give the SCI or ATC (ABAP Test Cockpit) inspection name (results obtained on Step1).

                                 paste.jpg

  On SQL Monitor tab - Select the snapshot directly or Import the SQLM Snapshot file that we have exported in Step6.

                                   paste.jpg

Step 8: Now you are set to run/execute the SWLTPress F8 or Execute.

You will see a detailed report of SQL performance tuning work list highlighting the Total DB and DB mean time for all the tables hit in the descending order (most time consuming at the top) along with Error/warning messages and suggestions/ code remediation check messages.

 

                                       paste.jpg

3. Conclusion.

 

 

The below mentioned jargon  are some of the key takeaways for ABAP optimization on HANA.

           

                  paste.jpg

           As discussed above In general existing ABAP code will run on SAP HANA as ever before. There are certain DB specific ABAP code that must be analysed and modified accordingly. ATC (ABAP Test Cockpit) can be used to find and adapt those mentioned DB specific ABAP custom code easily. Those well-known golden Open SQL rules are still valid on SAP HANA, only some priorities have been shifted.

 

For effective SQL tuning and to find HANA potential in existing ABAP code new monitoring tools like the SQL

 

Monitor (SQLM) are available. With the above mentioned steps and approach, the preparation of your custom code can start before the migration to SAP HANA.

Create CDS view using HANA live

$
0
0

I was working on couple of LIVE views (ex."_SYS_BIC"."sap.hba.ecc/WorkCenterCapacity"). I converted this into external view and while trying to consume it in CDS view it's showing an generic error ( ‘An error occurred while creating view <ZXXXX> in the database.’).

 

Few more scenarios I tried:

1. While using DDIC view in CDS, it's working.

2. While converting customized HANA view to external view, I can consume the same external view to CDS without any error.

3. Even encapsulating Live view into HANA view and using that converted ext view to CDS- throwing same generic error.

 

Not sure what is the special about those external view converted from LIVE view directly or indirectly.

 

Any suggestion/comment will be really appropriated.

Viewing all 831 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>