cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_DOCUMENT_CHECKOUTVIEW2 with JCo3

Former Member
0 Kudos

Hey all,

i´m facing "little" problems with checking out documents via BAPI_DOCUMENT_CHECKOUTVIEW2 and JCo 3.0.2 (JCo 3.0.4 is not working, but thats another topic!)

We´re running a standalone Java server - one task is to check out documents. On our server, we don´t have any SAP-GUI installed, so i put the two files sapftp.exe and saphttp.exe to windows path variable.

What´s running fine with JCo 2.1.8 is failing now - without any error message!!! When i call the BAPI via se37 from another system, the checkout works fine, so the document is valid.

My coding is:

JCoFunction function = dest.getRepository().getFunction("BAPI_DOCUMENT_CHECKOUTVIEW2");

if(function!=null){

JCoParameterList importParameterList = function.getImportParameterList();

JCoStructure documentfile = importParameterList.getStructure("DOCUMENTFILE");

documentfile.setValue("APPLICATION_ID","4B0D068FFF20D611859800902761A739");

documentfile.setValue("FILE_ID","4E0D068FFF20D611859800902761A739");

documentfile.setValue("ORIGINALTYPE","2");

importParameterList.setValue("DOCUMENTTYPE","DES");

importParameterList.setValue("DOCUMENTNUMBER","TESTME");

importParameterList.setValue("DOCUMENTPART","000");

importParameterList.setValue("DOCUMENTVERSION","00");

importParameterList.setValue("GETSTRUCTURE","1");

importParameterList.setValue("GETCOMPONENTS","X");

importParameterList.setValue("GETHEADER","X");

importParameterList.setValue("ORIGINALPATH","D:

TEMP

SAP

");

importParameterList.setValue("HOSTNAME","abcdefg");

importParameterList.setValue("PF_FTP_DEST","SAPFTPA");

importParameterList.setValue("PF_HTTP_DEST","SAPHTTPA");

function.execute(dest);

........

Unfortunately, i don´t get any results! Is checking out generally possible with JCo3?

I would be very grateful for any help you would offer to me on this subject.

regards ... Ralf

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Harald,

thanks a lot for you tips. They really helped!

I managed to get JCo 3.0.4 running. Therefore i installed Microsoft Security Bulletin MS09-035

http://www.microsoft.com/germany/technet/sicherheit/bulletins/ms09-035.mspx, as you mentioned.

With the newest SAP kernel release, i receive the requested document information from table documentfiles, but i still cannot checkout any file. The error message is "Datei D:TEMPSAP est.dwg kann nicht angelegt werden". I tried it stateful and stateless - it doesn´t make any difference in my case. But i think i´m facing network problems.

Gateway monitor (smgw) says:

******************************************************************************

***LOG Q0I=> NiIRead: recv (10054: WSAECONNRESET: Connection reset by peer)

      • ERROR => NiIRead: SiRecv failed for hdl 21 / sock 676

(SI_ECONN_BROKEN/10054; I4; ST; 10.50.30.91:2167)

***LOG S23=> GwIDisconnectClient, client disconnected (143)

***LOG S74=> GwIDisconnectClient, client disconnected ( DE258389)

***LOG S0R=> GwIDisconnectClient, client disconnected ()

***LOG S0I=> GwIDisconnectClient, client disconnected ( javaw)

*****************************************************************************

*

  • LOCATION SAP-Gateway on host de254070 / sapgw00

  • ERROR connection to partner 'deABC.test.net:2167' broken

*

  • TIME Fri Jan 29 11:41:55 2010

  • RELEASE 701

  • COMPONENT NI (network interface)

  • VERSION 38

  • RC -6

  • MODULE nixxi.cpp

  • LINE 4436

  • DETAIL NiIRead

  • SYSTEM CALL recv

  • ERRNO 10054

  • ERRNO TEXT WSAECONNRESET: Connection reset by peer

  • COUNTER 389

*

*****************************************************************************

and Syslog (sm21) says:

Betriebssystem Aufruf recv gescheitert (errno 10054)

Verbindung zu CPIC-Client 144 abgebaut

Partner LU Name: DE2

Host 10.51.31.191

Partner TP Name: javaw

Betriebssystem Aufruf recv gescheitert (errno 10054)

Kommunikations-Fehler, CPIC-RC=020, SAP-RC=223

Conversation-ID: 64324940

CPIC-Funktion: CMSEND(SAP)

Verbindung zu CPIC-Client 143 abgebaut

Partner LU Name: DE2

Host 10.51.31.191

Partner TP Name: javaw

Kommunikations-Fehler, CPIC-RC=020, SAP-RC=223

Conversation-ID: 64323657

CPIC-Funktion: CMSEND(SAP)

Fehlt:TSL1T(D,EMF):

Fehlt:TSL1T(D,EME):GRC_BATCH 800

Fehlt:TSL1T(D,EME):Job: /VIRSA/ZVFATBAK

Transaktions-Abbruch 00 560 ( GRC_BATCH 800 )

I´m thankful for any further tips!

regards ... Ralf

Former Member
0 Kudos

Hi Ralf,

unfortunately I don't fully understand how your checkout works. The comment about stateful versus stateless is only meaningful if you actually execute more than one RFC and they should be all in the same session.

I'm also a bit confused, does the BAPI return the error message Datei D:\TEMP\SAP\test.dwg kann nicht angelegt werden? Where is this supposed to happen on your presentation server or on the application server? With JCo 2.x this worked fine, does it still work when you switch between the 2.x and the 3.x version? Did you compare all the coding to ensure that everything actually is the same (due to the API changes you must've made some changes, maybe there's somewhere a small difference in the coding)?

I think its first better to check out the BAPI and focus later on the gateway log. Can you switch on tracing on your client via JCo.setTrace(level,path) method and see if that yields anything useful on client side.

One other problem with the JCo 3.x version was initially the support for starting SAPgui sessions. With the 3.0.4 version this should work assuming that your backend fulfills certain conditions (I think it was certain kernel patch levels). Maybe you should try running the BAPI via SE37 and check if the result is different. Debugging might also be an option, depending on your backend you could even do that via JCo...

Cheers, harald

Former Member
0 Kudos

Hello Harald,

after a long relaxing weekend i´m facing the same problems.

Today i tried again: With JCO2 everthing is running fine, with JCO3 (on the same server,with sam environment) the checkout fails.

I also have installed a process monitoring tool. I can see, that there is no sapftp or sapftp called with JCO3.

I think, thats the problem. There is no "allow_start_of_programms" property as in JCo2. Is it generally possible to call sapftp or saphttp with JCo3? Or do i maybe have a bad combination of required libs?

ragards ... Ralf

Edited by: Ralf Boehringer on Feb 3, 2010 7:41 AM

Former Member
0 Kudos

Hi Ralf,

Can it be that you are using an SAP Router?

The SAP Note 63347 has a list of CPIC Error codes. Your error (CPIC 020) is "CM_PRODUCT_SPECIFIC_ERROR". Which basically doesn't help me much with the explanation

Thats the reason I was guessing that you have an SAP Router. Maybe the way you communicate with an SAP Router when using JCo3 is different...I'm unforunately not familiar with the JCo3 API.

T00th

Former Member
0 Kudos

Hi Ralf,

I think I finally start to understand what might be the cause for your problem. As I'm not familiar with the function BAPI_DOCUMENT_CHECKOUTVIEW2 I had to do some research, so here's what I think. For some reason the BAPI uses saphttp/sapftp (e.g. seeOSS note 432881|https://service.sap.com/sap/support/notes/432881]). As far as I understand both those destinations are linked to SAPgui connections and thus require starting of a SAPgui.

Seems weird though, because you seem to report different problems. I did a quick test with a custom function module that simply invokes HTTP_GET on destination SAPHTTP. With JCo2 I get it to work as soon as I set property jco.client.use_sapgui to 1 or 2. On JCo3 I get an exception complaining about missing function module SYSTEM_PREPARE_ATTACH_GUI. For JCo3 the starting of SAPgui was initially broken and I think they fixed it with version 3.0.1. However, the backend also has to support it, the necessary patches and support levels are described in [OSS note 1258724|https://service.sap.com/sap/support/notes/1258724].

Not sure if this is of any help. As I didn't have time to look into more detail into the BAPI, it might help if you share your knowledge as to why the saphttp/sapftp destinations are required for the checkout/display BAPI (not obvious to me).

By the way, setting the middleware property jco.middleware.allow_start_of_programs didn't seem required with my simple test on using HTTP_GET on destination SAPHTTP with JCo2. Only the starting of the SAPgui (visible or invisible) seemed required, without it and setting the middleware property I still got errors (RFC_ERROR_SYSTEM_FAILURE: / FUNCTION: 'exec_sapgui' cannot open SAPGUI). Via my personal firewall I also see nicely the start of SAPhttp.exe when allowing SAPgui usage via JCo2.1.8.

Cheers, harald

Former Member
0 Kudos

Hi all,

first thanks for your answers.

On our server, we don´t have a SAP GUI, so with JCo2, we set the property "allow_start_of_programs"="sapftp,saphttp". We copied all necessary exe -and dll-files to our environment and that was working fine.

Deep in my CPIC-trace i found yesterday a message something like "ERROR COMMAND sapftp -a........".

I think i did already waste too much time in this topic! A little research in sdn guided me to

Transfering files as table seems to me the better way. It´s independent of any underlaying OS and additional applications (sapftp,...) are no longer needed.

Unfortunately it´s much impact for our development.

But i´m still interested in this topic!

regards ... Ralf

Former Member
0 Kudos

Ok, looks like I'll be left puzzled as to why the HTTP/FTP RFC destination is needed. But based on your comments and the posting that you referenced I'd suspect you might get away with just replacing SAPHTTP with SAPHTTPA and SAPFTP with SAPFTPA. Those *A destinations are the counterpart on the application server for the destinations invoked on the frontend. A short comment in the SAP help can be found [here|http://help.sap.com/saphelp_nw2004s/helpdata/en/14/d9ad3cf7ca0855e10000000a114084/frameset.htm]. But it looks like you know how to fix it...

Former Member
0 Kudos

Hello Ralf / Harold,

I understand SAP has disabled call backs in SAPhttp and sapftp from JCO3 onwards for security reasons. I believe they have been working hard on restoring security but that was more than a year ago. I dread they have given up on working to restore this functionality altogether. Because it is still inactive in the latest JCO release.

Have you found any work around for this?

Former Member
0 Kudos

Hello Ryan,

we implemented our own ABAP-BAPI, that transfers a file as an internal table. To avoid memory problems with large files (>100 MB), we split the file on SAP-server and we merge it on java side. I implemented a protype and first tests were fine. Next, i want to test multithreaded file transfer with files ~ 1GB.

regards ... Ralf

Former Member
0 Kudos

Hi,

Converting files to internal tables is great but I presume it wouldn;t be possible for me to apply it for my application which would incude a *.bmp or a *.jpg. Or is there a way of applying this in your technique?

Former Member
0 Kudos

Hi Ryan,

in ABAP we do the following:

open DATASET SOURCE for input in BINARY MODE.

  • Read Dataset source into String_DATA.

READ DATASET source into DATA.

..... append DATA

with:

SOURCE LIKE BAPI_DOC_AUX-FILENAME

table: DATA STRUCTURE SDOKCNTBIN

The DATA-table can now be transfered with JCo as table parameter.

I think this should work with bmp´s, ... too.

regards ... Ralf

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Harald,

thanks a lot for you tips. They really helped!

I managed to get JCo 3.0.4 running. Therefore i installed Microsoft Security Bulletin MS09-035

http://www.microsoft.com/germany/technet/sicherheit/bulletins/ms09-035.mspx, as you mentioned.

With the newest SAP kernel release, i receive the requested document information from table documentfiles, but i still cannot checkout any file. The error message is "Datei D:TEMPSAP est.dwg kann nicht angelegt werden". I tried it stateful and stateless - it doesn´t make any difference in my case. But i think i´m facing network problems.

Gateway monitor (smgw) says:

******************************************************************************

***LOG Q0I=> NiIRead: recv (10054: WSAECONNRESET: Connection reset by peer)

      • ERROR => NiIRead: SiRecv failed for hdl 21 / sock 676

(SI_ECONN_BROKEN/10054; I4; ST; 10.50.30.91:2167)

***LOG S23=> GwIDisconnectClient, client disconnected (143)

***LOG S74=> GwIDisconnectClient, client disconnected ( DE258389)

***LOG S0R=> GwIDisconnectClient, client disconnected ()

***LOG S0I=> GwIDisconnectClient, client disconnected ( javaw)

*****************************************************************************

*

  • LOCATION SAP-Gateway on host de254070 / sapgw00

  • ERROR connection to partner 'deABC.test.net:2167' broken

*

  • TIME Fri Jan 29 11:41:55 2010

  • RELEASE 701

  • COMPONENT NI (network interface)

  • VERSION 38

  • RC -6

  • MODULE nixxi.cpp

  • LINE 4436

  • DETAIL NiIRead

  • SYSTEM CALL recv

  • ERRNO 10054

  • ERRNO TEXT WSAECONNRESET: Connection reset by peer

  • COUNTER 389

*

*****************************************************************************

and Syslog (sm21) says:

Betriebssystem Aufruf recv gescheitert (errno 10054)

Verbindung zu CPIC-Client 144 abgebaut

Partner LU Name: DE2

Host 10.51.31.191

Partner TP Name: javaw

Betriebssystem Aufruf recv gescheitert (errno 10054)

Kommunikations-Fehler, CPIC-RC=020, SAP-RC=223

Conversation-ID: 64324940

CPIC-Funktion: CMSEND(SAP)

Verbindung zu CPIC-Client 143 abgebaut

Partner LU Name: DE2

Host 10.51.31.191

Partner TP Name: javaw

Kommunikations-Fehler, CPIC-RC=020, SAP-RC=223

Conversation-ID: 64323657

CPIC-Funktion: CMSEND(SAP)

Fehlt:TSL1T(D,EMF):

Fehlt:TSL1T(D,EME):GRC_BATCH 800

Fehlt:TSL1T(D,EME):Job: /VIRSA/ZVFATBAK

Transaktions-Abbruch 00 560 ( GRC_BATCH 800 )

I´m thankful for any further tips!

regards ... Ralf

Former Member
0 Kudos

Hi Ralf,

as I'm not familiar with that particular BAPI, I can only throw in some general comments. It might be helpful if you provide some further information...

JCo 3.0.4 should work, I had some problems when initially using it; please check out my comments in . Hopefully that does the trick.

As far as the BAPI is concerned, your pasted coding just shows the preparation of the function call execution, but not what you do after you called the function. Since your coding doesn't seem to create the expected results, this part is actually important. However, let me add one quick remark: One big difference between JCo 2.x and 3.x is that with 3.x all RFC function calls are now by default stateless, i.e. executed in a new context. With any BAPI calls that do updates this is usually a problem, because you have to add a BAPI_TRANSACTION_COMMIT after the invocation of the first call, which is then executed in a new context and thus no updates happen.

To get stateful calls one has to use the method call JCoContext.begin(dest) at the start of the context and JCoContext.end(dest) at the end of the context (so your function.execute(dest) calls would be in between those method invocations).

If this doesn't help, maybe somebody else has some better suggestions or you could try posting more details.

Cheers, harald