cancel
Showing results for 
Search instead for 
Did you mean: 

roblem with WS_DOWNLOAD

Former Member
0 Kudos

At use of function WS_DOWNLOAD in the module caused of JCO I receive a mistake: com.sap.mw.jco. JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Screen output without connection to user. In fact the file should enter the name on a computer with JCO? How with it to struggle?

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi Nick,

Hope you are aware of the point systems in SDN. Click on the below link to find more.

https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm

Please reward points for those posts that really helped you.

Thanks & Regards,

Kathirvel

Former Member
0 Kudos

Hi.

Thanks! It solves my problem.

Former Member
0 Kudos

Hi Nick,

Try this code i used RFC_READ_TABLE to fetch the data and create a new file by using java. Hope this is what you wanted to achieve using WS_DOWNLOAD.

/**

  • Project :SAPJCOTutorial

  • Date :Aug 23, 2005

  • Programmed By: Kathirvel Balakrishnan

  • Company : Wipro Technologies

  • Designation : Project Engineer

*/

package com.MyJCoPrograms;

import com.sap.mw.jco.*;

import java.io.*;

/**

  • DownloadFileUsingJCo

*/

public class DownloadFileUsingJCo {

public static void main(String[] args) {

// Necessary fields for Connection

JCO.Client myConnection = null;

JCO.Repository myRepository = null;

JCO.Function myFunction = null;

JCO.Field myDbTable = null;

JCO.Field myRowCount = null;

JCO.Table myData = null;

// Establishing a connection

try{

// Defining the connection parameters

myConnection = JCO.createClient("client","user","pass","EN","serverip","sys no");

myConnection.connect();

// Creating a repository

myRepository = new JCO.Repository("WIPRO",myConnection);

System.out.println("The Connection was established successfully");

}catch(Exception E1){

System.out.println(E1.toString());

System.exit(1);

}

// Getting the fuction module from the repository

try{

IFunctionTemplate myFunctionTemplate = myRepository.getFunctionTemplate("RFC_READ_TABLE");

myFunction = myFunctionTemplate.getFunction();

}catch(Exception E2){

System.out.println(E2.toString());

}

// Setting the host name and fetching the IP address

try{

myDbTable = myFunction.getImportParameterList().getField("QUERY_TABLE");

myDbTable.setValue("MAKT");

myRowCount = myFunction.getImportParameterList().getField("ROWCOUNT");

myRowCount.setValue("25");

myConnection.execute(myFunction);

myData = myFunction.getTableParameterList().getTable("DATA");

try{

BufferedWriter myFileWriter = new BufferedWriter(new FileWriter("d:/maktdatafile.txt"));

int size;

size = myData.getNumRows();

if (size == 0) {

System.out.println("No value matches the selection cretaria");

} else {

for (int i = 0; i <= size; i++) {

myData.setRow(i);

myFileWriter.write(myData.getString("WA"));

System.out.println(myData.getString("WA"));

myFileWriter.newLine();

}

System.out.println("The data was downloaded successfully");

}

myFileWriter.close();

}catch (Exception E4) {

// TODO: handle exception

System.out.println(E4.toString());

}

}catch(Exception E3){

System.out.println(E3.toString());

}

// Finally closing the connection

finally{

myConnection.disconnect();

}

}

}

and i got a file with the contents similar as

210000000000000000001EWORK FLOW FOR MATERIAL WORK FLOW FOR MATERIAL

210000000000000000005EWORK FLOW FOR MATERIAL 5 WORK FLOW FOR MATERIAL 5

210000000000000000006EWORK FLOW FOR MATERIAL 6 WORK FLOW FOR MATERIAL 6

210000000000000000007EWORK FLOW FOR MATERIAL 7 WORK FLOW FOR MATERIAL 7

210000000000000000008EAAASS11222 AAASS11222

210000000000000000009EAAAQQQ AAAQQQ

210000000000000000010EThis is mat THIS IS MAT

210000000000000000011EThis is mat THIS IS MAT

210000000000000000012E12 12

210000000000000000013Ework flow for MM test -1 WORK FLOW FOR MM TEST -1

210000000000000000021DTEST TEST

210000000000000000021Ework flow for MM test WORK FLOW FOR MM TEST

210000000000000000024Ebg BG

210000000000000000031Ework flow for MM test WORK FLOW FOR MM TEST

210000000000000000036Ekiran KIRAN

210000000000000000037EB747 B747

210000000000000000041Esatya SATYA

210000000000000000051Ework flow for mm test-51 WORK FLOW FOR MM TEST-51

210000000000000000051Ework flow for mm test-51 WORK FLOW FOR MM TEST-51

Let me know if this does not solve your problem.

Thanks & Regards,

Kathirvel

Former Member
0 Kudos

Hi

I cause WS_DOWNLOAD inside remote-enabled module... And in general who caused WS_DOWNLOAD from java?

Former Member
0 Kudos

WS_DOWNLOAD cannot be called via SAPJCO because it has dialog screen which only executes in foreground.

Former Member
0 Kudos

Hi,

Only RFC enabled function modules can be called using JCo.

That is problem.

Check this one you will get some idea,

/people/kathirvel.balakrishnan2/blog/2005/07/26/remote-enable-your-rfchosttoip-to-return-host-ip-to-jco

Cheers

Kathir~

Former Member
0 Kudos

Hi,

WS_DOWNLOAD does not RFC. Try to create a custom function module with RFC enabled feature and call this WS_DOWNLOAD in it. That will solve your problem.

Cheers

Kathir~

former_member187709
Active Participant
0 Kudos

Hi Nick,

Why dont you try putting a breakpoint in the FM WS_DOWNLOAD and see if it is being called by the code.

Cheers

Disha