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

Creating a thread object in ABAP

Former Member
0 Likes
917

Hi,

Is it possible to create a threa in ABAP function modules or in ABAP objects or in both?

For example do the following in ABAP code:

while(true){

if(someCheck)

else

terminate thread

}thread sleep(1 second)

regards

Baran

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
659

There is nothing like threads concept in ABAP.

But parallel processing can be done like this example:

  DO V_LINES TIMES.

    V_TASK_COUNT = SY-INDEX.
    CONCATENATE 'TASK_' V_TASK_COUNT INTO V_TASK_NAME.

    READ TABLE IT_ARBPL INTO WA_ARBPL INDEX SY-INDEX.

    P_ARBPL = WA_ARBPL-ARBPL.

    REFRESH IT_ORDERS.
    CALL FUNCTION 'ZPP_PARALLEL_PROCESS'
      STARTING NEW TASK V_TASK_NAME
      PERFORMING COLLECT_DATA ON END OF TASK
      EXPORTING
        E_ARBPL   = P_ARBPL
        E_WERKS   = P_WERKS
        E_ZPPUOM  = 'H'
        E_DATES   = IT_DATES
      TABLES
        ET_ORDERS = IT_ORDERS.
    IF SY-SUBRC EQ 0.
      ADD 1 TO V_WC_COUNT.
    ENDIF.
  ENDDO.

  WAIT UNTIL V_WC_COUNT = V_NUMBER_OF_WCS.

Regards,

Ravi

3 REPLIES 3
Read only

Former Member
0 Likes
660

There is nothing like threads concept in ABAP.

But parallel processing can be done like this example:

  DO V_LINES TIMES.

    V_TASK_COUNT = SY-INDEX.
    CONCATENATE 'TASK_' V_TASK_COUNT INTO V_TASK_NAME.

    READ TABLE IT_ARBPL INTO WA_ARBPL INDEX SY-INDEX.

    P_ARBPL = WA_ARBPL-ARBPL.

    REFRESH IT_ORDERS.
    CALL FUNCTION 'ZPP_PARALLEL_PROCESS'
      STARTING NEW TASK V_TASK_NAME
      PERFORMING COLLECT_DATA ON END OF TASK
      EXPORTING
        E_ARBPL   = P_ARBPL
        E_WERKS   = P_WERKS
        E_ZPPUOM  = 'H'
        E_DATES   = IT_DATES
      TABLES
        ET_ORDERS = IT_ORDERS.
    IF SY-SUBRC EQ 0.
      ADD 1 TO V_WC_COUNT.
    ENDIF.
  ENDDO.

  WAIT UNTIL V_WC_COUNT = V_NUMBER_OF_WCS.

Regards,

Ravi

Read only

Former Member
0 Likes
659

It seems like to create FM with different execution sequencies. You can refer to ARFC documentation, Similar functionality can be achieved.

Read only

Former Member
0 Likes
659

Here are a couple of links which demonstrate the concept of parallel processing in ABAP:

/people/naresh.pai/blog/2005/06/16/parallel-processing-in-abap

http://help.sap.com/saphelp_nw2004s/helpdata/en/fa/096e92543b11d1898e0000e8322d00/content.htm

Regards,

Ravi