Login Form

Best viewed in IE 7.0

ADVERTISEMENTS
ADVERTISEMENT

Generic Object Services (GOS) Toolbar - Add toolbar in Custom Program

Original article posted on http://help-abap.zevolving.com.

Today, we will see how to get the GOS toolbar in the custom Report.

GOS toolbar works on the Business Object. To be able get GOS toolbar, we need to have a Business Object and Business Object Key. For example, to get the GOS toolbar for the customer, we need Business object KNA1 and customer number as the key. So, if we want to have a GOS toolbar in our custom transaction than we need to have a key before generating that. This is the reason; we don’t have the GOS toolbar option in the standard SAP Create transactions like: XD01, VA01, MM01 and so on.

This test program will provide us the GOS toolbar for the Customer in our custom program (Z program). This will provide us all the functionality of the GOS toolbar which are available in the XD02, XD03 transaction.

Code Snippet to Add GOS toolbar to Custom program
  
*&---------------------------------------------------------------------*
*& Report ZTEST_NP_GOS
*&
*& To Generate GOS toolbar in the Custom Transaction
*&---------------------------------------------------------------------*
*
REPORT ztest_np_gos.
*
DATA: lo_manager TYPE REF TO cl_gos_manager,
la_obj TYPE borident.
*
PARAMETERS: p_kunnr TYPE kna1-kunnr.
*
*
START-OF-SELECTION.
*
* Set object Key
la_obj-objtype = 'KNA1'.
la_obj-objkey = p_kunnr.
*
* GOS toolbar
CREATE OBJECT lo_manager
EXPORTING
is_object = la_obj
ip_no_commit = space
EXCEPTIONS
OTHERS = 1.
*
* To generate output
WRITE: 'GOS test for Customer'.


Now, we will get the GOS toolbar which will look like this:
ADVERTISEMENT
Free software downloads