Skip to Content
author's profile photo Former Member
Former Member

tRFC and Async RFC

Hi,

I have a program which regularly goes out of Roll area memory. To fix this i want to do load balancing onon the memory by parallelising the running of the program by implementing tRFCs or Async RFCs . My requirment is to select from multiple database tables and then to do multiple BDCs. Has anyone ever does this before , if so please tell me which is better and in Async RFC can we use the roll area to store data and later retrieve data.

Kunal

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 08:26 AM

    Hello Kunal,

    here is an example for distributing work:

    REPORT  zz_distribute_work.
    
    DATA: gt_servers TYPE TABLE OF msxxlist WITH HEADER LINE.
    DATA: msg_text(80).
    DATA: task_name(4) TYPE n.
    
    
    TYPES: BEGIN OF work_t,
             status TYPE char01,
             work   TYPE char80,
           END OF work_t.
    DATA: gt_work TYPE TABLE OF work_t WITH HEADER LINE.
    
    
    START-OF-SELECTION.
    
    *
      CALL FUNCTION 'TH_SERVER_LIST'
        TABLES
          list = gt_servers.
    
    * assemble you work orders:
    *
      gt_work-work = 'do this'.
      APPEND gt_work.
    
      LOOP AT gt_servers.
    
        task_name = sy-tabix.
    
        CALL FUNCTION 'ZZ_MY_WORKER_FM'
          DESTINATION gt_servers-name
          STARTING NEW TASK task_name
          PERFORMING end_task ON END OF TASK
          TABLES
            it_work               = gt_work
          EXCEPTIONS
            communication_failure = 1  MESSAGE msg_text
            system_failure        = 2  MESSAGE msg_text.
    
        CASE sy-subrc.
          WHEN 0.
            gt_servers-serv = 'started'.
          WHEN 1.
            gt_servers-serv = '-comm error'.
          WHEN 2.
            gt_servers-serv = '-sys error'.
        ENDCASE.
    
        MODIFY gt_servers TRANSPORTING serv.
      ENDLOOP.
    
      PERFORM list.
    
    
    
    AT USER-COMMAND.
    *
      CASE sy-ucomm.
        WHEN 'REFRESH'.
          PERFORM list.
      ENDCASE.
    
    FORM list.
    *
      sy-lsind = 0.
      LOOP AT gt_servers.
    
        WRITE: / 'Server', gt_servers-name.
        IF gt_servers-serv(1) = '-'.
          WRITE gt_servers-serv+1 COLOR COL_NEGATIVE.
        ELSEIF gt_servers-serv(1) = '+'.
          WRITE gt_servers-serv+1 COLOR COL_POSITIVE.
        ELSE.
          WRITE gt_servers-serv COLOR COL_TOTAL.
        ENDIF.
      ENDLOOP.
    *
    ENDFORM.                    "liste
    
    FORM end_task USING taskname.
    *
      DATA: tabix TYPE i.
      DATA: lt_work TYPE TABLE OF work_t WITH HEADER LINE.
    *
      tabix = taskname.
      RECEIVE RESULTS FROM FUNCTION 'ZZ_MY_WORKER_FM'
        TABLES
          it_work       = lt_work
        .
      READ TABLE lt_work INDEX 1.
    
      CASE lt_work-status.
        WHEN 'X'." OK
          gt_servers-serv = '+OK'.
        WHEN 'E'." error
          gt_servers-serv = '-error'.
      ENDCASE.
    
      MODIFY gt_servers INDEX tabix TRANSPORTING serv.
    
      SET USER-COMMAND 'REFRESH'.
    *
    ENDFORM.                    "end_task
    

    I wrote it to run a FM on all servers at the same time.

    If you find my answer useful, please don't forget the reward.

    Regards,

    Juergen

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.