Quantcast
Channel: SCN : All Content - SAP NetWeaver Gateway Developer Center
Viewing all 750 articles
Browse latest View live

Why Helper Class Is Used In DPC_EXT To Call FM's

$
0
0

Hi Experts,

 

I have doubt related implementation of gateway, Why people suggest that don't write your code directly in DPC_EXT class. They suggest to create one helper class and then write your code in that method. I want to know the exact reason behind this.

 

Thanks & Regards,

Amit


SAP gateway

$
0
0

HI,

I using some Standard  SAP Services for Fiori App, i want to find weather services are using

Generic Channel used (NEGW_GENERIC)? &

Push Flow scenario used (NWGW_PFLOW)? &

Web Services used? (NWGW_WS)?

components or not .how to determine the same. Thanks in advance

getting error Internal server error when calling gateway service

$
0
0

hi,

  I am getting error Internal server error  when I  calling customer_creating_entity method from gateway and i am getting data from get method.

I write following ajax code in sapui5.

 

jQuery.ajax({

                     beforeSend: function(xhrObj){

                             xhrObj.setRequestHeader("X-Requested-With","XMLHttpRequest");

                             xhrObj.setRequestHeader("Content-Type","application/json");

                             xhrObj.setRequestHeader("Accept","application/json");

                     },

                     type: "POST",

                     contentType: "application/json",

                     url: url,

                     dataType: "json",

                     data: {

                  "CoID": 20241,

                     "CoName": "krishna",

                              "ContactNo": "12345678990"

                    },

                

 

 

                 success: function(xml) {

                   //oModel.setData(data);            

                   alert("success to post");

                 },

            

                 error: function(xml) {

                   //oModel.setData(data);       

                   alert("fail to  post");

                   alert(xml);

                 }

             });

Role Templates missing for NW Gateway (NW 7.40)

$
0
0


Hello everybody,

 

I have sucessfully installed NW 7.40 but during configuration of the NW Gateway (SAP_GWFND) I miss some role templates.

 

e.g.: /IWFND/RT_BOR_DEV; /IWCNT/RT_USER_WF; /IWBEP/RT_MGW_DSP

 

Any ideas? Thanks for ur  help.

 

BR, René.

deep entity - Odata using SEGW

$
0
0

Hi Guys,

 

I was trying to create deep entity, I have done with all the steps like associations and navigations and even association sets using segw, but I am able to create associations using manually like creating MPC and DPC classes externally.

 

But when I tried through SEGW, I am able to see metadata, but when I am using JSON object as request body, It is not recognizing Item entityset type as entity, it is simply taking as property.

 

Please do provide me some input on this.I have gone through blogs too.

 

 

Thanks

ui5 display pdf different behavior with firefox and chrome

$
0
0

Hi all,

   i am developing a ui5 application to display a pdf through sap gateway, i followed this article ,however something strange happened.

   i followed the Improved and Recommended approach to display pdf section,it's ok with Firefox and gateway client, but not ok on Chrome and Safiri. on Chrome the pdf didn't generate in the Z_TEST_PDF_DISPLAY, when it  CALL FUNCTION lv_fm_name ,the ls_output_data is empty. On Firefox it has data. not sure why. any one  have ideas?  what should do with http header or cache response, i tried lots of codes, still not working.

 

thanks,

Billy

8E4632D6-216F-456E-BE27-C6862EC59666.pngA410868E-2886-4B01-8B3B-D22DB999C1A7.png

Can an OData Service save the value of a selection?

$
0
0

Hello Experts,

My current question is more like a conceptual question. SAPGateway delivers an OData service with an entity type containing the following Properties:

  • ATNAM
  • ATWRT
  • ATWTB

 

 

The values of this entityset do never change and are as follows:

 

ATNAM

ATWRT

ATWTB

FIORI_PRG

BA

Barcelona

FIORI_PRG

BE

Berlin

FIORI_PRG

HA

Havanna

FIORI_TYP

SE

Sessel

FIORI_TYP

ZW

Zweisitzer

FIORI_TYP

DR

Dreisitzer

FIORI_FARBE

BL

Blau

FIORI_FARBE

BR

Braun

FIORI_FARBE

GR

Grün

FIORI_FARBE

SW

Schwarz

FIORI_BEZUGSSTOFF

ST

Stoff

FIORI_BEZUGSSTOFF

KL

Kunstleder

FIORI_BEZUGSSTOFF

NL

Naturleder

 

 

In UI5-Frontend, the data is consumed in different lists that filter the values of the property ATNAM and display accordingly the values of ATWTB just like you can see it in here: JS Bin - Collaborative JavaScript Debugging

 

Now the question: is it possible for this OData service to “be informed” of the selected value from any of these lists?  (assuming that UI5 can send a value).

Clarification: the service has only the get and getentityset methods redefined.  Or same question formulated differently: can the OData service save the result of a selection of a filtered list?

 

If someone wants to take a look at the metadata, the file can be seen in:  https://goo.gl/pAE4qz

Thank you very much for your support,

Gabriel

What are File handling in Sap netweaver Gateway odata services in detail?

$
0
0

Hi expers,

 

This is Gowri shankar i am new to sap netweaver gateway services i just want to know about "What are File handling servises in Sap netweaver Gateway odata services in detail? Please understand my query and let me know.

 

Thanks,

Gowrishankar.


How to use OData SDK PHP create an entity in SAP

$
0
0

Hi,

I‘m using OData SDK PHP to consume the odata in SAP system, I can use this get_entityset from SAP but not able to Create entity in SAP

my PHP code is like this

 

 

<?php
require_once "Z_WE_ASSCOCUSTOPENID_SRV_Entities.php";   //connect    $OData = new Z_WE_ASSCOCUSTOPENID_SRV_Entities
('http://192.168.1.138:8008/sap/opu/odata/sap/Z_WE_ASSCOCUSTOPENID_SRV/') ;
$OData->Credential = new WindowsCredential($_POST["userName"],$_POST["pwd"]);   try
{    //Create a Customer php Object    $OpenId = OpenId::CreateOpenId( "","",$_POST["Name"],$_POST["CustomerName"],$_POST["Code"]);    //inserting Customers object context tracking system    $OData->AddObject('OpenIdSet', $OpenId);   //SaveChange insert the object into data service   $Odata->SaveChanges();
}
catch(ODataServiceException $exception)
{    Echo $exception->getError();
}
?>
{    Echo $exception->getError();
}
?>

I will get the error Undefined property:z_we_asscocustopenid_srv_entities::$nextChange in E:\xx\xx\Context\ObjectContext.php on line 789 Unauthorized

but this property is the ODATA SDK PHP file I never change this

can you help me?

Null Pointer Exception in Read Operation of odata using JavaSE

$
0
0

In main Class of java declare  two methods

1.initializeRestClient()

2.readExample()

In first method set the credentials...and in second method first calling Gateway after then  getting response then convert response body XML into OdataCollection object and then Iterate Odata entries in data collection and print property.....

But i am facing the exception that OdataCollection is getting Null value.Read Odata.png

CustomCross-Application Basic Settings Field in SRM 7.1 contract item - no value in context

$
0
0

Hi , i have add a custom field ( checkbox ) on item contract in SRM . I have add  the field in SPRO: SRM Server--> Cross application basic settings --> Extensions and field Control ( Personalization) ---> Configure customer fields --> Define customer fields on item level
Then i have used this link to configure the isibility of the field :
SRM Server-->Cross application basic settings-->Extensions and field Control ( Personalization) --> Configure field control--> configure control for fields on item level
I have add the new field in context of view of /SAPSRM/WDC_CTR_DOTC_IT, into view V_CTR_DODC_ITEMS . I have add the new field in layout and binding it to context. The field is visible but when i select it, ( is a checkbox ) i haven' the value in context.
Any suggest?

Thanks in advance.

M.

Replace Service Standar Create Sales Order Fiori

$
0
0

Hi,

 

My issue is , I created a extension project and replace service odata of standard

 

/sap/opu/odata/SAP/SRA017_SALESORDER_CREATE_SRV of SR017_SALESORDER_CREATE

 

for

 

/sap/opu/odata/SAP/ZZSRA017_SALESORDER_CREATE_SRV of ZZSR017_SALESORDER_CREATE

 

but, i run the application and not refresh the called service, and continue call standard class and methods of CL_SRA017_SALESORDER_C_DPC_EXT

 

 

i need call class ZZCL_SRA017_SALESORDER_C_DPC_EXT or my project

 

the process i am doing is in

Extend a Fiori Application with SAP Web IDE Part 3

 

Thanks in advance, for your help

Testing a Deep Insert - Json: OData Create Sales Order BAPI for POST

$
0
0

Hi Experts,

I have created a OData service for Create Sales Order with deep entity set with the help of following link OData Service with multiple entity set for Create SO: using standard BAPI in OData, but I am facing a problem during testing of service using json code as Input. I have not implemented the Query and Read operations for the same, because this "Create SO" it is based on standard BAPI - BAPI_SALESORDER_CREATEFROMDAT2. I need a json code to test my service. Please suggest.

 

Thanks

Saurabh

Header Response in Batch Processing

$
0
0

Hello,

 

My Scenario:

Multiple records update is required from the front end. This is achieved via Batch Processing. Upon processing of each record, an update message for each record should be sent back to UI5.


Requirement:

Need to send back the status message to UI for each single record.


Actual Process followed:

Lets say I have 3 records for updating, the sequence of methods called are as below:

1. Change Set BEGIN.

2. Update Entity (Called 3 times)

3. Change Set END.


In Begin method is just redefined and has no code.

In Update entity I am collecting all the individual record in an global internal table of same class.

In End method, calling an RFC to update all 3 records at a time. This RFC returns 3 messages indicating success or failure which needs to sent to UI.


Hence I thought to send these messages by concatenating into single message and send via Header response in method Change Set END as follows:

  1. data:  ls_header               TYPE ihttpnvp. 
  2. ls_header-name = 'my-custom-message'
  3. ls_header-value = 'my_message'
  4. /iwbep/if_mgw_conv_srv_runtime~set_header( ls_header ).

 

Problem:

I am not getting any header response with name my-custom-message.

 

Kindly suggest me to send the messages to UI5 with any corrections to above procedure or an alternative procedure.

 

Note: The header response with above method is only working from method Update Entity and I don't want to call the RFC for each single entity.

 

Regards,

Satish D R

Gateway download links from main page

$
0
0

Hello,

 

The gateway download links from the main page of this SCN forum aren't working for me. Where can I get those files?

 

Sincerely,

 

Gabriel


How to access request object in Model Provider Class?

$
0
0

Dear specialists,

 

as my previous post is located in the wrong area (How to access request object in Model Provider Class),

I repost my question here:

 

I want to define the data model of my OData service dynamically depending on an URI paramter of my HTTP request. But so far I did not find any possibility to access the request object in the model provider class.

 

Does anybody has a hint for me?

 

Many thanks in advance.

 

Best regards,

Juergen

Dynamically populate values - itab of type complex data type

$
0
0

Hi Everyone,

 

I have a entity which is of complex data type.

 

Is it possible to get columns of itab which of type complex data type at runtime then How can we achieve this.

 

My logic is I will be getting entity columns from different table, for this I designed one dynamic itab and I am getting column component using Assign component statement. till here ok , but this value I have to pass a column name to the itab which has complex data type assigned .

 

 

 

Thanks in advance...

Simple Steps to Develop ODATA Using Global Classes in CREATE_DEEP_ENTITY Method Operation with JSON Format

$
0
0

Simple-Steps-to-Develop-ODATA-Using-Global-Classes-in-CREATE_DEEP_ENTITY-Method-Operation-with-JSON-Format.jpg

This blog will show you how to develop ODATA using Global Classes in CREATE_DEEP_ENTITY Method Operation with JSON Format using simple steps.

 

Step 1:

Create Custom Global Classes with below Structures.

 

Go To TransactionSE11 and create structures as displayed in the below screenshots.

 

Create Table Type ZPHYSINV_ITEMS_TAB.

Include the line type Structure.

 

ODATA-display-Table-Type.png


Structure 1:

BAPI_PHYSINV_CREATE_ITEMS

 

ODATA-dictionary-display-Structure.png

Structure 2:

BAPI_PHYSINV_CREATE_HEAD
ODATA-dictionary-display-Structure-2.png

Structure 3:

Create Table Type ZRETURN_TAB.

Include the line type Structure ZBAPIRET.

ODATA-dictionary-display-Table.png

ODATA dictionary display Structure.png

Go to Transaction SE24 and create a global class with following parameters.

Global Class: ZCL_MOBIM_ICC

ODATA-Class-Builder.png

Parameters for Method: CREATE INVENTORY_DOCUMENT

ODATA Class Builder-Display.png

After creating structures and class in SE24 with above given parameters, paste the below Code into the method CREATE INVENTORY_DOCUMENT.

 

Code Snippet:

 

method create_inventory_document.

*--Data Declaration

  data: ls_head      type bapi_physinv_create_head,

ls_maxitems  type am07m-maxpo value 300,

        lt_item      type standard table of bapi_physinv_create_items,

        ls_item      type bapi_physinv_create_items,

        lt_return    type standard table of bapiret2,

        ls_return    type bapiret2,

        wa_return    type zbapiret.

 

  data: lv_error_detected(1) type c,

        lv_text type bapi_msg,

        lv_flag.

 

*--Pass the Header Details

  ls_head-plant      = im_header-plant.

  ls_head-stge_loc   = im_header-stge_loc.

ls_head-doc_date   = im_header-doc_date.

ls_head-plan_date  = im_header-plan_date.

 

*--Passing the Multiple Items

  loop at im_item into ls_item.

    append ls_item to lt_item.

  endloop.

 

*--Create Inventory Documents

  call function 'BAPI_MATPHYSINV_CREATE_MULT'

    exporting

      head     = ls_head

      maxitems = ls_maxitems

    tables

      items    = lt_item

      return   = lt_return.

 

*--Reading Succefully Messages

  read table lt_return into ls_return with key type = 'E'.

  if sy-subrc ne 0.

    call function 'BAPI_TRANSACTION_COMMIT'

      exporting

        wait = '1'.

    loop at lt_return into ls_return where type eq 'S'.

      call function 'FORMAT_MESSAGE'

        exporting

          id        = ls_return-id

          lang      = sy-langu

          no        = ls_return-number

          v1        = ls_return-message_v1

          v2        = ls_return-message_v2

          v3        = ls_return-message_v3

          v4        = ls_return-message_v4

        importing

          msg       = lv_text

        exceptions

          not_found = 1

          others    = 2.

      clear: wa_return.

wa_return-type    = 'S'.

wa_return-message = lv_text.

      append wa_return to ex_return.

    clear: ls_return, wa_return, lv_text .

    endloop.

  else.

    lv_flag = 'X'.

  endif.

 

*--Reading Error Messages

  if lv_flag eq 'X'.

    call function 'BAPI_TRANSACTION_ROLLBACK'.

    loop at lt_return into ls_return where type eq 'E'.

      call function 'FORMAT_MESSAGE'

      exporting

        id        = ls_return-id

        lang      = sy-langu

        no        = ls_return-number

        v1        = ls_return-message_v1

        v2        = ls_return-message_v2

        v3        = ls_return-message_v3

        v4 = ls_return-message_v4

      importing

        msg       = lv_text

      exceptions

        not_found = 1

        others    = 2.

      clear: wa_return.

wa_return-type    = 'E'.

wa_return-message = lv_text.

      append wa_return to ex_return.

      clear: ls_return, wa_return, lv_text.

    endloop.

  endif.

  1. Endmethod.

 

Now you have created the Global Classes. Now let’s start developing ODATA in Net Weaver gateway Client SEGW for above Class.

 

 

Step 2: Create Project in SEGW

 

As I mentioned earlier we will implement the CREATE_DEEP_ENTITY for multiple postings with single request like one Header with multiple Line items.

 

In the example below, I will show posting with one Header with multiple Line items.

Create Entity Types, Entity Set, Association and Navigations as follows.

 

Create two Entity Types and Entity Sets.

 

Entity Type-1 - ICC_Header

Entity Type-2 - ICC_Items

 

Entity Set-1- ICC_HeaderSet

Entity Set-2- ICC_ItemsSet

ZMOBOIM-ICC.png

Properties of ICC_Header

ODATA-ICC-Header.png

Properties of ICC_Items

ODATA-ICC-Items.png

Step 3:

Create Association and Navigation.

Create Associations as shown below.

 

Association - Assoc_ICCHeader_ICCItems

ODATA-Association-ICC-Items.png

Create Navigation  as shown below.

 

Navigation – ICC_Items

SAP-NetWeaver-Gateway-Service-Builder.png

Now generate runtime artifacts. Once generation is successful, you will get 4 classes. Two for Data provider classes and two for Model provider classes. Implement the code in Data provider class as shown below.

 

Double click on the Class ZCL_MOBOIM_ICC_DPC_EXT. Go to ABAP Workbench.

ODATA MOBOIM ICC DPC EXT.png

Start the Gateway client by calling transaction /IWFND/GW_CLIENT.

Enter the following URI to test your implementation.

Append $metatda to base service URI.

 

/sap/opu/odata/sap/ZMOBOIM_ICC_SRV/?$metadata

 

If everything works perfectly then HTTP response will be displayed as shown below with value 200.

SAP NetWeaver Gateway Client.png

Check service document append $format=json.

ODATA SAP NetWeaver Gateway Client.png

Step 4:

Implementing the CREATE_DEEP_ENTITY Method.

 

Right click and redefine the Create_Deep_Entity Method as shown in below Screenshot.

Create Deep Entity Method.png

Now double click on CREATE_DEEP_ENTITY Method. Paste the code below.

ODATA Repository Browser.png

Code Snippet:

 

method /iwbep/if_mgw_appl_srv_runtime~create_deep_entity.

 

*--Types Declaration for Inventory Cycle Document

  types: ty_t_iccitem   type standard table of zcl_zmoboim_icc_mpc=>ts_icc_items with default key.

 

*--Represents Inventory Cycle Document structure - header with one of more items

  types: begin of ty_s_icc.  "Deep Structure for Inventory Cycle Document

          include type zcl_zmoboim_icc_mpc=>ts_icc_header.

  types: icc_items type ty_t_iccitem,    "Name Should be as Entity Type Name

         end of ty_s_icc.

 

*--Data Declaration for Inventory Cycle Document

  data: ls_icc type ty_s_icc,

        ls_iccitem type zcl_zmoboim_icc_mpc=>ts_icc_items,

        ls_header  type bapi_physinv_create_head,

        it_item    type standard table of bapi_physinv_create_items,

        wa_item    type bapi_physinv_create_items,

        wa_icc_items like line of ls_icc-icc_items.

 

  constants: lc_iccitem   type string value 'ICC_Items'.

  constants: lc_countitem type string value 'Count_Items'.

  constants: lc_diffitem  type string value 'PostDiff_Items'.

 

*--Data Declaration for Return Message

  data: lv_compare_result type /iwbep/if_mgw_odata_expand=>ty_e_compare_result,

        lt_return  type zreturn_tab,

        ls_return  type zbapiret.

 

  case iv_entity_name.

   when 'ICC_Header'.

 

*--Validate whether the current request including the inline data matches

lv_compare_result = io_expand->compare_to( lc_iccitem ).

*-- Upon match, access data from IO_DATA_PROVIDER

      io_data_provider->read_entry_data( importing es_data = ls_icc ).

 

*--Pass the Header Data

ls_header-plant      =  ls_icc-plant.

ls_header-stge_loc   =  ls_icc-stge_loc.

ls_header-doc_date   =  ls_icc-doc_date.

ls_header-plan_date  =  ls_icc-plan_date.

 

      clear: ls_iccitem.

 

*--Pass the Item Data

      loop at ls_icc-icc_items into ls_iccitem.

move-corresponding ls_iccitem to wa_item.

        call function 'CONVERSION_EXIT_MATN1_INPUT'

          exporting

            input  = ls_iccitem-material

          importing

            output = wa_item-material.

 

        append wa_item to it_item.

        clear: wa_item, ls_iccitem.

      endloop.

 

*--Create Invertory Cycle Counting (Custom Global Class)

      call method zcl_moboim_icc=>create_inventory_document

        exporting

          im_header = ls_header

          im_item   = it_item

        importing

          ex_return = lt_return.

 

      if lt_return is not initial.

        loop at lt_return into ls_return .

          move-corresponding ls_return to wa_icc_items.

          modify ls_icc-icc_items from wa_icc_items index sy-tabix transporting type message.

        endloop.

      endif.

 

copy_data_to_ref(

      exporting

        is_data = ls_icc

      changing

        cr_data = er_deep_entity

        ).

      clear ls_icc.

 

   when others.

  endcase.

  1. Endmethod.

 

 

 

Step 5: 

Create a Request Payload.

 

HTTP  Request in JSON Format:

 

HTTP Method   : POST

X-CSRF-Token : Fetch

Content-Type     : application/json

 

JSON  Format Payload:

 

{

"d":{

"Plant":"1100",

"StorageLoc":"1000",

"DocDate":"2015-07-21T00:00:00",

"PlanDate":"2015-07-21T00:00:00",

"ICC_Items":[

{

"Material":"2144",

"Batch":" ",

"StockType":" ",

"AltUnit":" "

},

{

"Material":"2145",

"Batch":" ",

"StockType":" ",

"AltUnit":" "

}

]

}

}

 

 

 

 

Step 6: 

Post the data with JSON format.

ODATA with JSON format.png


Put external break point and ensure whether the values are fetched in the structure or not.

 

JSON format-external break point.png

JSON format-IT-ITEM.png

Come out from the debugging.

Records will be created and HTTP response value 201 will be created as displayed below.

ODATA HTTP response.png

That’s all. You’re done with it!!!

 

I know the above steps will be useful in developing ODATA with Global Classes in Net Weaver gateway. Suggestions and comments for this post will be appreciated.

How to implement GET_ENTITYSET for Media Stream

$
0
0

Hi Experts,

 

 

I have implemented GET_STREAM method to download the media entity. When I execute the service as /zservice/photo/$value media steam is getting downloaded.

 

 

I need to implement the GET_ENTITYSET method as well because this will be used in SMP Mobile and from mobile it will need to register the service by calling /zservice/photo. If this method is implemented its throwing "Invalid or no mapping to system data types found" error.

 

Please advise how to implement GET_ENTITYSET. Method doesn't need to return any results.


 

Regards,

Murthy

Cannot select No return in Function import return type kind

$
0
0

Hi,

 

I have created a function import , its for calling an API ,and there is no returning parameter.

 

But I am not able to select the return type kind against the Function import as No return.

 

While trying to generate I am getting an error ' No return is currently not supported by the runtime'.

 

 

Regards,
Vivek.

Viewing all 750 articles
Browse latest View live


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