Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

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

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.

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.

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

2 Comments