cancel
Showing results for 
Search instead for 
Did you mean: 

problem with Type Reference "TYPE' in JCO

Former Member
0 Kudos

Hi All,

I am facing a weard situation when i am creating a custom RFC function module. This FM is called by Java program with JCO. But, if i define the FM parameters with Reference type as 'TYPE', the Java application is not able to get the data. But the same time, if i declare the parameters with 'LIKE', it is working successfully.

Can anybody advise me, why it is behaving differently? Is the problem with JCO which is not able to recognise the 'TYPE' reference or from SAP side?

And, any solution to use 'TYPE' reference successfully?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Sailesh,

Welcome to SDN!

the key word TYPE is used for Native Datatypes in ABAP. you give TYPE string/integer etc...

If you are refering to a Field name or a table or any other internal table you give LIKE.eg: name LIKE ZTABLE-NAME...

in the case of your FM+JCO combo, you are probably refering your Export fields to a Structure or internal table. So in this case you have to give LIKE not TYPE.

Hope this cleared..

Regards

Arun.

Former Member
0 Kudos

Hi Arun,

Thanks for the helpful info. But one thing i didnot understand, why we should give only LIKE? why can't give 'TYPE' since that is an essential code standard now a days. My company restricts me to use only 'TYPE'.

Yes, i am using the structure in Export fields. Is JCO does not recognise the structure if we use 'TYPE'? One point i observed is, when we are using 'LIKE', it is creating the Work Area in SAP, but not with TYPE. Is JCO always looks into WA and not in the body?

We do not have issues to change the code from Java side.

can you help me if you have any idea?

Former Member
0 Kudos

hi Sailesh,

You are right. SAP doesn't recommend the usage of Like in PROGRAMS/REPORTS - mind it, only REPORTS.

But when it comes to RFC enabled FMs, JCo Understands only LIKE. what you had observed is true. LIKE creates a WA and JCo looks into a workarea. TYPE can refer to a pool of variables but your JCo can't differentiate them. So, you use LIKE.

Again, you use LIKE only Remote enabled FMs not in Reports/Programs. so, you may use TYPE as your company remommends in reports but in RFMs, use LIKE.

Hope this cleared.

Regards

Ak.

PS: If my post helped, don't forget the rewards!

Answers (0)