Skip to Content
author's profile photo Former Member
Former Member

Web Service for BAPI_DOCUMENT_CHECKOUTVIEW2, which uses SAPFTP ?

Hi,

is it possible to create a Web Service from the function module BAPI_DOCUMENT_CHECKOUTVIEW2?

We have created a Web Service from this module and it works in SoapUI and WebDynpro.

The Web Service answers with:

<Return>
            <Type></Type>
            <Id></Id>
            <Number>000</Number>
            <Message></Message>
            <LogNo></LogNo>
            <LogMsgNo>000000</LogMsgNo>
            <MessageV1></MessageV1>
            <MessageV2></MessageV2>
            <MessageV3></MessageV3>
            <MessageV4></MessageV4>
            <Parameter></Parameter>
            <Row>0</Row>
            <Field></Field>
            <System></System>
</Return>

but the documents aren´t checked out.

There must be a problem with the SAPFTP (.exe)

To use this module as RFC in Java (JCo) the SAPFTP.exe must be allowed to start, is this possible over Web Services too?

Best regards

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2010 at 02:26 AM

    Hi Claus,

    The problem is that RFC destinations SAPFTP and SAPHTTP are both using SAPgui frontend functionality. You might want to try using RFC module SCMS_DOC_READ instead, as pointed out by Thomas here:

    Cheers, harald

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2010 at 08:30 AM

    Thanks Harald,

    the function module SCMS_DOC_READ is not remote-enable and so I can´t create a Web Service.

    If it were enable, I will have the problem to convert the binary data to a native PDF file.

    When I use the RFC Destination SAPFTP

    A

    it should work, because the FTP of the Application Server will be used, but is doesn´t work too.
    I have read something that I must use SAPFTP

    A

    as destination and should pass the parameter "hostname", but I don´t know what is meant with hostname (my local maschine name, AS name, IP address)?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      You're right - my bad. I got a bit sidetracked, because I had a longer exchange already, see here: .

      I still don't understand why the BAPI wants an FTP destination. In the previous chain that I posted, the very last poster claimed though to have gotten the BAPI working with SAPFTPA. Basically the SAPFTPA RFC destination points to a sapftp executable on the application server and thus doesn't involve the SAPgui.

      Sorry for the - pretty useless - answer. I hope somebody else will provide a more useful comment...

  • author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2010 at 12:12 PM

    no problem

    thanks a lot for your help

    i know that this is a difficult use case

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Here some code which works outside of SAPGUI for browser/BSP apps.

      METHOD load_doc_xstring.
      **********************************************************************
        DATA: lt_files2          TYPE STANDARD TABLE OF bapi_doc_files2,
              ls_files2          TYPE bapi_doc_files2,
              ls_return          TYPE bapiret2,
              lt_bin             TYPE STANDARD TABLE OF sdokcntbin,
              lt_inf             TYPE STANDARD TABLE OF scms_acinf,
              ls_inf             TYPE scms_acinf.
      **********************************************************************
      
        CALL FUNCTION 'BAPI_DOCUMENT_GETDETAIL2'
          EXPORTING
            documenttype    = documenttype
            documentnumber  = documentnumber
            documentpart    = documentpart
            documentversion = documentversion
            getdocfiles     = 'X'
          IMPORTING
            return          = ls_return
          TABLES
            documentfiles   = lt_files2.
        IF LINES( lt_files2 ) > 1.
          RAISE EXCEPTION TYPE zcx_root EXPORTING textid = 'MULTIPLE_FILES'.
        ENDIF.
        READ TABLE lt_files2 INTO ls_files2 INDEX 1.
        IF sy-subrc NE 0.
          RAISE EXCEPTION TYPE zcx_root EXPORTING textid = 'NO_FILES'.
        ENDIF.
      
        CALL FUNCTION 'SCMS_DOC_READ'
          EXPORTING
            stor_cat    = 'ZCR01'
            doc_id      = ls_files2-file_id
          TABLES
            access_info = lt_inf
            content_bin = lt_bin.
        READ TABLE lt_inf INTO ls_inf INDEX 1.
        IF sy-subrc NE 0.
          RAISE EXCEPTION TYPE zcx_root EXPORTING textid = 'NO_FILE_INFO'.
        ENDIF.
      
        " Convert XData to Xstring
        CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
          EXPORTING
            input_length = ls_inf-comp_size
          IMPORTING
            buffer       = contentx
          TABLES
            binary_tab   = lt_bin
          EXCEPTIONS
            failed       = 1
            OTHERS       = 2.
        IF sy-subrc NE 0.
          RAISE EXCEPTION TYPE zcx_root EXPORTING textid = 'BINARY_CONVERSION_ERROR'.
        ENDIF.
      
        filename = ls_inf-comp_id.
      
      ENDMETHOD.
      
      

      It seems you CAN'T use this BAPI outside of SAPGUI but must instead use SCMS_DOC_READ!

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.