cancel
Showing results for 
Search instead for 
Did you mean: 

Calling BAPI from java screen

Former Member
0 Kudos

Hi All

I want to develop Order entry form in PDK, in that i need to call BAPI...namely "BAPI_SALESORDER_CREATEFROMDAT2".

Can anybody send me the sample code...

pvpreddy@yahoo.com

Thanks for ur help

Pradeep

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pradeep,

Check out the following links to help.sap.com. It explains the procedure in detail.

http://help.sap.com/saphelp_nw04/helpdata/en/b6/55e3952a902447847066a0df27b0d6/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/11/e2bc3d9ecc6b3be10000000a114084/frameset.htm

This might be helpful to you.

Ranjith

Answers (1)

Answers (1)

Former Member
0 Kudos

In PDK you can import RFC modules. For that you have to create a jco connection. The code for calling an simple rfc ....

package com.satyam.callrfc;

import com.sap.mw.jco.JCO;

import com.sapportals.portal.prt.component.*;

public class rfc extends AbstractPortalComponent

{

private JCO.Client jcoClient;

// proxy for rfc you already assigned...

Insert_pgm_PortType insFunc=new Insert_pgm_PortType();

Zinsert_Pgm_Input ip=new Zinsert_Pgm_Input();

Zinsert_Pgm_Output op=new Zinsert_Pgm_Output();

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

this.connect();

insFunc.messageSpecifier.setJcoClient(jcoClient);

//setting input params

ip.setAssociate_Id1("44");

ip.setCourse_Objt1(2);

ip.setQlty_Content1(5);

ip.setSeq_Content1(2);

ip.setTraining_Id1("22");

try{

//calling rfc

op=insFunc.zinsert_Pgm(ip);

}catch(Exception e){}

//display output

response.write(op.getMessage());

this.disconnect();

}

private void connect() {

try {

jcoClient =

JCO.createClient("client","userid","password","EN","application_system","system_no");

jcoClient.connect();

} catch (Exception e) {

System.out.println("Error connecting to SAP ::" + e.getMessage());

e.printStackTrace();

}

}

private void disconnect() {

try {

jcoClient.disconnect();

} catch (Exception e) {

System.out.println(

"Error dis-connecting to SAP ::" + e.getMessage());

e.printStackTrace();

}

}

}

Hope this helps

gEorgE