Application Development 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: 

Is it possible to submit an abap oo instance?

javier_rodruez
Participant
0 Kudos
327

Hi experts,

I need to execute the process of creating 300.000 materials associated with 15 centres in background.

Is this possible? Apparently, I can't specify the instance of the class to the SUBMIT declarative... I would appreciate your responses.

Lots of thanks,

Javier

5 REPLIES 5

andreas_mann3
Active Contributor
0 Kudos
107

better use report RMDATIND with direct input

grx

A.

0 Kudos
107

Thanks for your quickly response, Andreas. This standard report you have mentioned don't seems to solve my problem, though.

The problem starts when creating a huge number of materials with its price conditions takes a long time. Even ABAP report is highly optimized.

Now, we are thinking on separating the way of creating, firstly creating in foreground a material associated to a limited centres. And then, update the association with the other centres in background. That's why I wondered if it was possible to send the instance where we have all material data saved.

The only option I have is to pass material code and productive centres as parameters to a new program via submit. And recuperate the information calculated using function modules to extend the material to those new productive centres.

If anyone could tell me another solution, please advice me.

Thanks!!!

0 Kudos
107

I don't know of any way to execute the instance method in the background, but I think you could call a custom FM in background. You could serialize object instance into XML (using CALL TRANSFORMATION statement) and pass the resulting XML string to the custom FM. In the FM, you can then use the CALL TRANSFORMATION statement to create an object from the XML string. Then you can call the method of the reconstructed instance.

Here's sample code (that I haven't tested, but should get you going in the right direction)


CLASS cl_class DEFINITION.
  PUBLIC SECTION.
  METHODS do_action.
  INTERFACES if_serializable_object. " <-- This is needed for CALL TRANSFORMATION to work!
ENDCLASS.

CLASS cl_class IMPLEMENTATION.
  METHOD do_action.
*   <--Do whatever the method needs to do here-->
  ENDMETHOD.
ENDCLASS.

FORM do_method.
  DATA: lr_instance TYPE REF TO cl_class.
  DATA: l_class_xml TYPE string.

  CREATE OBJECT lr_instance
* <--Do whatever you need to do to prepare instance here-->

  CALL TRANSFORMATION id SOURCE class = lr_instance RESULT XML l_class_xml.

  CALL FUNCTION 'CALL_METHOD' STARTING NEW TASK
    EXPORTING
      p_class_xml = l_class_xml.

ENDFORM.


FUNCTION call_method.
* IMPORTING
*   p_class_xml TYPE string.
  DATA: lr_instance TYPE REF TO cl_class
  
  CALL TRANSFORMATION id SOURCE XML p_class_xml RESULT class = lr_instance.
  CHECK lr_instance IS BOUND.

  lr_instance->do_action( ).

ENDFUNCTION.

0 Kudos
107

Hello,

My suggestion would be wrap the functionality available in report (which you are calling using submit statement) in a remote enable function module

And call the function module in different external session using 'CALL FUNCTION 'FM' STARTING IN NEW TASK ' GROUP 'group' '' to apply parallel processing concept...where group would be application server group....you can use standard FM SPBT_INITIALIZE and SPBT_GET_PP_DESTINATION to get current available resource and get rfc name in which task has been executed

Thanks

0 Kudos
107

Best practice would be -

1) Create MATMAS IDOC for each material

2) Parallel process with a server group.

Alternatively create a a Z IDOC and call the BAPI in the processing function module. Parallel processing with IDOCs is the way to go.