Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all 2823 articles
Browse latest View live

IW_BEP missing in Netweaver 7.4

$
0
0

Dear Experts ,

 

We are setting up Netweaver Gateway on Netweaver 7.4 for Central Hub Deployment . As per the documentation here Gateway component SAP_GWFND comprises the functional scope of IW_FND 250, GW_CORE 200, IW_BEP 200, and IW_HDB 100. But when installing IW_PGW which

is a mandatory component for work flow applications, we facing an error to install IW_BEP 200 again as in the screenshot.

 

IW_BEP Error.png

 

Current System status:

SAP_Basis.png

Does upgrading the system (or) applying any s-note resolve this issue ?

Can someone share their experience ?


How to use Soft-State support for OData services

$
0
0

Introduction

 

The so-called “soft state” mode enables the SAP NetWeaver Gateway runtime to process several requests in one ABAP application server session, similar to stateful behavior. The only difference is the behavior of the application server after the session times out: Instead of breaking the request processing with a time-out exception the server creates a new session and processes the request as usual. For the consumer the change of the application server sessions is transparent and no data is lost on the client session.

 

The soft state mode should be used for applications built on legacy functionality in the backend, especially when the functionality includes initial loading/caching of big amounts of data for a single request. By using soft state, the resources/functionality which has been loaded during the initial load can be reused for the subsequent requests of the service.

 

Thus, the main benefit of soft state is a considerable performance optimization of an OData service.

 

Activate Softstate for your service
- Create an instance attribute MV_IS_SOFTSTATE for the DPC_EXT class that stores  the status whether soft state is activated
- Redefine the method /IWBEP/IF_MGW_SOST_SRV_RUNTIME~OPERATION_START to set this variable

 

Prerequisites

 

You have created a sample OData service using the Service Builder as described in my SCN document How to Develop a Gateway Service using Code based Implementation .

 

 

Implementation

 

 

Implementation steps in the model provider class

 

 

 

StepsResult

1. Start maintaining the model provider extension class ZCL_ZGW_PRODUCT_MPC_EXT

2. Redefine the DEFINE method of the MPC_EXT class

method DEFINE.
  super->define( ).
  model->set_soft_state_enabled( abap_true ).
endmethod.

 

Implementation steps in the data provider class

 

StepsResult
Start maintaining the data provider class ZCL_ZGW_PRODUCT_DPC_EXT
Click on the Attributes tab and insert a new attribute with the following settings

 

Attribute
MV_IS_SOFTSTATE

Level
Instance Attribute

Visibility
Private

Typing
Type

Associated Type
ABAP_BOOL

Description
TRUE if we are running in softstate mode

DPC Maint.JPG

Click on the Methods tab and redefine the method /IWBEP/IF_MGW_SOST_SRV_RUNTIME~OPERATION_START

and enter the following line of code

 

mv_is_softstate = abap_true.

 

 

  method /IWBEP/IF_MGW_SOST_SRV_RUNTIME~OPERATION_START.

  mv_is_softstate = abap_true.

  endmethod.

Now click on the Methods tab and redefine the method /IWBEP/IF_MGW_SOST_SRV_RUNTIME~OPERATION_END

without entering any code.

 

Please note:
Without activating both methods you would get an exception

Now define a second (static) attribute GV_COUNT of type I to demo the use of soft state

 

Click on the Attributes tab and insert a new attribute with the following settings:

 

Attribute
GV_COUNT

 

Level
Static Attribute

 

Visibility
Protected

 

Typing
Type

 

Associated Type
I

 

Description
Store counter

GV_COUNT.JPG
Activate your changes

Navigate back to the Service Builder and expand the folder Service Maintenance.

Expand the folder Maintain.

Right click on the entry of your Gateway Hub system  to start the transaction /IWFND/MAINT_SERVICE with filtered for your service name

Confirm the warning of being redirected to the Hub system

You will notice that the service ZGW_PRODUCT_SRV is shown as not supporting Soft-State.

If you click on the Soft-State button (1) you will get an error message

2_not_supported.png
Confirm the error message.3_Error_soft_state.png

Click on Load Metadata and confirm the sucess message

4_load_metadata.png

The service is now shown such  that it supports soft state but soft state is not yet activated.

 

Hint:

If the service is not shown as inactive try to clear the metadata cache in the Gateway Hub as well as in the Gatebay backend system. To do so:

  1. Start transaction /IWBEP/CACHE_CLEANUP in the backend and activate the check box Cleanup Cache for all Models.
  2. Start transcation /iwfnd/cache_cleanup on the hub and run it with the check box Cleanup Cache for all Models.
6_inactive.png
Change the session time out
On the lower left part on the screen click on ICF Node --> Configure (SICF)7_icf_node_1.png
Double Click on the entry of your service in the SICF tree8_icf_node_1.png
From the menu choose Service --> Change (1) and enter a Session Timeout greater than zero, for example 10 seconds.

Save your changes (2) and navigate back to the Service
Maintenance
Screen
9_icf_node_2.png
Since the service should now shows up with the Softstate-Status Inactive you can now activate the softstate status by pressing the softstate button.
Confirm the warning before activating soft state for your service and confirm the information that softstate has now been activated.warning softstate activation.png
Use of softstate in the data provider extension class
Open ZCL_ZGW_PRODUCT_DPC_EXT in SE24

Change the implementation of the method  PRODUCTSET_GET_ENTITYSET to enable a custom counter when $count is called for the entity set ProductSet with the coding shown on the right.

 

The coding first checks whether /$count is requested and has implemented a custom implementation to retrieve $count.

 

If soft state is not enabled the number of products will be retrieved by counting the table entries in SNWD_PD.

 

If soft state is enabled the code checks whether the member variable GV_COUNT is inital.

 

If it is initial that means if the /$count is called for the first time in this session we have to retrieve the number of entries from the database.

 

Only if /$count is called a second time when soft state is enabled no data will be read from the database and /$count will rather be filled with the value stored in the variable GV_COUNT which is then incremented by 1 to show you that soft state is actually working.

 

If the time configured as a session timeout is exceeded counting starts again from the number of products which is equal to the number of table entries in table SNWD_PD.

 

method PRODUCTSET_GET_ENTITYSET.

DATA lv_count_requested TYPE abap_bool.

lv_count_requested = io_tech_request_context->has_count( ).

IF lv_count_requested EQ abap_true.

  IF  mv_is_softstate = abap_false.

    SELECT COUNT( * ) INTO gv_count FROM SNWD_PD.

  ELSE.

    if gv_count is INITIAL.

      SELECT COUNT( * ) INTO gv_count FROM SNWD_PD.

    ELSE.

      gv_count = gv_count + 1.

    ENDIF.

  ENDIF.

  es_response_context-count = gv_count.

ELSE.

 

  CALL FUNCTION 'BAPI_EPM_PRODUCT_GET_LIST'

* EXPORTING

*  MAX_ROWS                    =

  TABLES

      HEADERDATA                  = et_entityset
*  SELPARAMPRODUCTID          =
*  SELPARAMSUPPLIERNAMES      =
*  SELPARAMCATEGORIES          =
*  RETURN                      =
          .

 

 

ENDIF.

 

ENDMETHOD.

Activate your changes.

 

 

Test the service in the browser

 

 

StepsResult

Call your service via the browser.

http://<server>:<port>/sap/opu/odata/sap/ZGW_PRODUCT_SRV/ProductSet/$count
When refreshing the URL you will notice that the counter will start to count the number of calls. count_4.JPG
Wait for 20 seconds …
When you wait for a period longer than the one configured as a session timeout in SICF the counter starts with 1 again.

Please note:
If you have configured a small time window (for example 10 seconds) you will probably have to wait longer since there is an additional latency.
If you are too impatient and click on refresh to fast the wait time starts again from zero.
count_1.JPG

 

 

Comparison of response times

 

The behaviour when using soft state or not can nicely be checked using the performance trace. This can be started using transaction /IWFND/TRACES.

 

StepsResult

 

Start a performance trace using /IWFND/TRACES.

 

Perform several requests with $count having soft state enabled

 

We can see that the initial request takes 16 milliseconds in the backend (GW framework overhead + Application Data Provider response time).

 

For every subsequent request  the Application Data Provider Response time is zero and the GW framework overhead is reduced to 5 mill seconds.

Count with softstate.JPG
Deactivate soft state and perform again several requests with $count

The result now is that subsequent requests have the same response time.

 

The response time is the same that we got for the first initial request when soft state was enabled.

Count without softstate.JPG

Constraints for SAP Mobile Platform Tools 1.0 Release

$
0
0

Symptom

This note contains known issues and constraints for SAP Mobile Platform Tools 1.0 release

 

Other Terms

Constraints, Notes, Known Issues,SMP, SAP Release Train for Eclipse,Release notes, release information, OData Modeler, SAP Mobile Platform Tools

 

Reason and Prerequisites

Constraints note for SAP Mobile Platform Tools 1.0 release

 

Solution

Constraints

OData Modeler
• Even if the OData file is read-only, the OData Model Editor does not stop the user from making changes to it. Only while attempting to save the file it shows the error in logs and the updates are not saved


API toolkit for SAP Mobile Platform
• Binding is currently not supported for “Function Imports”
• The mapping editor only loads the OData model structure when the mapping is initially created. If the model changes later it does not show the updates in mapping editor. To see the latest OData Model in mapping editor, user needs to explicitly invoke “Generate EDMX” using the context menu on the .odatasrv file
• The destination for SOAP services needs to be configured in the developer tool only. Unlike other data sources it is not currently supported in the Gateway Management cockpit
• In general, all the constraints of platform runtime are by default also inherited by developer tools

HANA Cloud Integration Mapping Editor constraints:

• If a proper element and schema definition is missing in the WSDL, Mapping editor will fail to parse such a WSDL. Currently the following restrictions exist.
• As the message mapping always expect an element definition as per the XML schema standard for display of the structure of source and target message, it is important that the WSDL Messages refer to a global element in the associated schema definition in the WSDL file.
• So a Document/literal-style message that formats its body according to a schema, that is included in the WSDL is preferred.
• WSDL with RPC style Messages, without the associated schema is not be supported.
• Multi-part WSDLs:- When the message definition contains multiple parts, the WSDL may not have  a single global element representing the complete structure of the input/output message expected by the operation. So the Mapping editor will not be able to display a single message structure with a single root element. Only individual elements referred by each part will be available for mapping.


<wsdl:message name="POMessage">
  <wsdl:part name="po" element="tns:PO" />
  <wsdl:part name="invoice" element="tns:Invoice" />
</wsdl:message>


• Message Parts with reference to type rather than element:- Mapping expects a global element to be present in the WSDL, when such an element is missing and the message directly refers to the type, mapping will not be possibe

<wsdl:message name="POMessage">
  <wsdl:part name="po" type="tns:POType" />
</wsdl:message>

• A WSDL with its definition spread across multiple files:- It is possible to have the definition of a Web service spread across multiple files.
• Currently, the Mapping editor expects the completed definition of WSDL to be in a single file. If not, it will fail to resolve the types and will not detect the structures available in other files and included via the ‘import’ or 'include' construct.

SAP Mobile Platform Tools : RIN

$
0
0

Symptom

This SAP Note provides information about the features released for SAP Mobile Platform Tools 1.0

 

Other Terms

Notes, SAP Mobile Platform Tools, API toolkit for SAP Mobile Platform, SAP Release Train for Eclipse, OData Modeler, Release notes, release information

 

Reason and Prerequisites

Maintain information about the features and updates delivered with each SAP Mobile Platform Tools release as mentioned in the https://tools.hana.ondemand.com/#gateway page.

 

Solution

 

We provide information for the latest release for SAP Mobile Platform Tools 1.0

SAP Mobile Platform tools is a collection of Eclipse based tools to help designing and provisioning OData services for SAP Mobile Platform.The OData Modeler is used to design OData models.

Features available in SAP Mobile Platform Tools:


OData Modeler: The OData Modeler provides wizards and a graphical editor that receive user actions and data in order to create OData models. The OData Modeler provides the following features:

 

OData Model Editor for OData Model Creation: The OData Modeler comprises of the OData Model Editor in Eclipse that enables you to start the OData service development phase by creating an OData model using the OData Model Elements available in the palette.

  •       Creating an OData Model: OData Models can be created using the following options:
    • Blank OData Model
    • From an OData service metadata url
    • From an OData service metadata file
    • From an existing OData service using the Service Catalog
    • From an Existing OData Model
  •       Working in the OData Model Editor: OData Model Editor offers the following options:
    • Add a OData model element by dragging and dropping the elements onto the editor
    • Copy and Paste the Elements
    • Use the Show/Hide All Usage option to show and hide the relationship between the elements in the OData Model Editor
    • Layouting option to select and create your own layouts to view the OData model
  • Exporting an OData Model from the OData Model Editor: Use the Export OData Model wizard to export an OData model file, *.odata, from a project in the OData Model Editor, to an XML file. Later, you can use the exported file in another tool, such as, the SAP NetWeaver Gateway Service Builder to quickly implement an OData service from the model.
  • Service Catalog: The Service Catalog feature allows you to view the metadata of an OData service in the SAP NetWeaver Gateway landscape, inside the OData Model Editor. You can browse and discover the OData services that are available in the SAP NetWeaver Gateway system.

More Informationhttps://help.hana.ondemand.com/odata_modeler_documentation/frameset.htm?5ad0d36c78ae4d49b7f7e8d72dbfa046.html

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


API toolkit for SAP Mobile Platform: The API toolkit for SAP Mobile Platform enables application developers to create OData services from one or more data sources (both SAP and non-SAP). This includes SOAP, JDBC, JPA and SAP NetWeaver based data sources. The resulting OData service runs on an SAP Mobile Platform 3.0 server. The API toolkit for SAP Mobile Platform provides the following features:

Binding Data Sources: The SAP Mobile Platform allows our users to build and deploy applications on all the major mobile device operating systems. To do this, the users need an OData service to build their own applications. The API Toolkit for SAP Mobile Platform provides functions for OData service provisioning. The toolkit provides an environment to connect to different data sources and to create artifacts. Using the API Toolkit for SAP Mobile Platform developers can bind OData models, which were defined with SAP Mobile Platform Tools to additional datasources like SOAP, JPA, JDBC or ODC (from SAP NetWeaver Gateway).

Defining Custom Code: This feature allows you to define custom code for projets created in version SAP Mobile Platform 3.0 SP04 and above. Custom code is defined to support system query options for SOAP Query mapping.

Generating and Deploying Service Implementation Project allows you to generate and deploy the created service implementation project.

Support for SP03 and Lower Projects: Here are the features that support the projects created using the SAP Mobile Platform 3.0 SP03 and lower runtime versions:

  • Defining Custom Logic for SOAP Query Request: You can implement custom logic for projects created in SAP Mobile Platform 3.0 SP03 and lower runtime only. Custom logic is implemented to support system query options for SOAP Query mapping.
  • Changing Target Runtime: If you have created an OData Implementation Project in target runtime SAP Mobile Platform 3.0 SP3 and below, you can migrate your project to SAP Mobile Platform 3.0 SP4.

More Information

https://help.hana.ondemand.com/api_toolkit_for_sap_mobile_platform_documentation/frameset.htm?39b04f061083404b8f8795c4ed930f35.html


 

How can I create SEGW service for Clock-in/out

$
0
0

Hello,

 

I am a bit new to Service Builder. Have not so much experience. I took a look at HRESS_C_CORRECTIONS WD Component and figured out in general how the Clock in/out works.

 

Can you please guide me through how can I create a SEGW service for Clock in/out, just in general?

FM to Validate Java script in ABAP

$
0
0

Hi All,

 

We are working on application which have few free text fields on UI. Data entered on text fields is save in SAP... Now issue is if they write any script in text field it will be saved  in database. And when they retrieve this text - script will run..

 

Please advice if we have any function in SAP which check text include script code. So we can check it before saving to database.

 

 

 

Thanks

Rajesh Dadwal

$batch : Multiple Line Items

$
0
0

Dear Friends,

 

I am sure there are loads of materials / discussions on the $batch topic.

 

I shall try and keep it simple as I am unable to find my example.

 

My requirement is to Create Multiple LineItems for an existing OrderHeader in a single session.  ( $batch does this well )

 

Is there a sample piece of code i can use for collecting all the LineItems fired as part of the ChangeSet($batch) and pass the Internal Table of LineItems to the Create LineItems?

 

-- This is because i understand ...internally, the ChangeSet Begin and ...End would be invoked for each POST LineItems under one ChangeSet?

 

..Apologies, if i am talking no sense!!

 

Suresh BJ

 

Tags edited by: jitendra kansal

Recently featured content for SAP Gateway

$
0
0
What's New in Integration Gateway in SAP Mobile Platform 3.0 SP04
Mustafa Saglam

Posted by Mustafa Saglamon September 27, 2014

A brief but conceptual blog about new features in SAP Mobile Platform 3.0 Integration Gateway

Let's code association/navigation and data provider expand in OData service!
Chandrashekhar Mahajan

Posted by Chandrashekhar Mahajanon September 24, 2014

A do not miss blog for developers on creation of simple SAP Gateway OData service

{API: World} An Unforgettable Experience
Ning-Jing Gao

Posted by Ning-Jing Gao on September 19, 2014

SAP became a popular demo area at "API World" show floor. Check out the details in the blog

SAP Gateway 2.0 SP09 features now available with SAP NetWeaver 7.40 SP08
Andre Fischer

Posted by Andre Fischer on September 17, 2014

NetWeaver 7.4 SP08 was released on September 15th. Read the blog for more details

A look back at the APIWorldDataweek Hackathon
Elijah Martinez

Posted by Elijah Martinez on September 15, 2014

SAP brought their Smart Vending Machine out to the APIWorld + Dataweek Hackathon 2014. Read the blog for more details

SAP Certified - Google Sheets with SAP - CloudShuttle
Gavin Quinn

Posted by Gavin Quinn  on September 15, 2014

The product is now officially out on the SAP Store, and Google Marketplace. You can find the details here

I Love APIs 2014 Conference welcome reception and Day 1 highlights
Elijah Martinez

Posted by Elijah Martinez on September 10, 2014

Read this blog to get details on the sessions, demos and more at "I Love APIs" Conference 2014

Gateway protection against Cross-Site Request Forgery attacks
William van Strien

Posted by William van Strienon August 26, 2014

Do not miss blog on how SAP Gateway protects against CSRF attacks

Meet SAP at “I love API 2014” Conference Sep 8 – 10 in San Francisco
Ning-Jing Gao

Posted by Ning-Jing Gao on August 25, 2014

Check out the exciting activities SAP team has planned for "I love API" event

What to Expect from SAP Team at {API: World} 2014 in San Francisco
Ning-Jing Gao

Posted by Ning-Jing Gao on August 22, 2014

Check out the exciting activities SAP team has planned for "API World" event

Unified Inbox in Gateway SP09
Shyam Sunder Suthar

Posted by Shyam Sunder Suthar on Aug 19, 2014

Check out the detailed list of features in Unified Inbox Gateway SP09

Tips for Creating a Google Apps Script/SAP Gateway Mashup
Paul J. Modderman

Posted byPaul J. Moddermanon July 28, 2014

Get tips on integrating Google docs with an SAP back-end through SAP Gateway

Uploading Files to SAP GW, Downloading Files from SAP GW - New Techniques
Peter Marcely

Posted byPeter Marcelyon July 25, 2014

Learn about new techniques to upload and download files to and from SAP Gateway

Implementing Expand Entity/Entity Set
Srikanth Gajula

Posted bySrikanth Gajulaon July 18, 2014

Learn more about implementing Expand Entity/Entity set in this blog.

What's new in SAP Gateway 2.0 SP9?

Andre Fischer

Posted byAndre Fischeron July 15, 2014

SAP Gateway 2.0 SP09 has been released! Read to know more about the features delivered with SP09

How to transport Fiori like applications using SAP Solution Managers Quality Gate Management
Andre Fischer

Posted byAndre Fischeron July 7, 2014

Learn how to transport Fiori like applications using SAP Solutions Manager based on SAP Gateway

SAP Gateway Developer Tools – Bridging the Past, Present and Future

Amit Nigam

Posted by Amit Nigamon July 4, 2014

Learn what has changed about SAP Gateway developer tools.

SAP Gateway deployment options in a nutshell
Andre Fischer

Posted by Andre Fischer with last update on July 2, 2014

Get a clear understanding of the different deployment options available for SAP Gateway, their advantages and disadvantages.

SAP CodeJam in Bielefeld about SAP Gateway and SAPUI5

Andre Fischer

Posted by Andre Fischer on June 30, 2014

Read the details of the SAP CodeJam event

Recorded Webinar Session: Integration Gateway in SAP Mobile Platform 3.0
Stephany Treadway

Posted byStephany Treadway on June 24, 2014

If you missed our webinar, get the details in this blog!

Upcoming SAP CodeJam events around SAP Gateway in June in Germany and Switzerland
Andre Fischer

Posted by Andre Fischer on May 28, 2014

Sign up for SAP CodeJam events around SAP Gateway! This event will take place in Switzerland on June 18th and Germany on June 25th 2014.

Day 3 Highlights for SAP Gateway at SAPPHIRENOW 2014

Peter Ng

Posted byPeter Ng on June 4, 2014

Get the highlights for SAP Gateway on the final day of SAPPHIRE!

Day 2 Highlights for SAP Gateway at SAPPHIRE 2014
Supriya Ananthakrishnan

Posted bySupriya Ananthakrishnan on June 3, 2014

Read the highlights of day 2 for SAP Gateway at SAPPHIRE

Day 1 highlights for SAP Gateway at SAPPHIRE 2014
Ningjing Gao

Posted byNingjing Gao on June 2, 2014

Get the highlights for SAP Gateway on Day 1 at SAPPHIRE

What is Exciting about SAP Gateway at SAPPHIRE
Ningjing Gao

Posted byNingjing Gao on May 15, 2014

SAPPHIRE NOW is around the corner, read to know more about the events, sessions and demos scheduled

Upcoming Webinar: Integration Gateway in SAP Mobile Platform 3.0
Stephany Treadway

Posted byStephany Treadway on May 28, 2014

Sign up for the upcoming webinar! This session will introduce you to Integration Gateway and the unique value it adds to SAP Mobile Platform 3.0

'Gateway as a Service' is now 'HCI OData Provisioning'

Posted by Martin Bachmann on Apr 10, 2014

Learn how 'SAP HANA Cloud Integration' and 'Gateway as a Service' offerings have been bought close together

There is a Gateway for that ...

Posted by Mustafa Saglam on March 20, 2014

SAP NetWeaver Gateway is a technology solution that provides design-time and runtime features to expose SAP Business Suite data as OData services

Some new features in SAP NW Gateway 2.0 SP08

Posted by Duong-Han Tran on Jan 30, 2014

Read about some new and helpful features in SAP NW Gateway 2.0 SP08


Hub installation on a PI double stack system?

$
0
0

Dear all,

 

is it possible or advisable to install the gateway components on the ABAP stack of a PI System for a hub deployment?

 

Best regards,

Daniel

Reading the attachments in Fiori

$
0
0

Hi All,

 

Need a help in reading the attachments . I am using the method /IWPGW/IF_TGW_TASK_FACADE~READ_TASK_ATTACHMNET_STREAM  method .

 

What data need to be populated in the filed ES_ATTACHMENT_STREAM-VALUE  filed.

 

I have the url document which having the document ..Please help.

 

 

Thank you

 

 

 

 

 

Custom Attributes In Task Gateway

$
0
0

Hi All,

 

I have implemented the methods /IWPGW/IF_TGW_TASK_FACADE_v2~QUERY_CUSTOM_ATTR_DEFINITIONS AND QUERY_CUSTOM_ ATTRIBUTES.

 

checked with break points ,it Is not coming at runtime,

 

Need to do any other settings for this version 2 ? . My system is gateway 2.0 SP 08 .

 

 

Thank You. 

OData Deployment

$
0
0

Hi,

 

am new to NetWaever Gateway,

In HUB Architecture(NWGW connected to ECC via RFC Connection),

1) am planning to create a project in NW Gateway, design the ODATA, create service and get the data from ECC using RFCs/BOR which are built in ECC. Is this the correct deployment method?

2) can we call a class methods of business system in runtime artifacts DPC_EXT methods? or only RFC/BOR objects can be called?

 

Thank you

 

Regards,

Prashanth

License costs for "Full SAP User"

$
0
0

Hi together,

 

I have a question concerning License costs for SAP Netweaver Gateway.

 

Aprx. 1 year ago we decided to realize a project with SAP Netweaver Gateway and volume based licenses (consumer access) in our SAP environment.

 

Some of the consumers already have a "full SAP user / professional user" and the other user do not have this kind of user.

Our external partner told us, that we do not have to pay for the volume/service calls we generate with the full SAP user - we only have to pay for the volume/service calls which will be generated by our customers who do not have an SAP user.

 

Today I found an information that sounds different:

 

Prerequisite: Developer and administrators require a Named User license.

External service calls are HTTP requests per calendar year which are processed by SAP NetWeaver Gateway Server. Metadata requests and requests from SAP Software that contains SAP NetWeaver Gateway runtime software are not counted.

 

 

Does that mean that we also do have to pay for the service calls which are generated by full professional user (where we already pay a lot of money)?

 

It would be great if you can share your information!

 

Thanks in advance & best regards

Torsten


Uploading Image through SAP Gateway Service

$
0
0

Hi Experts,

 

I am trying to upload image(media) file through SAP Gateway services.

 

In entity type i check media type.

I redefined CREATE_STREAM method of DPC_EXT

I am trying to upload image as shown in pic.

But i am getting 405 error.

 

Thanks in advance..

405problem.PNGStructureEntity.PNG

SAP Gateway certification

$
0
0

Hi Experts ,

Can anyone suggest if there are any certification program available to become a certified gateway developer (like ABAP :-))

 

After searching in SAP training shop I was able to find only one course GW100 Building Odata service which is only for training purposes.

 

Please share your thoughts.

 

Regards

Prabaharan


SAP Annotations for OData Version 2.0

$
0
0

Introduction

OData services provide a uniform interface for interacting with their resources, and in addition are self-describing:
  • The service document (located at the service root) lists the available top-level resources, and
  • The service metadata document (located at the address $metadata relative to the service root) describes the structure of all resources in the service.
This structural metadata makes it easy to understand a service, and human-readable documentation can be directly embedded into the metadata document, helping developers consume an OData service.
This alone is a huge benefit, yet metadata can be taken one step further by embedding machine-readable additional metadata that can be leveraged by development tools, client libraries, and generic clients to better interact with the service.
One area are semantic annotations that tell which of the OData properties contain e.g. a phone number, a part of a name or address, or something related to a calendar event or an analytic query. This is important for apps running on mobile devices that want to seamlessly integrate into contacts, calendar, and telephony.
The next area are capability annotations that describe which of the possible interactions defined by OData's uniform interface are supported by which parts of a concrete service. These annotations will e.g. tell whether an entity set allows inserts, updates, or deletes, whether it requires a filter, and which properties can be used in filter expressions. They also advertise capabilities that go beyond the base set defined by OData, e.g. whether an entity set allows free-text search via an SAP-defined query option.

Contents

AtomPub Service Document

AtomPub allows extending the service document with elements and attributes from XML namespaces other than AtomPub. The following sections describe which elements of the service document (namespace prefix app) can be annotated with attributes and elements from the namespace http://www.sap.com/Protocols/SAPData (namespace prefix sap) and from the namespace http://www.w3.org/2005/Atom (namespace prefix atom), and what these annotations mean.

Element app:service

The app:service element can be annotated with two elements from the atom namespace:
  • <atom:link rel="self" href="..."/> contains the link to this service document, and
  • <atom:link rel="latest-version" href="..."/> contains the link to latest version of this service.
If the latest-version link deviates from the self link, a client may inspect the newer version of the service and decide (probably after asking its user) to switch over to the newer service version.

Element app:collection

The app:collection element can be annotated with three elements:

It can also contain the attribute sap:addressable with the same value as for the corresponding entity set in the metadata document.

 

Metadata Document

OData's Conceptual Schema Definition Language (CSDL) allows annotating most model elements with XML attributes or elements from foreign XML namespaces. The following sections describe which elements of the metadata document (namespace prefix edm) can be annotated with attributes and elements from the namespace http://www.sap.com/Protocols/SAPData (namespace prefix sap), and what these annotations mean. For binary attributes the meaning is desribed for the value "true".

Element edm:EntityContainer

Entity containers can be annotated with the following attributes. If not stated explicitly, consumers can assume them to have the default value listed in the second column. This default value reflects the "normal" behavior.

Attribute NameDefault ValueMeaning
supported-formatsatom json

A white-space separated list of format shortnames. Possible list items:

  • atom
  • json
  • xlsx

The default is sap:supported-formats="atom json".

use-batchfalse

Wrap all requests to resources of this service in batch requests; only the service document and the metadata document can be accessed unwrapped.
Use cases:

  1. avoid exposing sensitive data in URLs (even with HTTPS URLs can be visible in log files)
  2. if RAL (read-access-logging) is active for a service, the use of $batch ensures - especially for read requests - a protection against CSRF attacks.

 

Element edm:EntitySet

Entity sets can be annotated with the following attributes. If not stated explicitly, consumers can assume them to have the default value listed in the second column. This default value reflects the "normal" behavior that can be expected from any OData service.
Attribute NameDefault ValueMeaning
label-Description, will also be used as atom:title in the service document
creatabletrueNew entities can be created in this set
updatabletrueEntities in this set can be updated
updatable-path-Entities in this set can be updated or not depending on their state. The value of this attribute is the name of a Boolean property in the entity type of the entity set. The value of this property indicates whether the entity can be updated or not.
deletabletrueEntities can be deleted from this set
deletable-path-Entities in this set can be deleted or not depending on their state. The value of this attribute is the name of a Boolean property in the entity type of the entity set. The value of this property indicates whether the entity can be deleted or not.
searchablefalseSupports custom query option search
pageabletrueSupports system query options $top and $skip
topabletrueSupports system query option $top
countabletrueSupports system query option $inlinecount=allpages and path suffix /$count
addressabletrueUse “false” if this entity set can only be accessed within its containing entity, e.g. SalesOrderItems within SalesOrders through SalesOrders(4711)/Items. Direct access to non-addressable entity collections will result in a 404 response code. The set may however allow access to single entities identified by their key properties values, e.g. SalesOrderItems(OrderID=4711,ItemID=3)
requires-filterfalseUse “true” if this set cannot be queried without providing a $filter expression. If accessed without a filter expression, it will respond with a human-readable error message explaining which kinds of filter expressions are required as a minimum
semantics-See table below

Attribute sap:semantics

This attribute can take the following values in the context of  an entity type:

ValueMeaning
aggregateThe entities of this set are automatically aggregated if the query option $select is specified. Each property listed in $select is treated according to its aggregation role, see description of attribute sap:aggregation-role below
fixed-valuesThe entity set represents a list of fixed values, i.e. it is unlikely to change often, and the list is typically short

Element edm:EntityType

Entity types can be annotated with the following attributes:
Attribute NameMeaning

label

Description, will also be used as sap:member-title in the service document

semantics

See table below

 

Attribute sap:semantics

This attribute can take the following values in the context of  an entity type:
ValueMeaning
vcardEntities of this type contain contact information following the vCard standard, see values for sap:semantics on property level
veventEntities of this type contain event/appointment information following the iCalendar standard, see values for sap:semantics on property level

vtodo

Entities of this type contain todo/task information following the iCalendar standard, see values for sap:semantics on property level
parametersThis entity type represents parameters for an analytical query
aggregate
Entity sets with this type return result feeds with aggregated values for properties annotated with sap:aggregation-role="measure".
The aggregation takes into account the dimension properties specified in the $select system query option of the request. See also description of annotation sap:aggregation-role.
variantThis entity type represents query selection variants bundling parameter selections and filter expressions for obtaining specific query results

Element edm:Property

The annotation sap:labelis required for properties. All other annotations are optional.
Attribute NameDefault ValueMeaning
label-A short, human-readable text suitable for labels and captions in UIs
heading-A short, human-readable text suitable for column headings in UIs
quickinfo-A human-readable text suitable for tool tips in UIs
semantics-See table below
creatabletrueValues for this property can be chosen by client when creating an instance. “False” if value is always set by the server, e.g. document number from number range.
updatabletrueValues of this property can be changed. Must be “false” if it is “false” at entity set level. If updatability can change per entity or based on the entities' state, do not use this static annotation and use sap:field-control instead.
sortabletrueCan be used in $orderby system query option.
filterabletrueCan be used in $filter system query option.
required-in-filterfalseMust be used in $filter system query option.
filter-restriction-See table below
text-The name of a property in the same type containing a human-readable text for the value of this property.
unit-The name of a property in the same type containing the currency code or unit of measure for a numeric value.
precision-The name of a property in the same type containing the number of significant decimal places for a numeric value.
visibletrueValues of this property are typically visible to end users. If visibility can change per entity or based on the entities' state, do not use this static annotation and use sap:field-control instead.
field-control3

The name of a property in the same type containing a numeric value that controls visibility:

  • 0 = hidden,
  • 1 = read-only,
  • 3 = optional,
  • 7 = mandatory

See section below for details

validation-regexp-Values for this property have to match the specified regular expression. The regular expression is a JavaScript Regular Expression.
display-format-

There are currently three possible values:

  • “Date” indicates that only the date part of an Edm.DateTime value is relevant
  • "NonNegative" indicates that only allows non-negative numeric values are provided and persisted
  • "UpperCase" indicates that uppercase values are provided and persisted, lowercase input will be converted
lower-boundary-
A property holding the upper boundary of a value range includes this attribute. The value of this attribute is always the name of another property in the same type.  It points to the property holding the related lower boundary.
upper-boundary-
A property holding the lower boundary of a value range includes this attribute. The value of this attribute is always the name of another property in the same type.  It points to the property holding the related upper boundary.
aggregation-role-See table below
super-ordinate-
If values of this property are meaningful (unique) only in the context provided by the value of another property, then this attribute holds the name of the context-providing property. The value of this attribute is always the name of another property in the same type.
attribute-for-
A property representing an attribute of another property includes this attribute. The value of this attribute is always the name of another property in the same type.  It points to the property for which this property is an attribute.
hierarchy-node-for-A property holding node IDs for a hierarchy structure of values of some other property includes this attribute.  The value of this attribute is always the name of another property in the same type. It points to the property for whose values the hierarchy is defined.
hierarchy-level-for-A property holding level numbers for a hierarchy structure of values of some other property includes this attribute. The value of this attribute is always the name of another property in the same type. It points to the related property holding the hierarchy node ID. A property holding level numbers has an integer data type. The root node of the hierarchy is at level 0.
hierarchy-parent-node-for-A property holding parent node IDs for a hierarchy structure of values of some other property includes this attribute. The value of this attribute is always the name of another property in the same type. It points to the related property holding the hierarchy node ID. For the root node of the hierarchy the parent node ID is null.
hierarchy-parent-navigation-for-A navigation property for accessing the parent entity of a node. It offers an alternative method for accessing the parent node ID, if the entity type does not have a dedicated property for that.
hierarchy-drill-state-for-
A property holding the drill state of a hierarchy node includes this attribute. The drill state is indicated by one of the following values: collapsed, expanded, leaf. The value of this attribute is always the name of another property in the same type. It points to the related property holding the hierarchy node ID. For a collapsed hierarchy node or a leaf, the hierarchy node ID of such an entity does not occur as parent node ID of any other entity in the set.
parameter-See table below
is-annotationfalseRepresents an instance annotation.
updatable-path-

If a property can be updated or not depending on the state of its entity, it can be annotated with this attribute. The value of this attribute is always the name of a Boolean property in the same type. This related property indicates whether the annotated property can be updated for the containing entity or not.

Note: if used in addition to the more expressive field-control annotation, the values of the two must be in sync.

preserve-flag-for-See below
filter-for-A property whose value is a $filter expression includes this attribute. The $filter expression must be valid for the entity type specified in this attribute.

Attributes sap:unit and sap:precision

Amounts in a currency or absolute measures MUST be represented as simple properties with an appropriate numeric Edm type, preferably Edm.Decimal. These numeric properties SHOULD refer to a string property containing the ISO currency or unit of measure with the sap:unit attribute. They MAY refer to a numeric property containing the (non-negative) number of decimal places to be used for displaying the amount or measure with the sap:precision attribute.

Example in metadata document:

 

<Property Name="OrderedQuantity" Type="Edm.Int16"
         
sap:unit="OrderedUnit" />
<Property Name="OrderedUnit" Type="Edm.String"

          sap:semantics="unit-of-measure" />

<Property Name="Price" Type="Edm.Decimal" Precision="10" Scale="3"
         
sap:unit="Currency" sap:precision="DisplayScale" />
<Property Name="DisplayScale" Type="Edm.Byte" />

<Property Name="Currency" Type="Edm.String"

          sap:semantics="currency-code" sap:text="CurrencyText" />

<Property Name="CurrencyText" Type="Edm.String" />

 

Example in Atom entry:

 

<d:OrderedQuantity>50</d:OrderedQuantity>
<d:OrderedUnit>KGM</d:OrderedUnit>
<d:Price>86.9</d:Price>

<d:DisplayScale>2</d:DisplayScale>

<d:Currency>EUR</d:Currency>
<d:CurrencyText>Euro</d:CurrencyText>

 

Using a reference attribute instead of predefined complex types like Measure or Money with amount and unit properties allows several amounts to share the same unit. Transporting the amounts as “raw” numeric values instead of preformatted strings allows clients to format them according to device-specific settings (that may well differ from the server-side user settings) or process them on the client (if e.g. the client is Excel).

Attribute sap:field-control

Whether a property can or must contain value may depend on the state of its entity, so it is impossible to express this up-front via metadata annotations. In these cases the "edit state" of the property can be expressed via a separate "field control" property, and the link between data properties and their field-control properties is expressed with the sap:field-control attribute.

Example in metadata document:

 

<Property Name="Street" Type="Edm.String"

          sap:field-control="UX_FC_Address" />

<Property Name="City" Type="Edm.String"

          sap:field-control="UX_FC_Address" />

<Property Name="UX_FC_Address" Type="Edm.Byte"/>


The field-control property can be in the same type as shown above, or it can be in a nested complex type, or in an entity type that is associated 1:1. This allows separating field-control data from "real" data. If for example the field-control property is contained in a complex property or navigation property named UX, the attribute value is contains a path relative to the parent of the annotated property, e.g. sap:field-control="UX/FC_Address".


The possible values for a field-control property are:

ValueMeaning
7Mandatory - property must contain a value
3Optional - property may contain a null value
1Read-only - property cannot be changed
0Hidden - property should not be visible on user interfaces

 

Attribute sap:semantics

The possible values in the context of a property are:

ValueMeaning
telTelephone number
tel;type=cell,workWork cellphone number; see explanation below table for more values
tel;type=faxFax number
emailEmail address
email;type=prefPreferred email address
urlWeb URL
nameFormatted text of the full name
givennameFirst name or given name of a person
middlenameMiddle name of a person
familynameLast name or family name of a person
nicknameDescriptive name given instead of or in addtion to the one marked as "name"
honorificTitle of a person (Ph.D., Dr., ...)
suffixSuffix to the name of a person
noteSupplemental information or a comment that is associated with the vCard
photoURL of a photo of a person
cityAddress: city
streetAddress: street
countryAddress: country
regionAddress: state or province
zip
Address: postal code
poboxAddress: post office box
orgOrganization name
org-unitOrganizational unit
org-roleOrganizational role
titleJob title
bdayBirth date
summaryCalendar: summary of a calendar component
descriptionCalendar: description of a calendar component, detailing the summary
categoriesCalendar: comma-separated list of categories for a calendar component
dtstartCalendar: the date and time that a calendar component starts
dtendCalendar: the date and time that a calendar component ends
durationCalendar: duration as an alternative to dtend
dueCalendar: the date and time that a to-do is expected to be completed
completedCalendar: the date and time that a to-do was actually completed
priorityCalendar: the relative priority for a calendar component, 0 for undefined, 1 for highest, ... 9 for lowest
classCalendar: access classification for a calendar component
statusCalendar: overall status or confirmation for the calendar component
percent-completeCalendar: percent completion of a to-do., ranging from 0 to 100 (integer)
contactCalendar: contact information or alternatively a reference to contact information associated with the calendar component
locationCalendar: the intended venue for the activity defined by a calendar component
transpCalendar: defines whether or not an event is transparaent to busy time searches
fbtypeCalendar: free/busy time type, see [iCalendar, Section 3.2.9]
wholedayCalendar: "true" or "false, depending on whether an event is scheduled for an entire day
fromMail: author of message, see [RFC5322, section 3.6.2]
senderMail: mailbox of agent responsible for actual transmission
toMai: comma-separated list of primary recipients, see [RFC5322, section 3.6.3]
ccMail: carbon copy, comma-separated
bccMail: blind carbon copy, comma-separated
subjectMail: topic of the message
bodyMail: message body
keywordsMail: comma-separated list of important words and phrases that might be useful for the recipient
receivedMail: DateTime the message was received
geo-lonGeolocation: longitude
geo-latGeolocation: latitude
currency-codeISO currency code
unit-of-measureUnit of measure, preferably ISO
For “tel” the type values are (see [vCard, section 6.4.1]):
  • "home" to indicate a telephone number associated with a residence
  • "work" to indicate a telephone number associated with a place of work
  • “pref" to indicate a preferred-use telephone number
  • "text" to indicate a telephone number supporting text messages (SMS)
  • "voice" to indicate a voice telephone number
  • "fax" to indicate a facsimile telephone number
  • "cell" to indicate a cellular telephone number
  • "video" to indicate a video conferencing telephone number
  • "pager" to indicate a paging device telephone number
  • "textphone" to indicate a telecommunication device for people with hearing or speech difficulties
For “email” the type values are:
  • "home" to indicate an email address associated with a residence
  • "work" to indicate an email address associated with a place of work
  • “pref" to indicate a preferred-use email address
For “url” and constituents of an address the type values are:
  • "home" to indicate an address associated with a residence
  • "work" to indicate an address associated with a place of work
  • “org" to indicate an address associated with the organization
  • “pref” to indicate a preferred address “other” to indicate some other address
These type values can be specified as a value list (like "type=work,pref").

Attribute sap:filter-restriction

A property can be annotated with this attribute, if filter restrictions exist. The attribute can take the following values:
ValueMeaning
single-valueOnly a single “eq”clause is possible.
multi-valueSeveral  “eq” clauses, separated by or, are possible.
intervalAt most one “ge” and one “le” clause, separated by “and”, alternatively a single “eq” clause.

Attribute sap:aggregation-role

A property can be annotated with this attribute, if it has an aggregation role. The attribute can take the following values:
ValueMeaning
dimensionThe property represents the key of a dimension. Only valid for properties of an entity type that is annotated with sap:semantics=“aggregate“.
measureThe property represents a measure whose values will be aggregated according to the aggregating behavior of the containing entity type. Only valid for properties of an entity type that is annotated with sap:semantics=“aggregate“.
totaled-properties-listThe property value is a comma-separated list of totaled dimension property names.

Attribute sap:parameter

A property can be annotated with this attribute, if it represents a parameter. The attribute can take the following values:
ValueMeaning
mandatoryA value must be supplied for this parameter.
optional
A value for this parameter can be left out by specifying an empty string (applicable only for parameter properties of type Edm.String).

 

Attribute sap:preserve-flag-for

A property holding the preservation state for another property includes this attribute.
The preservation state is a Boolean flag indicating whether or not the value of a named entity property is protected against updates causedby side-effects of updates to the entity set.
Example:
Consider an entity set holding order items with unit price, quantity, and total amount. All three properties supports preservation, as shown here for the unit price:
<Property Name="UnitPrice" Type="Edm.Decimal"/>
<Property Name="UnitPricePreserveFlag" Type="Edm.Boolean"
          sap:preserve-flag-for="UnitPrice"/>
For a given order item, a consumer can set the preservation flag for the total amount and update the unit price. This would instruct the provider to recalculate the quantity instead of the total amount.

Element edm:NavigationProperty

Attribute NameDefault ValueMeaning
filterabletrueCan be used as a path segment for properties in $filter system query option

Element edm:FunctionImport

Attribute NameMeaning
action-forValue is the qualified name of an entity type in scope. Indicates that the function or action operates on instances of that entity type. The function import MUST have a required parameter for each key property of that entity type. Parameter name and type must be identical to the name and type of the corresponding key property.
applicable-pathValue is a path to a Boolean property in the entity type named in the action-for attribute. The property indicates whether the function import can be invoked for the entity. The path can be the name of a Boolean property, or the name of a complex property followed by a forward slash and the path to a Boolean property in the complex type.
labelDescription
planning-functionThis function processes or generates plan data that may be exposed by entity sets of aggregate entity types in the same service. Its logic may have side-effects on these entity sets.
A function import can optionally include an annotation with an sap:value-constraint element.

 

Element sap:value-constraint

This element describes a dependency of function import parameters to key properties of an entity set, comparable to a referential constraint.
Example: For a function import with two parameters for country and region, the possible arguments can be determined via some Regions entity set.

    <sap:value-constraint set="Regions">

          <sap:parameter-ref name="Country"/>

          <sap:parameter-ref name="Region"/>

    </sap:value-constraint>

 

It has a set attribute that identifies the entity set containing the list of allowed parameter value combinations.

 

Nested sap:parameter-ref elements link the function import parameters specified with the name attribute to a key property of the entity type of the specified entity set. The sequence of sap:parameter-ref elements matches the sequence of the edm:PropertyRef elements of the Key element.

 

Element edm:Parameter

Attribute NameMeaning
labelDescription

Element edm:AssociationSet

Attribute NameDefault ValueMeaning
creatabletrueRelations can be created
updatabletrueRelations can be changed
deletabletrueRelations can be deleted

Instance Annotations

An annotation of an element in the OData metadata document adds information at the structural level of the service. Sometimes extra pieces of information are needed in the OData response for individual entities and their properties. To distinguish these two cases the former are called metadata annotations, while annotations of the entities in the OData response are called instance annotations.
Metadata annotations add information to the model structure. They are fully described by adding the appropriate AnnotationElement or AnnotationAttribute to a model element.
For instance annotations, this is different, because it must be possible to add different annotation values for every entity or every entity property, respectively. Therefore, if instance annotations are relevant for instances of some entity type, the structure of the entity type gets extended by properties specifically added for the purpose of holding annotation values in the result entities. These extra properties are also annotated with sap:is-annotation=”true” to identify them as
annotation holders and separate them from the other properties of the entity type.
A single entity can have multiple instance annotations, for each of which an extra property gets added to the underlying type:
  • Zero or more for the entity itself.
  • Zero or more for every property contained in the entity.
Properties representing instance annotations are always introduced by AnnotationAttributes in the metadata document. The following sections describe the possible occurrences.
Example:
<Property Name="Street" Type="Edm.String" Nullable="true"
          sap:field-control="Address_FC"/>
<Property Name="City" Type="Edm.String" Nullable="true"
          sap:field-control="Address_FC"/>
<Property Name="Address_FC" Type="Edm.Byte" Nullable="true"
          sap:is-annotation="true"/>

Query Option search

Modern user interfaces typically feature a search box for entering a free-text search term, and how exactly this search term is used to find "matching" things is up to the application. The custom query option search is intended exactly for passing such a free-text search term to the backend and let the backend decide against which properties of each entity in the entity set the term is matched, and how. It may also be matched against properties of related entities, e.g.
    GET ~/Orders?search=blue
to find all orders with items that refer to a blue product. Service implementations using SAP NetWeaver Gateway OData Channel will receive the search term in the parameter IV_SEARCH_STRING of method GET_ENTITYSET, see http://help.sap.com/saphelp_gateway20sp06/helpdata/en/7b/7ea4676342455c99072ce8815f799d/frameset.htm for details.
Note that search works similar to $filter: it will return a subset of the entities that are returned when no search term is specified. And it combines with $filter, returning only entities that fulfill both conditions.

Multilevel Deep Create via Gateway!

$
0
0

Hi,

Does anyone know if its possible to created multilevel deep create via Gateway?

For Example: I want to create 3 levels deep hierarchy via Gateway in 1 go:

Level 1: Project to Group Products

Level 2: Group Products to Group Sales Articles

Level 3: Group Sales Articles to Article Market Listing

 

If not, I will have to break these into multiple Asynchronous deep calls bound with some logical keys

 

Regards,

Saumil Jyotishi

Gateway Workflow Configuration OData

$
0
0

Hi

 

Just wanted to know which OData service is the correct one to configure workflows...

 

1. /sap/opu/odata/iwwrk/WFSERVICE;mo

 

or

 

2. /sap/opu/odata/IWPGW/TASKPROCESSING;mo

 

For generic workflow approvals, I used sap/opu/odata/IWPGW/TASKPROCESSING;mo and it was working.

 

I can see most if the entity types defined in both are similar. So is there any specific scenario where each one is used and what is the difference between those?

 

Thanks and Regards

Vidyadhar

Error in Gateway Consumption through eclipse

$
0
0

Hi Everyone,

 

Hi Everyone,

 

I am following this linkwritten by Chandrashekhar Mahajan .

As i executed this in app preview and then copied this url to google chrome, i am getting this error while checked through inbuilt developers tool in google chrome.

 

SAPUI5_Error.JPG

 

Please help me in learning this new platform. Thanks in advance.

I have searched everywhere and now lastly came for SCN discussions. Please help me.

 

Regards

Dhananjay

SAP UI5 Code Problem for reading XML View input field in View Controller (Error "Can not call method 'GetValue' of Undefined" coming)

$
0
0

As I am in the learning process, I am stuck at one point for which I need your help. I am mentioning that in details below.

 

I have developed the following application in which one master page comes which shows the list of PRs to be approved by a user.

 

Pic1.jpg

 

When clicking a particular PR, it shows the detail page.

 

Pic2.jpg

 

 

In the detail page, several fields are displayed like general details, approval status list, comments (if any) and the list of attachments (attachments not yet integrated).

 

Pic3.jpg

 

 

Pic4.jpg

Pic5.jpg

 

The line-item list is also displayed as follows –

 

Pic6.jpg

 

Now, if I click on a particular line item, it opens a line item view as follows –

 

Pic7.jpg

 

It is showing the selected line-item details. It will show the service sub-line item list also which is within that particular line-item as follows –

 

`

pic8.jpg

Line Number 00080 has sub-line item which is shown below.

pic9.jpg

 

Now, I have kept provision of modifying quantity, rate, cost center and G/L account (the value you are seeing above is placeholder value. I have created the gateway channels (along with RFC) for updating the same.

 

The process for updating the same through gateway also is known to me as I have seen some test applications (using X-CSRF-Token etc.). I have tested my gateway configuration and RFC also through test data in Postman Rest Client.

 

The problem I am facing is for reading the value of entered quantity, rate, G/L account, cost center in the line item controller once I presses the ‘Save Data’ button (details will be available in the lineitem view and lineitem controller in the WebContent folder). Along with that I need to read 2 fields – Banfn (PR number) and Bnfpo (PR Lineitem number) (these are needed for sending the data to gateway and updating R3 system) – these are already available in the line-item view model as data is displaying in the lineitem view.

 

I have to take those 6 values in 6 variables for passing to gateway service.

 

Can you please tell me how can I do that? It will be of great help to me if you please help me to read those 6 values in line item view controller once 'Save Data' button is pressed. I tried to attach the webcontent folder but could not attach. I am attaching the same document with screen-shots here separately.


It will be of great help if anybody can suggest what can be done to read those in controller. After reading code for sending to Gateway is known to me. I could not attach the webcontent folder as I can not upload .rar file, however I am giving the code for lineitem.view.xml and lineitem.controller.xml below -


Code of Lineitem.View.XML -


<core:View

   controllerName="sap.ui.demo.myFiori.view.LineItem"

   xmlns="sap.m"

   xmlns:core="sap.ui.core" >

   <Page

     id="page"

     title=" {i18n>LineItemTitle}"

     showNavButton="true"

     navButtonPress="handleNavBack" >

     <content>

     <ObjectHeader

         title="{Txz01}"

         number="{Tpreis1}"

         numberUnit="INR" >

      <attributes>

        <ObjectAttribute text="{Bnfpo}" />

        <ObjectAttribute text="{Menge}" />

        <ObjectAttribute text="{Preis1}" />

        <ObjectAttribute text="{Kostl}" />

        <ObjectAttribute text="{Sakto}" />

      </attributes>

     </ObjectHeader>

 

 

 

     <List

      headerText="Modify Quantity, Rate, Cost Center and G/L Account if needed">

     <InputListItem label="Quantity">

     <Input

     id="Vmenge"

     placeholder="Enter Value"

     value="{Menge}"/>

     </InputListItem>

     <InputListItem label="Rate">

     <Input

     id="Vpreis"

     placeholder="Enter Value"

     value="{Preis1}"/>

     </InputListItem>

     <InputListItem label="G/L Account">

     <Input

     placeholder="Enter Value"

     value="{Sakto}"/>

     </InputListItem>

     <InputListItem label="Cost Center">

     <Input

     placeholder="Enter Value"

     value="{Kostl}"/>

     </InputListItem>

     </List>

 

      <Table id="Table10"

       headerText="{i18n>SubLineItemTableHeader}"

       items="{LINETOSUBLINES}">

       <columns>

         <Column>

           <header><Label text="Service" /></header>

         </Column>

         <Column>

           <header><Label text="Quantity" /></header>

         </Column>

         <Column>

           <header><Label text="Rate" /></header>

         </Column>

         <Column>

           <header><Label text="Price" /></header>

         </Column>

        </columns>

       <ColumnListItem>

          <ObjectIdentifier

           title="{ShortText}"

           text="{Service}"

           class="sapTableContentMargin" />

          <ObjectNumber

            number="{Quantity}"/>

          <ObjectNumber

            number="{GrPrice}"

            unit="INR"/>

          <ObjectNumber

            number="{NetValue}"

            unit="INR"/>

        </ColumnListItem>

      </Table>

 

     </content>

     <footer>

       <Bar>

 

         <contentRight>

            <Button

             text="{i18n>dataSave}"

             type="Transparent"

             icon="sap-icon://save"

             press="handleUpdate" />

          </contentRight>

       </Bar>

     </footer>

   </Page>

</core:View>

 

Code of LineItem.Controller.JS

 

ap.ui.controller("sap.ui.demo.myFiori.view.LineItem", {

 

// onAfterRendering: function() {

 

  //       var var_menge = sap.ui.getCore().byId("Vmenge").getValue();

  //       var var_preis = sap.ui.getCore().byId("Vpreis").getValue();

 

  // },

 

  handleUpdate : function (evt) {

 

     // show confirmation dialog

     var bundle = this.getView().getModel("i18n").getResourceBundle();

     sap.m.MessageBox.confirm(

       bundle.getText("UpdateDialogMsg"),

       function (oAction) {

         if (sap.m.MessageBox.Action.OK === oAction) {

 

           var var_menge = sap.ui.getCore().byId("Vmenge").getValue();

           var var_preis = sap.ui.getCore().byId("Vpreis").getValue()

 

?? Was trying to read those variables but those were giving errors as below. Rest code for sending value to Gateway will be written once the above code is corrected -

 

Pic10.jpg

 

I am getting the error while reading the input values from the XML view.

 

_______________________________________________________________________________________________________

//LineItem.Controller.JS code is continuing below.          

 

// notify user

           var successMsg = bundle.getText("UpdateDialogSuccessMsg");

           sap.m.MessageToast.show(successMsg);

           // TODO call proper service method and update model (not part of this session)

         }

       },

 

       bundle.getText("UpdateDialogTitle")

     );

   },

 

   handleNavBack : function (evt) {&nbsp;

     this.nav.back("Detail");

   }

});

Viewing all 2823 articles
Browse latest View live


Latest Images

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