Skip to Content
avatar image
Former Member

ABAP: How to create parallel processing

Dear experts,

Requirement:

I have to select data of Sales Order (VBAP) with minical numbers of criteria - not filtered by date!!!!!. Hence it needs to select huge amount of records from the table. The key point is that to select data as fast as possible.

My Idea:

Per my investigation aroun the internet, I consider to use the concept of 'Parallel Processing'. I've tried doing like the following link: http://sapignite.com/learn-parallel-processing-in-abap/ . It doesn't work. I understand the concept of coding, but I don't get the concept of congiure at RZ12.

I'm an ABAPer. I've no idea on the BASIS side. Please advice me how to configure or communicate the BASIS team.

Thanks in advance.

Cheers,

Nattapong I.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

12 Answers

  • Best Answer
    May 02, 2013 at 03:39 PM

    Parallel Processing works in ABAP.

    Please check the following posts

    http://scn.sap.com/thread/1884700 and

    http://scn.sap.com/thread/3271539.

    If you have to select data from huge number of records, I suggest a few things for quick access.

    1. create index on the table (but a lot of if's with it)

    2. for Searching, obviously you would be already using a lot of key fields use still use binary search.

    3. Use Open SQL. Its faster than Native SQL.

    Regards,
    Manu

    Add comment
    10|10000 characters needed characters exceeded

  • May 02, 2013 at 03:47 PM

    Hi,

    first off all: Is your report already slow or are you in the designing process?

    I would suggest, to use SQL-cursors because they provide a proper package mechanism. Try to minimize the data to transfer ( amount of rows and columns ), use joins and grouping funcatinality of the database.

    The usage of parallel processing would be my last option, because you will have to separate the access and data transfer and merge them manual after all data has been read. It is possible, of course, but I think a good SQL and a fast ABAP can handle a lot of data in an acceptable time.

    Kind regards,

    Hendrik

    Add comment
    10|10000 characters needed characters exceeded

  • May 02, 2013 at 03:54 PM

    Hi Nattapong,

    For starting new task you dont need basis. in your example you can use DESTINATION IN GROUP DEFAULT if you want to write destination check CALL FUNCTION - STARTING NEW TASK help

    here is the part from help :

    Addition 1

    ... DESTINATION IN GROUP {group|DEFAULT}

    Effect

    If you specify IN GROUP as the destination, this supports parallel execution of multiple function modules on a predefined group of application servers of the current AS ABAP. This variant of aRFC is also known as parallel remote function call (pRFC).

    For group, you must specify a data object of the type RZLLI_APCL from the ABAP Dictionary, one that is either initial, or one that includes the name of an RFC server group created in transaction RZ12. If DEFAULT is specified or if group is initial, all currently available application servers of the current AS ABAP are used as the group. Only one RFC server group may be used within a program. During the first asynchronous RFC using the addition IN GROUP, the specified RFC server group is initialized. For each asynchronous RFC where the group is specified, the most suitable application server is determined automatically, and the called function module is executed on this.

    If the function module cannot be executed on any of the application servers, because not enough resources are available at present, a predefined exception RESOURCE_FAILURE is raised, to which, in addition to the other RFC exceptions, a return code can be assigned. For this exception, the addition MESSAGE is not permitted.


    check this link for code example : http://scn.sap.com/thread/3346895

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 02, 2013 at 04:06 PM

    Nattapong,

    Parallel processing is mostly used when we have a lot of data to process and the current process is slow. One of the best examples is the program RBDAPP01 for parallel processing of Idocs.

    Personally, I have not come across a scenario where we use parallel processing for data selection. To make this process faster, there are many suggestions provided above.

    1. Consider creation of index. Run a trace and see what index is being used by SAP.

    2. Use joins which are faster than multiple selects.

    3. Use the packet size option on the select statement.

    Thanks,

    Vikram.M

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 03, 2013 at 09:37 AM

    Hello,

    in case of parallel processing you have to use JOB_OPEN and JOB_CLOSE fm.

    loop at it into wa. [ it holds huge of records..]

    if counter = '100'.

    g_c_counter = g_c_counter + 1.

    perform parallel_processing.

    else.

    counter = counter + 1.

    append wa to it_new.

    endif.

    endloop.

    Form parallel_processing.

    concatenate 'parallel' g_c_counter into g_c_id separated by '_'.

    EXPORT ITAB = it_new to shared buffer indx(ST) id g_c_id compression on.

    jobname = g_c_id.

    call function job_open.

    after executing this fm you get jobcount (job number).

    SUBMIT 'ZREP' with p_count = g_c_counter via <jobname> number <jobcount> and return.

    call function job_close.

    endform.

    Report ZREP.

    parameters: p_count type char5.

    concatenate 'parallel' p_count into g_c_id separated by '_'.

    IMPORT ITAB = it_new from shared buffer indx(ST) id g_c_id .

    Delete from shared buffer indx(ST) id g_c_id.

    if it_new is not initial.

    select.......

    endif.

    Follow the above mentioned way......its a very good way to handle huge records and its performance is too good........it gives better performance...

    Thanks

    Sabyasachi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 03, 2013 at 04:53 AM

    Hi All,

    Thanks everyone for your replies. Your comments are very helpful for me. By the way, as I communicate the functional person, he accept the concepr of creating idices and change a bit requirements which is now fine.

    Cheers,

    Nattapong I.

    Add comment
    10|10000 characters needed characters exceeded

  • May 03, 2013 at 05:19 AM

    Nattapong,

    as i see your requirement(forgive if i am mistaken) you need to fetch huge amount of data from database... I think using cursors would be the best way to do it(using package size if its very huge)....
    coming on to parallel programming the main part is, can you segregate your data extraction such that it can be appended to the main table in later stage.... if yes then Best would be to create a RFC F.M. and using STARTING NEW TASK and PERFORMING f_end ON END OF TASK. Inside this FM extract your data. and call this FM in loop so that many instances can be run but on different criterias (change the segregation criteria from the loop)

    f_end you have to append all the data into your final table.
    hope it make sense. thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 03, 2013 at 09:46 AM

    Hi,

    If you want to use PARALLEL PROCESSING then you have to use the FM SPBT_INITIALIZE and then create a FM of your own and write the select query inside it and call it in a new task.

    Regards,

    Santanu.

    Add comment
    10|10000 characters needed characters exceeded

  • May 03, 2013 at 09:48 AM

    Hi,

    RZ12 setting are required to process in parallel as all programs are assigned process like Dialogue, Database and Background. A set number of such processes are possible for parallel execution in a sever. To keep things safe like A single program taking up all processes and Hardware resources and clog the server each program run by user is allocated a fixed amount such as say 1 Dialogue, 1 Background processing and 1 Dialogue and memory and Processing that's associated with it. That's

    why programs also give dump at at times due to lack of available runtime memory its not that all runtime memory in server is used but its just that the amount allocated to a user is used up.

    Coming back to the RZ12 setting. To do parallel processing your user profile will have to be configured to use more of these processes at one time which is usually not allowed as server administration best practises.

    Cheers,

    Arindam

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 05, 2013 at 07:11 AM

    LOOP AT t_likp INTO likp.

    Read table t_lips into lips with key vbeln = likp-vbelnLOOP AT t_lips INTO lips FROM

    w_index.

    if sy-subrc EQ 0.

    LOOP AT t_lips INTO lips FROM w_index.

    -

    do processing----

    AT END OF <Key field> (here it is VBELN)

    EXIT. " Exit of the inner loop pn t_likp or else it will go into infinite loops

    ENDAT.

    ENDLOOP.

    ENDIF.

    ENDLOOP.

    may be help full answer...

    reward me....

    Add comment
    10|10000 characters needed characters exceeded