cancel
Showing results for 
Search instead for 
Did you mean: 

How to access BAPI in enterprise portal perspective?

Former Member
0 Kudos

hi,I am venkat new to the portal.can anyone plz tel me how to access BAPI in enterprise portal perspective?is done through JCo or any other database connection?I hav not seen in System Landscape about BAPI access.plz give guidance about BAPI interface in enterprise portal.Hope u will understand the question and answer the query.

thanx in advance.

Regards:

Venkataramana.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Please try to do this way -

Use the IView template for SAP RFC Iview to call that BAPI. Provide the Function grooup name and FM name then call that BAPI in your portal applicaiton.

Function group name -

SAPBC_BAPI_SFLIGHT

Function name -

BAPI_FLIGHT_GETLIST

And press the Next button then it provdies you the Input fields

Airline -  AA
Destination From - 
Destination To -
Input/Output - select the FLIGHT_LIST table

and preview the Iview we can see the details in the table.

This way we can call the RFC without using any WD application.

Create an Transaction Iview in the EP and in that Tcode- use the SE37 and give the BAPI name where we can run the BAPI FM.

Regards

Lekha

Answers (4)

Answers (4)

former_member189631
Active Contributor
0 Kudos

Venkat,

There are many ways to access the BAPI into SAP EP.

1. Web Dynpro for Java

2. Web Dynpro fot ABAP

3. Visual Componser

4. SAP Transaction iView

5. Portal Component

Web Dynpro for Java

  • In this NWDS tool is required to develop Web Dynpro for Java applns to access BAPI.

  • You have to create Adaptive RFC Model

  • Supports Rich UI elements

  • Java skill is required

  • Have to create and maintain JCO

Web Dynpro fot ABAP

  • In this you can use SE80 Tcode to develop Webdynpro ABAP based applications

  • You have to create a service call

]* Supports Rich UI elements

  • ABAP skill is required

Visual Componser

  • Code free development

SAP Transaction iView

  • You can directly show the se37 transaction to display the bapi data. But wont support data display in UI (such as textelements, Tables etc)

or

  • Create a Report to display the BAPI data

  • Assign the report to a Transaction

  • Create a SAP Transaction iView

Portal Component

  • Create a Portal component in NWDS and write a java code to connect the SAP system

I would suggest

If you want to display the data with rich UIs,

Visual Composer -> Webdynpro for Java/ABAP -> Portal Component

otherwise use

SAP Transaction iView

Ramganesan Karuppaiyah

Former Member
0 Kudos

Hi Venkat ,

BAPI is function module . You cannot call directly a Bapi from portal perspective.

If You are developing webdynpro application , you can use jco destinations to call BAPIs.

Use JCA/JCO methods if you are calling from portal components.webdynpro........ not directly from enterprise portal iviews.

Koti Reddy

Former Member
0 Kudos

Hello Venkat,

I am also agreed with Jigar

Kindly have alook atthis discussion hope the last three reply's can guide u.

[Link 1|;

Regards.

Soni Vinit

Former Member
0 Kudos

Guys,

Herez how you call a BAPI:


	public void buildConnection(){
		try {
      
				System.out.println("**** DI2 *****");
			  // 	Add a connection pool to the specified system
			  //    The pool will be saved in the pool list to be used
			  //    from other threads by JCO.getClient(SID).
			  //    The pool must be explicitely removed by JCO.removeClientPool(SID)
			    com.sap.mw.jco.JCO.addClientPool( SID,         // Alias for this pool
								 10,          // Max. number of connections
								 "040",       // SAP client
								 "USERNAME",   // userid
								 "PASSWORD",  // password
								 "EN",        // language
								 "IPADDRESS",// host name
								 "40" );

			  // 	Create a new repository
			  //    The repository caches the function and structure definitions
			  //    to be used for all calls to the system SID. The creation of
			  //    redundant instances cause performance and memory waste.
      
			    repository = com.sap.mw.jco.JCO.createRepository("MYRepository", SID);
			
				JCO.Client client = null;
				client = JCO.getClient(SID);

//			  Get a function template from the repository
				//IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_CUSTOMER_GETDETAIL2");
				IFunctionTemplate ftemplate = repository.getFunctionTemplate("YGGLB_BAPI_YGGLB9PRK_PRKDOCU");
	
//			  Create a function from the template
				JCO.Function function = ftemplate.getFunction();
			
//			  Get import (of Function Module) "Parameter list"
				JCO.ParameterList input = function.getImportParameterList();
			
//			  Set inputs for import parameters
				//input.setValue("0000009000", "CUSTOMERNO");
				//input.setValue("0248","COMPANYCODE");
		
//			  Get import (of Function Module) "Structure list".
			    //JCO.Structure importStructure = function.getImportParameterList().getStructure("CUSTOMERADDRESS");
				JCO.Structure importStructure = function.getImportParameterList().getStructure("IM_DOCUMENTHEADER"); 
				
//			  Set values for import parameters (of Function Module) "Structure list" 				
				importStructure.setValue( "SA", "DOC_TYPE" );
				importStructure.setValue( "20080910", "PSTNG_DATE" );
				importStructure.setValue( "20080910", "DOC_DATE");
				importStructure.setValue( "BHARDWS", "USERNAME" );
				importStructure.setValue( "2008", "FISC_YEAR" );
				importStructure.setValue( "FRE1", "COMP_CODE" );

				
//			  Get import (of Function Module) "Table list - 1".
				JCO.Table orderPartners = function.getTableParameterList().getTable("TBL_ACCOUNTGL");

//			  Set values for import parameters (of Function Module) "Table list - 1" 
				//Append Row -1
				orderPartners.appendRow();
			    orderPartners.setValue("0000000001", "ITEMNO_ACC" );
			 	orderPartners.setValue("0000400100", "GL_ACCOUNT" );
				orderPartners.setValue("H", "DE_CRE_IND" );
				orderPartners.setValue( "ANYTHING", "ITEM_TEXT" );
				//orderPartners.setValue( "AG", "PROFIT_CTR" );
				orderPartners.setValue( "AIG0000007", "COSTCENTER" );
				//Append Row -2
				orderPartners.appendRow();
			    orderPartners.setValue("0000000002", "ITEMNO_ACC" );
				orderPartners.setValue("0000400100", "GL_ACCOUNT" );
				orderPartners.setValue("S", "DE_CRE_IND" );
				orderPartners.setValue( "NOTHING", "ITEM_TEXT" );
				//orderPartners.setValue( "AG", "PROFIT_CTR" );
				orderPartners.setValue( "AIG0000007", "COSTCENTER" );

//			  Get import (of Function Module) "Table list - 2".
				JCO.Table orderItems = function.getTableParameterList().getTable("TBL_CURRENCYAMOUNT");

//			  Set values for import parameters (of Function Module) "Table list - 2" 
				//Append Row -1
				orderItems.appendRow();
			    orderItems.setValue("0000000001", "ITEMNO_ACC" );
				orderItems.setValue("USD", "CURRENCY" );
				orderItems.setValue( "2000", "AMT_DOCCUR" );
				//Append Row -2
				orderItems.appendRow();
			    orderItems.setValue("0000000002", "ITEMNO_ACC" );
				orderItems.setValue("USD", "CURRENCY" );
				orderItems.setValue( "2000", "AMT_DOCCUR" );
				
//			  Execute client
				client.execute(function);

//******************Start to work on fetching values now********************************

//			  Get export (of Function Module) "Structure list".
				/*JCO.Structure returnStructure = function.getExportParameterList().getStructure("CUSTOMERADDRESS");
				JCO.Structure returnStructure2 = function.getExportParameterList().getStructure("CUSTOMERGENERALDETAIL");
	
				returnStructure.getString("NAME");
				returnStructure2.getString("ENTERED_BY");*/


//			  Get export (of Function Module) "Table list"./// Create a new template if fetching table data from a different function module than above
				//IFunctionTemplate ftemplateTable = repository.getFunctionTemplate("BAPI_CURRENCY_GETLIST");
				//JCO.Function functionTable = ftemplateTable.getFunction();
				//client.execute(functionTable);
		
		
				JCO.Table table_return = function.getTableParameterList().getTable("RETURN");

		
				Vector tbl = new Vector();
				Vector row = new Vector();
				Vector colNames = new Vector();
					
					
				//Loop over all rows
				do {
				//Loop over all columns in the current row and add all those colums values to the current row
				for (JCO.FieldIterator e = table_return.fields();
					e.hasMoreElements();
					) {
					JCO.Field field = e.nextField();
					row.add(field.getString());
					System.out.println(field.getName() + ":\t" + field.getString());
					} // end for
					//Add this newly built row to the table	
					tbl.add(row);
					} while (table_return.nextRow());

					table_return = null;
					table_return = function.getTableParameterList().getTable("RETURN");

					table_return.nextRow();
					for (JCO.FieldIterator e = table_return.fields();
					e.hasMoreElements();
					) {
					JCO.Field field = e.nextField();
					colNames.add(field.getName().toString());

					}

				//DefaultTableViewModel dtvModel = new DefaultTableViewModel(tbl, colNames);
				//beanObj.setModel(dtvModel);
	
	
					System.err.println("getting value for you from session in Get Data 1:-");
					JCO.releaseClient(client);

				//	return dtvModel;
			  
			  
			 
			}
			catch (JCO.Exception ex) {
			  System.out.println("Caught an exception: \n" + ex.getMessage());
			}catch (Exception e){
				System.out.println("Final Message" + e.getMessage()); 
			}
	  }

Former Member
0 Kudos

I would suggest you use JCA, instead of JCO.

SB

Former Member
0 Kudos

Hi,

It is very simple to call BAPI within SAP EP if you have knowledge of WebDynpro. You will need to create ABAP WebDynpro for it.

Refer following link (Tutorial 2 for BAPI Usage).

Regards,

Jigar Oza

Former Member
0 Kudos

hi Jigar,

Can u plz tell me how is it in enterprise portal perspective not in webdynpro.If u know any standard way or some developing needed in that.Hope u answer the question.

Thanx in advance.

Regards:

Venkataramana.

Former Member
0 Kudos

Hi,

I think u need the standard way like to create some iView or something..

But according to my knowledge i dont think it would be poss,

because BAPI is somethink like function module where we provide input and get some output and there is interaction with database also.

So we need some screen to provide input like textbox and something.. so you will need to develop where it would interact with backend and display you with output.

in short you need to develop component.

Correct me anyone..if any one has better idea than this!!!!

Regards,

Jigar Oza