0

I followed the SDK course and the blog. It was possible for me through the business partner to do a read operation. Now I have my own service and want to use the generated VDM data to easily send data to my SAP system via an update.

    @Override    
protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
        throws ServletException, IOException {
    try {

        BarcodeFile barcode1 = new BarcodeFile();
        barcode1.setDATA("VGVzdA==");
        barcode1.setDokumentyp("TXT");
        barcode1.setDokId("18032019");

                new DefaultUploadService() 
                .createBarcodeFile(barcode1)            
                .execute();

        response.setContentType("application/json");
        response.getWriter().write(new Gson().toJson(barcode1));


    } catch (final ODataException e) {
        logger.error(e.getMessage(), e);
        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        response.getWriter().write(e.getMessage());
    } 

I am in training and so I have little experience. I also found no blog / document which helps me. Thank you for your efforts

Markus
  • 1
  • What do you mean by "I followed the SDK course and the blog.."? – Wulf Mar 19 '19 at 06:47
  • 2
    @Wufo: I think what he means is the [OpenSAP course](https://open.sap.com/courses/s4h13) and the [blog post series](https://blogs.sap.com/2017/05/10/first-steps-with-sap-s4hana-cloud-sdk/). – Christoph Schubert Mar 19 '19 at 07:22
  • 1
    @Markus: In general I would assume that [this post](https://blogs.sap.com/2018/04/30/deep-dive-10-with-sap-s4hana-cloud-sdk-generating-java-vdm-for-s4hana-custom-odata-service/) should help you get started. In general you should have an `updateBarcodeFile` method with which you could update an existing `BarcodeFile` entity. On a side note: you should use the `BarcodeFile` returned by the `execute` method call to write into the response to see the actually created entity. – Christoph Schubert Mar 19 '19 at 07:26
  • Hello many thanks for your quick answers. My service works. There was a problem at the SAP backend. (@)Wufo : yes I meant the [OpenSAP Course](https://open.sap.com/courses/s4h13) and [blog post series](https://blogs.sap.com/2017/05/10/first-steps-with-sap-s4hana-cloud-sdk/) @ChristophSchubert : I have read the deep-dive-10 post but did not understand how should i build my query. It was important to know if im on the right way. And now its working ;) thx to all – Markus Mar 20 '19 at 12:57
  • Glad I could help! Can you then kindly add an answer? That way we know that this question does not need attention any more. – Christoph Schubert Mar 20 '19 at 14:23

1 Answers1

0

Ah this is the way to close this thread. Many thanks for the helping me to solve this issue. My code is working fine. Greetings Markus

Markus
  • 1