Quantcast
Channel: SCN: Message List - SAP Gateway
Viewing all 6105 articles
Browse latest View live

Re: Generate PDF file in backend, and "send" it to SAP Gateway

$
0
0

Hi Chandra

When I do it within 60 seconds, I still got an error message

404   Not Found

Any suggestions?

 

Can I see anywhere if I am doing something wrong? (When I am debugging, I don't get any errors).

 

Lars




Re: Generate PDF file in backend, and "send" it to SAP Gateway

$
0
0

My code looks like this:

DATA :   lv_app_type TYPE string,   lv_guid TYPE guid_32,   lo_cached_response TYPE REF TO if_http_response.
 data: bindata TYPE  XSTRING.
 data: xstring type xstring.
 data: size1 TYPE abap_msize.
 data: string type string.   CALL FUNCTION 'Z_PM_ORDER_PRINT_GET_PDF'     EXPORTING       i_aufnr                    = i_aufnr    IMPORTING      O_PDF                      = o_pdf      O_RETURN                   = o_return    EXCEPTIONS      SOMETHING_WENT_WRONG       = 1      OTHERS                     = 2             .   IF sy-subrc <> 0.
 * Implement suitable error handling here   ENDIF.  string = o_pdf.
 CALL FUNCTION 'SCMS_STRING_TO_XSTRING'   EXPORTING     text           =  string
 *   MIMETYPE       = ' '
 *   ENCODING       =  IMPORTING    BUFFER         = xstring  EXCEPTIONS    FAILED         = 1    OTHERS         = 2           .
 IF sy-subrc <> 0.
 * Implement suitable error handling here
 ENDIF.   CREATE OBJECT lo_cached_response     TYPE     cl_http_response     EXPORTING       add_c_msg = 1.
 *****set the data and the headers   lo_cached_response->set_data( o_pdf )."lv_pdf_xstring ).   lv_app_type = '.PDF'.   lo_cached_response->set_header_field( name = if_http_header_fields=>content_type                                      value = lv_app_type ).
 *****Set the Response Status   lo_cached_response->set_status( code = 200 reason = 'OK' ).
 *****Set the Cache Timeout - 60 seconds - we only need this in the cache
 *****long enough to build the page   lo_cached_response->server_cache_expire_rel( expires_rel = 60 ).
 *
 ****Create a unique URL for the object and export URL   CALL FUNCTION 'GUID_CREATE'     IMPORTING       ev_guid_32 = lv_guid.   CONCATENATE '/sap/public' '/' lv_guid '.' 'PDF' INTO e_url.
 ****Cache the URL   cl_http_server=>server_cache_upload( url = e_url                                        response = lo_cached_response ).



Re: Generate PDF file in backend, and "send" it to SAP Gateway

$
0
0

Hi Lars,

 

What Chandra is describing is nothing to do with Gateway

 

In order to expose a binary representation (such as a PDF or photo)  of a resource through OData you need to use the media streaming solution. The client can then use the appropriate handling for the Mime type.

 

The following code is the tail end of an example of a SAP Office document (which is a PDF) which has been read into table lt_hex - this is converted to binary which is placed in the stream. You need something similar to this in the GET_STREAM logic.

 

 

* not very useful code prior to this which fills lt_hex is omitted

 

data: ls_stream    TYPE         ty_s_media_resource.

   data: lv_solix type solix.

   data: lv_input type i.

 

   describe table lt_hex lines lv_input.

 

   read table lt_hex into lv_solix index lv_input.

 

   lv_input = ( ( lv_input - 1 ) * 255 ).

 

   lv_input = lv_input + xstrlen( lv_solix-line ).

 

   call function 'SCMS_BINARY_TO_XSTRING'

     exporting

       input_length = lv_input

*     FIRST_LINE   = 0

*     LAST_LINE    = 0

     importing

       buffer       = ls_stream-value

     tables

       binary_tab   = lt_hex

     exceptions

       failed       = 1

       others       = 2.

   if sy-subrc <> 0.

* Implement suitable error handling here

   endif.

 

   ls_stream-mime_type = 'application/pdf'.

 

   copy_data_to_ref( exporting is_data = ls_stream

                                    changing  cr_data = er_stream ).

Re: Generate PDF file in backend, and "send" it to SAP Gateway

$
0
0

Hi Lars,

 

Replies have "crossed in post", but as you can see, in my latest response the code is very similar. All you need to do is copy my example and drop all the cached response stuff.

 

Regards

 

Ron.

Re: File Attachment using gateway

$
0
0

Hello John,

 

I want to upload a file like PDF or DOC from ui5 to backend, using oData.

I created a gateway service.

I know that I must redefine create_stream method, but I don't know how to do that.

Do you have an example, how to write this method in abap?

 

Thank you,

Mari

Re: Unable to retrieve data with inside-out approach

$
0
0

Chandrashekhar Mahajan,

 

Facing few issues  executing the BAPI_EPM_SO_GET_LIST , requested my abap team to help on this.

 

In the mean while started to work with another  BAPI_FLIGHT_GETLIST which works well in our SAP system.

Build a SAPUI5 app with the AppBuilder consuming a NW Gateway service - series 1 of 2

 

The runtime objects are generated successfully, system is registered and made sure the services are activated.

 

but when executing the service in /IWFND/GW_CLIENT,with the activated service, only the $metadata query is successful, but not the others.Flights_Metadata.png

 

 

 

Facing 500 internal server Error  with FlightSet entity

Flights_FlightSet.png

 

Screenshot of the error log :

 

Flights_FlightSet_ErrorLog.png

Is this because of any missing in configuration / steps / patches on SP05 system ?

Re: Unable to retrieve data with inside-out approach

$
0
0

I performed same steps and created demo service. I am not getting any error and got the result for query /sap/opu/odata/sap/ZSCN_FLIGHTDEMO_SRV/FlightSet

 

but our system is SP08 and hence seems to be issue with some missing patch in your SP05.

 

looking at error, it seems to be problem with date time parameter. you can try without those fields or try with code based implementation as explained in my blog Let’s code CRUDQ and Function Import operations in OData service!

 

Regards,

Chandra

Re: Unable to connect to OData service from Eclipse Juno + Kepler

$
0
0

Hi Carlos,

 

that works with my Eclipse Kepler - thanks a lot. I still got some syntax errors in the code, but that´s another story, I am gonna look into it in the next two days.


Re: Getting error "Invalid or no mapping to system data types found" after sending file

$
0
0

Hi,

 

it was the reason for me. As stated in Enabling Media Links - SAP NetWeaver Gateway Foundation (SAP_GWFND) - SAP Library - Media type is only supported for feed and entry. You should redefine the method DEFINE() of the model provider extension class generated by the SB to avail the media link functionality.

So it seems that create_entity and get_entity_list works, but in order to make get_entity work you need to redefine MPC_EXT. And after create_entity you need to call get_entity in the code to get successful response from gateway after upload.

 

Best regards,

Peter

Re: Unable to retrieve data with inside-out approach

SEGW: Howto set subscribable with vocablary based annotations?

Re: Unable to install GWPA in HANA Studio Rev 72

$
0
0

Unable to install GWPA with Eclipse Juno.Please help me out.

 

Cannot complete the install because one or more required items could not be found.

  Software being installed: Toolkit for PHP (GWPA, Developer Edition) 1.1.1 (com.sap.odata.dt.cons.toolkit.php.feature.feature.group 1.1.1)

  Missing requirement: OData Model Validation 1.1.1 (com.sap.odata.dt.framework.model.validation 1.1.1) requires 'bundle org.eclipse.emf.validation 1.4.0' but it could not be found

  Cannot satisfy dependency:

    From: Toolkit for PHP (GWPA, Developer Edition) 1.1.1 (com.sap.odata.dt.cons.toolkit.php.feature.feature.group 1.1.1)

    To: com.sap.odata.dt.framework.core.feature.feature.group 0.0.0

  Cannot satisfy dependency:

    From: OData Modeler and Tools Core  (GWPA, Developer Edition) 1.1.1 (com.sap.odata.dt.framework.core.feature.feature.group 1.1.1)

    To: com.sap.odata.dt.framework.model.validation [1.1.1]

Re: File Attachment using gateway

$
0
0

upload_error.PNG

 

Hello Jibin Joy,

I did your example 'How to Upload and Download Files Using SAP NW Gateway SP06'.

I try to upload a photo in backend, with test transaction for gateway service , but I have an error.

I attach the error.

Can you help me with that?

 

Thank you,

Mari

Filter on date using variable

$
0
0

I have a variable for a date that is 60 days old called date60days.  I want to filter out any frequently used items from the launchpad gateway service where the last used date is greater than 60 days.  I am unsure how to utilize the variable in my filter.  I have tried the following:

 

$filter=myLastUsed gt datetime'" + date60days + "'&$orderby=myLastUsed desc",

 

I was able to do this in the javascript itself by using a condition on the for loop when adding the links as follows:

 

if (ostaticlinks[i].myLastUsed > date60days ) {

 

however, I'd rather filter this upfront rather than retrieving so much data from the backend.  Do I just not have the syntax correct for the $filter?

Re: Filter on date using variable

$
0
0

Hi Roger,

 

is variable date60days in this expected format 2014-05-14T15:08:40 ?

 

Regards,

Peter


Re: How to get HTTP headers from Data Provider Class?

$
0
0

Hello Atanu,

 

 

Thanks for the info. I was also not aware of that. Thanks again.

 

 

Regards,

Ashwin

Re: How to get HTTP headers from Data Provider Class?

$
0
0

Hi Yauhen,

 

 

do you have your users stored in SAP, or in some external system?

If they are in SAP, after login to netweaver gateway, you can access sy-uname in the backend and make your filter logic of products there.

 

 

Regards,

Peter

Re: How to get HTTP headers from Data Provider Class?

$
0
0

Hello Yauhen,

 

Please follow the code to get Headers like how Atanu has suggested and

implement Get_EntitySet and get all the products for that particular User.

 

Now the next question is how will you send table of users and get corresponding result ?

 

Since your approach is to send user name and password in the headers and use it to get list of products for that particular user,

even if you operate on BATCH for Query operation how will you send credentials of all those table of users in a single header ? You cannot set headers for all those users with their respective User Name and password correct ? Because Gateway does not support that.

 

Now its up to you how you would like to model your service and fire it

 

Regards,

Ashwin

PDF 417 Barcodes

$
0
0

Hello,

 

i have been trying to create a pdf417 type bar code which contains value more than one in a sapscript, but i couldnt find any good document, please help me, this is final step of my entegration project, we dont need print it we just send it as a fax, or mail, actually we found how to create and use in it but i could not give values,

 

 

I thank you for answers

Re: Configuring SAP Provided oData services

$
0
0

Hi Krishna,

 

Atanu is right. You either need to deploy either IW_CNT on systems prior to 7.40 and IW_FNDGC on 7.40 systems in the Hub.

 

The services themselves are in maintenance mode and are not developed further. That's why they have been packed in 7.40 in a separate AddOn and are not shipped as part of the 7.40 standard.

 

This is because we (SAP) do not plan to ship content via SAP NetWeaver Gateway but rather are shipping services as part of complete solutions such as SAP Fiori.

 

Though the customer can use the services I would recommend to develop your own services instead (the BAPI's hat have been used are listed in the SAP Online Help).

 

Another option if no development is wished would be to have a look at the applications that we are shipping with SAP Fiori.

 

Best Regards,

Andre

Viewing all 6105 articles
Browse latest View live


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