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

Generic Object Services for a Z program

Former Member
0 Likes
3,039

Hello all!

I need to create a Z application for displaying master material data, related batchs, associated QA, and PP data, all in one screen.

I need to have the Object Services Toolbox in the top of my screen just like in Material Master appears, for using it to attach files, notes, etc, being in this environment.

I have read about first I need to create a BO in SW01, and then to call some methods in class CL_GOS_MANAGER.

Does anyone have experience or any idea for do that?

thank you very much,

Ibrahim

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,300

Do this will place the toolbox, in the titlebar.



REPORT ZRICH_0001 .


parameters: p_qmnum type viqmel-qmnum.


at selection-screen output.

* Maint nofification
  CALL FUNCTION 'SWU_OBJECT_PUBLISH'
    EXPORTING
      objtype                 = 'BUS2038'
      objkey                  = p_qmnum 
*     CREATOR                 = ' '
*     METHOD                  = ' '
*   TABLES
*     CONTAINER               =
   EXCEPTIONS
     OBJTYPE_NOT_FOUND       = 1
     OTHERS                  = 2.


start-of-selection.

REgards,

Rich Heilman

Message was edited by: Rich Heilman

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,301

Do this will place the toolbox, in the titlebar.



REPORT ZRICH_0001 .


parameters: p_qmnum type viqmel-qmnum.


at selection-screen output.

* Maint nofification
  CALL FUNCTION 'SWU_OBJECT_PUBLISH'
    EXPORTING
      objtype                 = 'BUS2038'
      objkey                  = p_qmnum 
*     CREATOR                 = ' '
*     METHOD                  = ' '
*   TABLES
*     CONTAINER               =
   EXCEPTIONS
     OBJTYPE_NOT_FOUND       = 1
     OTHERS                  = 2.


start-of-selection.

REgards,

Rich Heilman

Message was edited by: Rich Heilman

Read only

0 Likes
1,300

Slight modification, check that a number has been entered in the field before you put the toolbox on the screen.



report zrich_0001 .


parameters: p_qmnum type VIQMEL-qmnum.


at selection-screen output.

<b>check p_qmnum <> space.</b>

  call function 'SWU_OBJECT_PUBLISH'
    exporting
      objtype                 = 'BUS2038'  "Maint notification
      objkey                  = p_qmnum
*     CREATOR                 = ' '
*     METHOD                  = ' '
*   TABLES
*     CONTAINER               =
   exceptions
     objtype_not_found       = 1
     others                  = 2.


start-of-selection.

I tested this with a valid notification, I created an attachment in IW22, then ran this program, entered the number, hit enter, went into the toolbox, and my attachement was there.

Regards,

Rich Heilman

Read only

0 Likes
1,300

Hello Rich:

Thanks for your answer,

Your solution didnt worked for my case.

I used parameter: p_matnr like mara-matnr

and objtype 'BUS1001' (material).

The toolbox works ok, I can attach notes or files from my Z program. And I see them after in attachments list. But in standard MM03 I see different attachments for the same material number. They dont match never. Its like I am pointing to different objects.

Besides of that, this FM says to be Obsolete for my SAP version 4.7.

any other suggestion?

thanks a lot anyway,

regards,

Ibrahim

Read only

0 Likes
1,300

Hello Rich:

The function 'SWU_OBJECT_PUBLISH' finally worked OK.

I change the business object to 'BUS1001006' the same that use the MM03 transaction.

Although the FM documentation says it is obsolete, the standard program uses it !

thanks a lot !

Ibrahim

Read only

Former Member
0 Likes
1,300

In the Z Application do the following code changes.

In the TOP Include define

I am taking example of custom business object.ZBUS1001 delegation from BUS1001.

CLASS CL_GOS_MANAGER DEFINATION LOAD.

data : lo_object type ref to cl_gos_manager,

ls_object type borident.

Now In PBO

in case of change mode key is known. But in case of create mode Key is unknown.

ls_object-objtype = 'ZBUS1001'.

ls_object-objkey = ''.

Create object lo_object

exporting is_object = ls_object

ip_no_instance = 'X'

exceptions others = 1.

After Save when Key is avaiable

ls_object=objkey = ZBUS1001-ID.

call method lo_object->set_id_of_published_object

exporting

is_object = ls_object.

Regards

Aman

Read only

0 Likes
1,300

Hello Aman:

Your solution worked ok, but after upload an attachment or note, next time I came in, It dissapear, probably, something is missing when saving the new object.

any idea?

thank you very much.

Ibrahim

Read only

Former Member
0 Likes
1,300

HI Ibrahim Tamayo, Do you mind explaining how exactly you uploaded a file and saved in the repository.

Thanks,

Murali

Read only

0 Likes
1,300

Hi Murali:

I used the FM 'SWU_OBJECT_PUBLISH' with the same business object than uses the MM01-MM02-MM03 transactions.

regards.