[Python] How to enable parallel execution of ABAP in PyRFC?

Discussão em 'Python' iniciado por Stack, Novembro 20, 2024.

  1. Stack

    Stack Membro Participativo

    I am migrating a project to PyRFC, using a server configuration.

    My program is registering a function that has to be called. The incoming data is splitted across 3 DTP, hence my function will be called 3 times.

    When we set the parallel execution in SAP to 1, everything is working fine and I am receiving one packet after another. But this is too slow! We need to have the executions running in parallel.

    When we set the execution to 3 in SAP, it says that all packets are sent but I'm only receiving the first one.

    Here is my implementation of PyRFC :


    def launch_server():
    """Start server."""

    # create server for ABAP system ABC
    client_params = {
    "lang": config["lang"],
    "client": config["client"],
    "passwd": config["passwd"],
    "user": config["user"],
    "sysnr": config["sysnr"],
    "ashost": config["ashost"],
    "dest": config["dest"],
    "conncount": config["conncount"],
    "trace": config["trace_level"]
    }

    # Define server parameters (SAP RFC server setup)
    server_params = {
    "gwhost": config["gwhost"],
    "gwserv": config["gwserv"],
    "dest": config["dest"],
    "program_id": config["program_id"],
    "trace": config["trace_level"]
    }

    server = Server(
    server_params=server_params,
    client_params=client_params,
    config={
    "check_date": False,
    "check_time": False,
    "port": 8081,
    "debug": config["use_server_debug"] != 0,
    "server_log": config["use_server_debug"] != 0
    }
    )

    # expose python function to be called by ABAP
    server.add_function("MY_FUNCTION", myFunctionImplementation)

    # start server
    server.serve()

    # Enable pyrfc logging
    logging.basicConfig(level=logging.DEBUG)

    server_thread = Thread(target=launch_server)
    server_thread.start()


    In this example, when SAP is sending 3 packets at the same time I only receive one and myFunctionImplementation is called only once.

    In this example, conncount is set to 10 which seems the only things to change to allow parallelization.

    I hardly understand SAP internal processes, what am I missing? Is it possible to handle all three packets at the same time?

    I also tried to enable bgRFC without success.

    Continue reading...

Compartilhe esta Página