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 ABAP Parallel Processing Tool

Former Member
0 Likes
2,165

Hi All,

I need some assistance in the creation of an ABAP program. I need to create an ABAP program which takes the name of a report as an input and runs this report in the background upon execution. The inputted report must be run in parallel, distributed across available servers. I am new to ABAP and only know some basics. Could you please provide me with some guidance on how best to approach and create this program?

Thanks.

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
1,999

You really want a program that takes any program as input then causes that program's execution to be distributed across all the application servers?

This would be a holy grail of computing.

Way outside your ability, I would think. I'm very experienced, and I can't do it.

12 REPLIES 12
Read only

custodio_deoliveira
Active Contributor
0 Likes
1,999

Hi,

Is there any reason not to simply run the program itself in BG instead of creating a program to run a program?

Regards,

Custodio

Read only

matt
Active Contributor
0 Likes
2,000

You really want a program that takes any program as input then causes that program's execution to be distributed across all the application servers?

This would be a holy grail of computing.

Way outside your ability, I would think. I'm very experienced, and I can't do it.

Read only

Former Member
0 Likes
1,999

It's for use within IS-U for running some reports, so I wouldn't say any program. What would be the best way to run these reports in a parallel then?

Read only

0 Likes
1,999

Hi J Bradford,

You can do 1 thing. Create 1 function module with Import parameters = your report's selection screen fields.

Now withing function module you can use Submit Program with Import parameter syntax with job number.

and your actual report coading you can call this FM in new task,

Ex. Call Function STARTING NEW TASK taskname.

So divide your input parameter and pass it in same function module and create a new task for every syntax.

All task will run in parallel and you can append out internal table at the end.

You can refer below code for Submit Program Syntax in background processing :

DATA: v_repid LIKE sy-repid.             " REPORT ID

  CONSTANTS:c_save  TYPE char1 VALUE 'A'.   "VARIANT SAVE
  DATA: v_exit  TYPE char1.      "WILL HAVE 'X' IF USER PRESSES NO

  DATA: job_time   TYPE sy-uzeit, "JOB TIME

    job_number TYPE tbtcjob-jobcount, " JOB NUMBER
    jobnameLIKE tbtcjob-jobname. " JOB NAME

  DATA:BEGIN OF i_jobno OCCURS 0,

   jobno TYPE tbtcjob-jobcount, " JOB NUMBER
   jobna LIKE tbtcjob-jobname, " JOB NAME
   END OF i_jobno.

  DATA job_released TYPE c. " JOB RELEASED STATUS

  CLEAR:jobname.

  CONCATENATE 'E_' sy-cprog  sy-uzeit INTO jobname.

  CALL FUNCTION 'JOB_OPEN'

EXPORTING
  jobname      = jobname
  sdlstrtdt    = sy-datum
  sdlstrttm    = job_time
IMPORTING
  jobcount     = job_number
EXCEPTIONS
  cant_create_job  = 1
  invalid_job_data = 2
  jobname_missing  = 3
  OTHERS       = 4.

  SUBMIT ytsm_vistex_bback_agmt_conv

     WITH p_fitab = space
     WITH p_cltab = space
     WITH p_upload = 'X'
     WITH p_backg = space
     WITH s_file IN s_file
     WITH s_range IN s_range
     WITH s_artyp IN s_artyp
     WITH s_boart IN s_boart
     WITH s_masta IN s_masta
     WITH s_custa IN s_custa
     WITH p_date = p_date
     WITH c_mestyp = c_mestyp
     WITH c_rcvprt = c_rcvprt
     WITH c_rcvprn = c_rcvprn
     WITH c_rcvpor = c_rcvpor
     WITH c_sndprt = c_sndprt
     WITH c_sndprn = c_sndprn
     WITH c_senpor = c_senpor
     VIA JOB jobname NUMBER job_number
     AND RETURN.

  CLEAR:i_jobno,i_jobno[].

  i_jobno-jobno = job_number.

  i_jobno-jobna = jobname.

  APPEND i_jobno.

  CALL FUNCTION 'JOB_CLOSE'

EXPORTING
  jobcount         = job_number
  jobname          = jobname
* PRDMINS          = 5
  strtimmed        = 'X'
IMPORTING
  job_was_released = job_released
EXCEPTIONS
  cant_start_immediate = 1
  invalid_startdate= 2
  jobname_missing  = 3
  job_close_failed = 4
  job_nosteps      = 5
  job_notex        = 6
  lock_failed      = 7
  invalid_target   = 8
  OTHERS           = 9.

  IF sy-subrc <> 0 OR job_released <> 'X'.

MESSAGE 'Job Released Failed' TYPE 'E'.

  ELSE.

MESSAGE : 'Background job has been created' TYPE 'I'.

  ENDIF.

  WAIT UP TO 1 SECONDS.

Hope it will Useful.

Thanks and Regards

Sagar Pambhar

Read only

matt
Active Contributor
0 Likes
1,999

So what do you want to do? Are you want to distribute the load of each individual report, or are you wanting to ensure that if you launch 2 reports, their load is distributed - one running on one server, one running on another.

If the former, we're back to holy grail.Unless there's something very special about the reports.

If the latter, then you simply launch the jobs in background, programmatically, to a previously defined server group that does the load balancing for you. How to do that is well covered on this site.

Read only

Former Member
0 Likes
1,999

I want to distribute the load of each individual report.

I found this link on parallel processing - Implementing Parallel Processing - Background Processing - SAP Library, am I correct in thinking that each report needs to be coded specifically to run in parallel then? And can't be run in parallel by an external program if it is not coded specifically to do so?

Read only

matt
Active Contributor
0 Likes
1,999

Yes, that is pretty much the point I've been trying to make. If you want an ABAP program to take advantage of parallel processing, you have to design it as parallel running from the start.

Read only

Former Member
0 Likes
1,999

This is a big challenge for someone with only basic knowledge of ABAP though.

Might I inquire about the need for this requirement?

If something is running for a very long time then instead of fiddling around with parallel processing it mgiht be a better idea to spend your time in analyzing the reports to see if they can be made more efficient. This is also a nice way for you to get some training in ABAP.

You could also simply divide the reports needed output in 4 separate variants and then in SM36 you can specify which server should be used for running the report. There you run each variant for a different server,

Kind regards, Rob Dielemans

Read only

matt
Active Contributor
0 Likes
1,999

For running in background, if you set up a server group properly, you don't need to worry specifying any particular server. The load balancer will allocate to the correct server automatically.

Read only

0 Likes
1,999

Hi,

If it has to run in IS-U, are you familiar with the (FI-CA) Mass Activity framework? Btw, there is even a guide on creating Custom Mass Activities on SCN, and there is at least one OSS note outlining the steps necessary.

          

The thing supports load balancing (have not tried out), and SAP has implemented at least these two "Parallelization objects": Contract Account and Business Partner, although the standard "processing intervals" control (via static variants) is IMO next to useless... If I remember correctly, the building of intervals can, however, also be programmed.

I'm not saying this framework is the next best thing after sliced bread, but that is the framework under which SAP delivers their mass processing for IS-U and FI-CA (and possibly for other Industry Solutions), and I managed to build my own "copycat" Mass Activities to process the output of custom Correspondence types (the task is not exactly "simple" for the uninitiated). There are other synergies, however - the use under Job Commander
(FKJOXTR), possible integration with EMMA/BPEM for monitoring and exception processing... If other Mass Activities and EMMA/BPEM are already in use, if the "load balancing" and "parallelization" features of Mass Activities fit the requirement, I'd definitely recommend to at least consider the
possibility of "not reinventing the wheel"...


Of course, the underlying "report" or functionality needs to be designed and programmed with parallel processing in mind. What functionality is it btw?

cheers

Janis

Read only

Former Member
0 Likes
1,999

Do you know if there are any other step by step guides of how to implement mass activities? That guide seems to be missing a couple of steps and is also missing the second part of the guide.

Read only

0 Likes
1,999

Hi,

I used 144461 - Mass activities: Step-by-step setup. At the end of 1720599 - Additional information about IS-U Mass Activities there is a pdf which is not about the actual development, but should still be helpful in that it outlines some of the features and capabilities.

cheers

Jānis