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

Services for Object in creation mode

Former Member
0 Likes
1,342

Hi colleagues,

I am facing one problem and I would appreciate your help and ideas. I want to enable user to use a functionality of "Services for object" in creation mode (in my case transaction IW31). In change or display mode this functionality is enabled, so creating new BOR object and such things are not necessary.

I understand that services for object are disabled by default in creation mode, because it is not meaningful to assign some documents to object which does not yet exist. But in theoretical way, it should be possible to implement some "tricky" solution. Probably some temporary object could be created at the start of IW31 and attachments could be assigned to this object. And in some user exit executed during processing of save statement (after all checks and such things), attachments could be re-assigned to a real (persistent) object. For unsaved orders it would be necessary to delete temporary object and also attached documents.

Have someone implemented something similar? Or any helpful ideas?

Thank you all in advance.

Regards,

Adrian

1 ACCEPTED SOLUTION
Read only

vinod_vemuru2
Active Contributor
0 Likes
1,066

Hi,

We have implemented exactly the same in a Ztransaction. Not sure to what extent this will help you. Check below code


  CREATE OBJECT w_gosman
  EXPORTING
*     io_container     = io_container
*     is_bc_object     = is_bc_object
    is_object        =  wa_object            "BOR object
*    it_service_selection = 
*     io_callback      = io_callback
*     ip_start_direct  = space
    ip_no_instance   = l_inst             "Pass SPACE in your case
    ip_no_commit     = l_commit        "Pass SPACE in your case
    ip_mode          = c_e
  EXCEPTIONS
    object_invalid   = 1
    callback_invalid = 2
    OTHERS           = 3
    .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

"Here just we are creating a reference by publishing the object.

"During the transaction commit call below method.

  wa_object-objkey = "Pass your object ID.
 wa_object-objtyp = "Pass your business object
    CALL METHOD w_gosman->set_id_of_published_object
    EXPORTING
*      is_bc_object   = is_object
      is_object      = wa_object
    EXCEPTIONS
      no_publication = 1
      OTHERS         = 2
      .
    COMMIT WORK.

Thanks,

Vinod.

Hi colleagues,

I am facing one problem and I would appreciate your help and ideas. I want to enable user to use a functionality of "Services for object" in creation mode (in my case transaction IW31). In change or display mode this functionality is enabled, so creating new BOR object and such things are not necessary.

I understand that services for object are disabled by default in creation mode, because it is not meaningful to assign some documents to object which does not yet exist. But in theoretical way, it should be possible to implement some "tricky" solution. Probably some temporary object could be created at the start of IW31 and attachments could be assigned to this object. And in some user exit executed during processing of save statement (after all checks and such things), attachments could be re-assigned to a real (persistent) object. For unsaved orders it would be necessary to delete temporary object and also attached documents.

Have someone implemented something similar? Or any helpful ideas?

Thank you all in advance.

Regards,

Adrian

5 REPLIES 5
Read only

vinod_vemuru2
Active Contributor
0 Likes
1,067

Hi,

We have implemented exactly the same in a Ztransaction. Not sure to what extent this will help you. Check below code


  CREATE OBJECT w_gosman
  EXPORTING
*     io_container     = io_container
*     is_bc_object     = is_bc_object
    is_object        =  wa_object            "BOR object
*    it_service_selection = 
*     io_callback      = io_callback
*     ip_start_direct  = space
    ip_no_instance   = l_inst             "Pass SPACE in your case
    ip_no_commit     = l_commit        "Pass SPACE in your case
    ip_mode          = c_e
  EXCEPTIONS
    object_invalid   = 1
    callback_invalid = 2
    OTHERS           = 3
    .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

"Here just we are creating a reference by publishing the object.

"During the transaction commit call below method.

  wa_object-objkey = "Pass your object ID.
 wa_object-objtyp = "Pass your business object
    CALL METHOD w_gosman->set_id_of_published_object
    EXPORTING
*      is_bc_object   = is_object
      is_object      = wa_object
    EXCEPTIONS
      no_publication = 1
      OTHERS         = 2
      .
    COMMIT WORK.

Thanks,

Vinod.

Read only

sudhahar_ramachandran
Active Participant
0 Likes
1,066

Hi,

the services for objects does not have any link with the current document operation. it acts independentally. it takes only the BO name and the key from the document operation. At the time of creation the key is not available so its blocked. if you are ready to make the document as prenumbered, it will appear in creation mode also. Services for objects can be called from anywhere using the existing function modules. so if you want you can create a small utility for your purpose.Moreover, it doesnt wait for the documents to be saved. whatever operation you do with Services for objects is instantaneous.

thanks & regards,

Sudhahar R

Read only

Former Member
0 Likes
1,066

http://wiki.sdn.sap.com/wiki/display/Snippets/GOSURLAdditiontoBusiness+Object

/people/rammanohar.tiwari/blog/2005/10/10/generic-object-services-gos--in-background

Edited by: Krupaji on Feb 8, 2010 1:28 PM

Read only

Former Member
0 Likes
1,066

Hi Sudhahar and Vinod,

thanks for your replies. Issue was solved by a member of my team. I will post a solution here, when a development will be finished.

Adrian

Read only

0 Likes
1,066

Hi Adrian,

If possible can you please share how you resolved the issue?

Thanks in advance,

Karuna.