‎2011 Jan 09 12:17 AM
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.
‎2011 Jan 09 3:33 PM
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
‎2011 Jan 09 3:05 AM
I don't think it is possible, unless you make the first function module as a custom one
‎2011 Jan 09 3:35 AM
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.
‎2011 Jan 09 1:52 PM
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.
‎2011 Jan 09 2:34 PM
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?
‎2011 Jan 09 3:33 PM
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
‎2011 Jan 10 1:24 AM
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.
‎2011 Jan 10 2:20 AM
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!