Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8735

Calling RFC from Java Program?

$
0
0

Hello Experts,

 

I'm trying to call a simple RFC from ERP backend in my java program. I did all the setup in my local eclipse tool and able to run sample programs provided by SAP (i.e StepByStepClient.java & StepByStepServer.java) and got familiar a little bit on how it works.

 

I'm having bit trouble in understanding JCo API and coding it appropriately. Would anyone please provide me the code for my requirement.

 

This is my RFC:

 

RFC Name: Z_ASTU_GET_SUBSCRIPTIONS

Export Parameters:

Parameter Name: ELIGIBLE_LIST

Typing: TYPE

Associated Type: ZSU_EXISTING_SUBSCRIPTIONS (Table Type)

Line type: ZSSU_EXISTINGSUBSCRIPTIONS

Structure: ZSSU_EXISTSUBS; again it has some 50 fields.

Tables:

BLANK

 

How do I read/iterate this RFC into my java code? Please help with some code snippet on iterating or looping through this Export parameters.

 

This is what I tried but No Luck.

 

 

System.out.println(" List Details: " + function.getExportParameterList().getListMetaData().); 

OUTPUT:  

ELIGIBLE_LIST,ZSU_EXISTING_SUBSCRIPTIONS,h,0,0,290,574,0, ,Existing Subscriptions Table Type,EXPORT,OPTIONAL

JCoTable exportTable1 = function.getTableParameterList().getTable("ELIGIBLE_LIST");

OUTPUT: NullPointerException. I suspect such as this might not be a tabletype or incompatiable type.

System.out.println("Export Table1 " + exportTable1.getMetaData() + ":\n"); 

JCoStructure exportStructure = function.getExportParameterList().getStructure("ZSU_EXISTING_SUBSCRIPTIONS");

OUTPUT: Cannot convert Table type to Structure Record. I suspect such as this also related to incompatiable types. 

System.out.println("System info for " + exportStructure.getMetaData().getFieldCount() + ":\n"); 

 

Check attached screenshot of RFC. When I double click on ZSU_EXISTING_SUBSCRIPTIONS, It is opening a Dictionary screen with some info. Particularly a tab called "Line Type" is having "ZSSU_EXISTSUBS", when I double clik on it, then it is displaying a Structure screen with some fields info.

Thanks

VB


Viewing all articles
Browse latest Browse all 8735

Trending Articles