Skip to Content
0

How SAP is handling Customer specific enhancements in HANA XSJS based development?

Oct 30, 2017 at 12:56 PM

74

avatar image
Former Member

We are new to XSJS based developments and we came across a situation to handle customer specific enhancements in this topic. Usually in ABAP we have different kinds of enhancements like BADIs, Enahcement Framework and Etc. So We would like to know the feasibility of handling these kinds of enhancements in XSJS based developments as well.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Thomas Jung
Oct 30, 2017 at 01:53 PM
1

There are no technology solutions such as BADIs in the XSJS environment. If you alter an SAP delivered XSJS or XSJSLIB file, the alteration will have to be repeated after each update of the source content from SAP. An application might be designed to use a call to an empty JavaScript function would you could more safely implement (kind of like the old User Exit functionality in ABAP). However this isn't a technology solution, but just a design approach that each application would have to take.

Show 7 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Thomas,

Thanks for the reply.

As you said i am implementing oDATA Exit for the same but i am facing few issues with it.

I am using HANA trail account to do POC on HANA in SAP HANA Web development workbench. Let me explain my scenario with small example.

I had 2 dependent tables

Table #1:

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

OrderHeader {

OrderId Integer , // This key is generated using sequence

Description varchar(100)

}

Table #2

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

OrderItem{

OrderId INTEGER, // This key is associated with OrderHeader~OrderId

OrderItem NVARCHAR(10),

Description varchar(100)

}

And my ODATA service file is

orders.xsodata

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

service{

"<SCHEMA>"."OrderHeader" as "OrdHdr"

create using "xsjsDemo::createHdrData" // ODATA EXIT - Procedure Implementation

update using "xsjsDemo::updateHdrData" // ODATA EXIT - Procedure Implementation

delete using "xsjsDemo::deleteHdrData"; // ODATA EXIT - Procedure Implementation

"<SCHEMA>"."OrderItem" as "OrdItm"

create using "xsjsDemo::createItmData" // ODATA EXIT - Procedure Implementation

update using "xsjsDemo::updateItmData" // ODATA EXIT - Procedure Implementaion

delete using "xsjsDemo::deleteItmData"; // ODATA EXIT - Procedure Implementation

}

I am using SAPUI5 ODATA Batch service call to do this. But i am facing a problem here the generated sequence number (which is in createHdrData Procedure) of OrderHeader is not able to send to OrderItem(Which is in createItmData Procedure). How can i pass this generated number ?

and i found that there are 3 types of implementations for ODATA Exits

1. XS Javascript using .xsjslib

2. Node.js function

3. HANA Procedure

So I was bit confusing when to choose which implementation among XSJS/XSODATA/NodeJs?

Am i able to save whole object(OrderHeader & OrdrerItem) as a transaction using XSODATA service?

Am i able to save whole object(OrderHeader & OrdrerItem) with dependencies using XSJS service?

Am i able to save whole object(OrderHeader & OrdrerItem) with dependencies using Node.js?

In any implementation i need to follow the transaction principle(Save All or None).

Please correct me if something is wrong in my requirement

Thanks & Regards,

Phani

0

>But i am facing a problem here the generated sequence number (which is in createHdrData Procedure) of OrderHeader is not able to send to OrderItem

There is an example of this in SHINE. You have to use dependent associations and put an update exit on the association.

https://github.com/SAP/com.sap.openSAP.hana5.example/blob/hana2_sps02/core_js/lib/sap/hana/democontent/epm/services/businessPartnersAddresses.xsodata

But this probably also requires changing your keys so you can insert the item with an independent unique key and then insert the relationship in a separate many:many table.

Another option would be to flatten your structure and duplicate the header info into each item but only insert it once.

>and i found that there are 3 types of implementations for ODATA Exits

For XSODATA there are only two. Node.js exits were never officially shipped.

Really the two exits types have the same general capabilities. It mostly comes down to choice of programming model.

0
Former Member

Hi Thomas,

Thanks for the reply.

I am using .xsjslib functions as ODATA Exits as mentioned in the github.But i am unable to debug these Exits.

Can you please help me to debug a javascript function in SAP Web development workbench editor?

Thanks for your guidance and support.

Regards,

Phani

0
0
Former Member

Hi Thomas,

I already went through it.. I am able to debug the javascript functions which are defined in <myXSJSService>.xsjs file.

But the breakpoint was not getting triggered if the javascript function is defined in <myXSJSLIBService>.xsjslib.

Can you suggest me how to make this breakpoint getting trigger?

Thanks and Regards,

Phani

0

The process is no different. Are you sure your exit is even being triggered?

0
Former Member

Hi Thomas,

Here is my example and i am using HANA trail account SAP web based Workbench development editor:

service{

"<mySchema>"."EMPLOYEE" as "Employees"

create using "xsjsLibDemo::testProc"

events ( before "xsjsLibDemo:dbUpdate.xsjslib::insert_data" );

}


This service is being called by SAP UI5 ODATA model. I am pretty sure that this javascript method(insert_data) is getting triggered. But i am not able to debug during this call.

If i import this xsjslib into another xsjs file then i am able to debug the function.

Am i need any additional things to activate breakpoint in my SAPUI5 ODATA call?

Thanks & Kind Regards,

Phani

0