Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Read optional table explicitly from an RFC-Call

Former Member
0 Likes
760

Hello Guru,

I'm having a Problem with RFC-Function-Module.

In my function module I read an optional table called myops_table like this way

Read table myops_table

IF myops_table IS NOT INITIAL

  • DO something

ENDIF.

The problem that I removed the instruction "Read table myops_table" and after calling the function module with an external program using RFC, the table is INITIAL and the program is not working correctly.

But, if I do this in SAP, the program works fine without having the read-instruction.

Has this to do that the optional table is not buffered and that man need to read it first.

Best Regards,

Kais

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
673

Hello,

You might have to try like this


IF myops_table[] IS NOT INITIAL.
* DO something
ENDIF.


IF myops_table  IS NOT INITIAL. "it refers only the header and not the actual data.

Vikranth

Hello Guru,

I'm having a Problem with RFC-Function-Module.

In my function module I read an optional table called myops_table like this way

Read table myops_table

IF myops_table IS NOT INITIAL

  • DO something

ENDIF.

The problem that I removed the instruction "Read table myops_table" and after calling the function module with an external program using RFC, the table is INITIAL and the program is not working correctly.

But, if I do this in SAP, the program works fine without having the read-instruction.

Has this to do that the optional table is not buffered and that man need to read it first.

Best Regards,

Kais

4 REPLIES 4
Read only

Former Member
0 Likes
674

Hello,

You might have to try like this


IF myops_table[] IS NOT INITIAL.
* DO something
ENDIF.


IF myops_table  IS NOT INITIAL. "it refers only the header and not the actual data.

Vikranth

Read only

0 Likes
673

Thanks Vikranth.

Now, I'm aware about it.

But could you explain me why it works fine in SAP and not well by an RFC-Call.

Is this has to do of the fact that the table optional. So, the header is not set by an RFC-Call when this table is optional. By it's set on a direct call.

Should I do this by all the tables whether they are optional or not.

Best Regards,

Kais

Read only

0 Likes
673

Hello Kias,

Not really sure why its not working in a RFC call. Could be that the headers are getting intitialized automatically during a RFC and not when running within SAP. But i dont think this has anything to do with tables parameter being a optional or mandatory.

The correct method to check if a table is initial or not is only by specifying []. You will have to do this to all tables to avoid any inconsistencies.

Vikranth

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
673

Ignore

Edited by: Keshav.T on Dec 30, 2009 11:12 PM