cancel
Showing results for 
Search instead for 
Did you mean: 

Import JCO.MetaData structure definition from SAP repository

former_member185943
Participant
0 Kudos

Hello!

I am working on ABAP-calls-JCo program and would like to pass a large structure as export parameter to JCo. For example, BSEG. For this, I need a structure definition JCO.MetaData in JCo server.

Using

meta.addInfo("MANDT",...); meta.addInfo("BUKRS,...);

is ofcourse out of question because I won't manually create 305 fields.

I can't get the structure definition from the SAP function, because there's no function (remember: SAP is calling, not being called).

I'd need something in JCo to import JCO.MetaData structure definition directly from SAP repository.

Thanks in advance for your help!

Regards,

Igor Barbaric

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Igor,

this is not a problem. Simply create a repository via and link it to your SAP system (i.e. check the static methods createRepository from class JCO and use one, where you pass a client or client pool). Once you have the repository (i.e. interface IRepository) you can call the method getStructureDefinition, which will return the IMetaData object for your structure.

Best wishes, harald

former_member185943
Participant
0 Kudos

Thanks, Harald!

It works - you're great.

However, since in this program SAP is a client and JCo server, I'd be a little bit happier with SAP sending a structure def to JCo, rather than JCo asking it from SAP. The reason for this is that I'd like to avoid JCo server having user account at SAP.

Is there a (nice) way to do this?

Thanks!

Kind regards,

Igor

Former Member
0 Kudos

Hi Igor,

interesting approach. You should check out the RFC function module RFC_GET_STRUCTURE_DEFINITION; this is used by the JCo to retrieve the Metadata for a structure from SAP. I guess you could implement this function on your RFC server program to convert the corresponding input to MetaData and store it in the repository.

However, I'm assuming that your RFC server program is probably not really generic (since you have to implement the handling of the invoked functions/IDoc processing anyhow).

You might want to try the following approach: Write a small client program that retrieves all the metadata from the RFC functions/structures that you want to use (to get all MetaData for an RFC function along with the structures use method getFunctionTemplate of interface IRepository). Once you have all definitions use method save of IRepository. On your RFC server simply read the saved repository data again by using method load.

This is not really dynamic and doesn't account for structure changes in SAP. Also, so far I haven't found any indicator as to how many structures are being cached by the repository and if JCo has any logic to automatically remove them from the Cache. Let me know if you find anything.

Best wishes, harald

former_member185943
Participant
0 Kudos

Harald!

Although this is not exactly-exactly what I needed, it's still a decent solution and you earned your points.

Thanks!

Regards,

Igor

Former Member
0 Kudos

Hi Harald.

Is there a way to connect you directly? (via email?)

I'm fiddling arround with this problem, and i can't find

a working solution.

I think my problem is far away from this thread, so a direct connection would be the best way.

Please send your mail address to: ehe(at)itml.de

Thank you very much.

Erik

Answers (0)