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

Question about buffered internal table

Former Member
0 Likes
1,843

Hi,

Need some advice. In my program, I'm calling 2 std FMs (from the same function group). Inside the first FM, it's populating a global internal table with some values. Then inside the 2nd FM, it's reading this internal table. How can I refresh this internal table (since this table doesn't belongs to my program) so that the 2nd FM will read an empty table? Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Clemenss
Active Contributor
0 Likes
1,375

Hi Alvin,

if you know what you do, if there is no function in this function group that initializes the internal table, you can use the dynamic assign.

But before doing so, you should find out if it is possible to clear the internal table by calling the first FM with specific parameters.

If want to use the dynamic assign, it goes like

CALL FUNCTION 'FM1'
*  ...
FIELD-SYMBOLS:
  <any> TYPE ANY.
ASSIGN  ('(''PROGNAME'')ITAB[]') TO <any>.
CLEAR <any>.
CALL FUNCTION 'FM2'
*  ...

where PROGNAME is the function group main program and itab is the name of the internal table declared globally in the function group.

Regards,

Clemens

7 REPLIES 7
Read only

Former Member
0 Likes
1,375

I don't think it is possible, unless you make the first function module as a custom one

Read only

0 Likes
1,375

I can't. I need both FMs as how they are. I'm thinking if it will works if I use STARTING NEW TASK for the 2nd FM. I do not want to use Enhancement Point either. So, if there's any other method, please advice.

Read only

0 Likes
1,375

Hi Alvin,

Try to find out a function module from the same function group which can initialize the global internal tables and buffers of the function group.

If you cant find one then you can create a z function module to do the initialization and call in betwen the two FMs taht you are referring to.

This is relatively easy compared to handiling paraller processing.

To call the function module using STARTING NEW TASK it should be remotely enabled.

Each task ID defines a separate RFC connection with its own context,So if you want to use some other global data which was set by the first FM then i think it will not be available for the second FM if you use paraller processing.

please correct me i may be wrong.

Read only

brad_bohn
Active Contributor
0 Likes
1,375

You could certainly access the memory directly and kill it, but it's not a good approach. Generally, when there's a dependency like that, the function group will have an initialization function to refresh all of the tables assigned to the group. Have you checked?

Read only

Clemenss
Active Contributor
0 Likes
1,376

Hi Alvin,

if you know what you do, if there is no function in this function group that initializes the internal table, you can use the dynamic assign.

But before doing so, you should find out if it is possible to clear the internal table by calling the first FM with specific parameters.

If want to use the dynamic assign, it goes like

CALL FUNCTION 'FM1'
*  ...
FIELD-SYMBOLS:
  <any> TYPE ANY.
ASSIGN  ('(''PROGNAME'')ITAB[]') TO <any>.
CLEAR <any>.
CALL FUNCTION 'FM2'
*  ...

where PROGNAME is the function group main program and itab is the name of the internal table declared globally in the function group.

Regards,

Clemens

Read only

Former Member
0 Likes
1,375

Thank you all...

I will try to see if there's such FM in the function group.

Clemens... I totally forgot about the dynamic assign. Will resort to that if there's no such FM to refresh the buffer.

Read only

Former Member
0 Likes
1,375

All, unfortunately, there's no FM to clear the buffer. I think dynamic assign is the way to go, as suggested by Clemens.

Thanks again to all, especially to Clemens!