Skip to Content

Business Requirement:

Our customer need a way to append/add ad-hoc notes to production orders and then needed to be able to include those ad-hoc notes in reporting.

Solution:

Use GOS (Generic Object Services).  It is easily activated (see document http://scn.sap.com/docs/DOC-33485 ) and readily shows up out-of the box in most all of your common places that you would use it such as production orders, purchase orders, sales orders, etc.  In our case it was for the production order.  We worked with the user to show them how to add the ad=hoc note into the production order.  Then we wrote a snippet of code in order to retrieve the note.

Example:

1. Go into CO02 and enter in a production order number and press enter.

2. Click on the arrow that is on the services for object button on the left side of the screen just below the enter button at the top left of the screen.  Then choose Create —-> Create Note

/wp-content/uploads/2014/12/pic1_599287.png

3. Type in the title of the note and then type in the note itself.  Once finished click on the green check box and then click on save the production order.

/wp-content/uploads/2014/12/pic2_599348.png

4. To retrieve the notes programmatically and display onto a report here is the snippet of code.

DATA: lv_instid_b               TYPE                   sofolentil-doc_id,

           lv_note                     TYPE                   so_text255,

           lt_object_content     TYPE TABLE OF solistil,

           ls_object_content     TYPE                   solistil.

CLEAR: lv_instid_b.

SELECT SINGLE instid_b FROM srgbtbrel INTO lv_instid_b

     WHERE reltype    = ‘NOTE’

           AND instid_a  = <Prod Order #>

           AND typeid_a = ‘BUS2005’

           AND catid_a   = ‘BO’.

IF sy-subrc = 0.

     CLEAR: lt_object_content[], ls_object_content.

     CALL FUNCTION ‘SO_DOCUMENT_READ_API1’

          EXPORTING

               document_id          =     lv_instid_b

          TABLES

               object_content       =     lt_object_content

          EXCEPTIONS

               document_id_not_exist           =     1

               operation_no_authorization     =     2

               x_error                                     =     3

               OTHERS                                  =     4.

     IF sy-subrc = 0.

          CLEAR: lv_note.

          READ TABLE lt_object_content INTO ls_object_content INDEX 1.

          IF sy-subrc = 0.

               lv_note = ls_object_content-line.

          ENDIF.

     ENDIF.

ENDIF.

——————

Of course this can be easily adaptable to other objects such as purchase orders which would be typeid_a = ‘BUS2012’ and instid_a = <Purchase Order #>.  You can get the typeid_a value from the standard list of business objects.

To find the business object for what you are looking for go to transaction SWO1 and click on the button “Business Object Repository” and then choose All object types and click on the green check mark.

/wp-content/uploads/2014/12/pic3_599349.png/wp-content/uploads/2014/12/pic4_599350.png

Then just search for the object you are looking for.  An example is shown below for Production Orders.

/wp-content/uploads/2014/12/pic5_599352.png

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply