‎2017 Jul 11 5:09 PM
Hello, if I activate my program and run it immediately in background, it often executes on another application server, and so the old version of the program is used because the application server doesn't know that there is a new version of the program, because the PXA/program buffer is not synchronized yet, the sync being done approximately once every 2 minutes.
Do you know whether it exists a way to sync immediately the buffer on all application servers each time I activate my program? (or an option to execute in background only on current application server without having to enter it manually when I submit in background).
Thanks a lot!
Sandra
‎2017 Jul 11 6:25 PM
Brute Force and of course not advisable.
Prepare an RFM that GENERATEs your program. Get all servers with Fumo TH_SERVER_LIST. Call the RFM on all servers. Duh.
‎2017 Jul 11 5:46 PM
Phew, I wait patiently before starting on other servers 😉
Let's see if someone knows a trick.
‎2017 Jul 11 5:52 PM
It's what I do too: I have bought a cooking timer to wait for 3 minutes 😉
‎2017 Jul 11 6:25 PM
Brute Force and of course not advisable.
Prepare an RFM that GENERATEs your program. Get all servers with Fumo TH_SERVER_LIST. Call the RFM on all servers. Duh.
‎2017 Jul 11 10:11 PM
Thanks. I'll probably do that. Maybe as an enhancement of the standard "activate" button (if the user is "me"), if possible.
‎2017 Jul 12 7:11 AM
DATA list TYPE TABLE OF msxxlist WITH EMPTY KEY.
CALL FUNCTION 'TH_SERVER_LIST'
TABLES
list = list
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0 OR lines( list ) < 2.
...
ENDIF.
DELETE list WHERE host = sy-host.
LOOP AT list ASSIGNING FIELD-SYMBOL(<server>).
CALL FUNCTION '...' STARTING NEW TASK '...'
DESTINATION <server>-name.
ENDLOOP.
‎2017 Jul 13 7:27 PM
I did a test, and it works (i.e. GENERATE REPORT executed on all other servers). I also did a test to force the buffer synchronization (cl_buffer_sync=>synchronize) on all other servers, it works too. PS: my release is 7.40.
But the issue is to trigger it easily right after the activation of the program, and most of code behind the Activate button is protected against the Enhancement framework. Maybe using a SAP GUI shortcut from my laptop, to start the program. Not ideal.
‎2017 Jul 21 12:30 PM
Here's the complete but ugly ("generic" RFC) source code if someone needs it.
REPORT.
parameters program type syrepid.
START-OF-SELECTION.
DATA lt_server TYPE TABLE OF msxxlist.
DATA ls_server TYPE msxxlist.
DATA l_server_name TYPE btctgtsrvr-srvname. "20c
DATA l_message(273) TYPE c.
CALL FUNCTION 'TH_SERVER_LIST'
TABLES
list = lt_server.
"DELETE lt_server WHERE host = sy-host. " ignore current server
LOOP AT lt_server INTO ls_server.
l_server_name = ls_server-name. "truncate 40c to 20c ("hostname_sid_99")
CLEAR l_message.
DATA STRING TYPE STRING.
STRING = PROGRAM.
CALL FUNCTION 'SO_CALLBACK_RFC'
DESTINATION l_server_name
EXPORTING
program = sy-repid
form = 'TEST' "to call subroutines TEST and TEST_XCHECK
params = STRING
EXCEPTIONS
system_failure = 1 MESSAGE l_message
communication_failure = 2 MESSAGE l_message
OTHERS = 3.
IF sy-subrc NE 0.
WRITE : / l_server_name, sy-subrc, l_message.
ENDIF.
ENDLOOP.
*---------------------------------------------
FORM test_xcheck CHANGING xcheck TYPE flag.
xcheck = 'X'.
ENDFORM.
*---------------------------------------------
FORM test USING params TYPE string.
GENERATE REPORT params.
"CALL METHOD cl_buffer_sync=>synchronize.
ENDFORM.
‎2017 Jul 12 4:48 AM
Sandra,
"if I activate my program and run it immediately in background, it often executes on another application server, and so the old version of the program is used because the application server doesn't know that there is a new version of the program"
May I know what is the objective of this acitivity.Just curious to know the scenario that necessitates acitvating a prog and running immediately in background.
K.Kiran.
‎2017 Jul 12 5:59 AM
/$PXA https://wiki.scn.sap.com/wiki/display/Basis/How+to+Reset+different+SAP+buffers
Maybe...?
I'd noticed this behaviour as well - though when importing changes into our 2 appserver test system. Never thought about the cause.
‎2017 Jul 12 7:02 AM
Thanks Matt. /$pxa only empties the PXA buffer on the current application server (which is the same for all /$ commands). So I would need to switch to every server and run it, it's a little too much fastidious for me. I'd really like a profile parameter for that, or an option in the user's workbench settings (something like "run in background only in current server"), ...
‎2017 Jul 12 6:00 AM
Easy. Create program that runs in background. Find it doesn't work. Fix, activate, run again (in background) to test.
‎2017 Jul 12 6:57 AM
K.Kiran, I have to run the program in background because it's a long-running program (in dialog, it would time out) and I don't want to "lock a user session for nothing". My current assignment is to improve the performance of programs, so I do it very often. It's normal to run a program immediately after having activated it ; it's abnormal to count down 3 minutes before doing a task. I also ask because I never saw this question in the forum, but probably people like me would be interested to know if there's a solution.