Monday, November 06, 2006

Generic Object Services

Generic Object Services – Linking IDoc to the Business object.

Overview:

The business object and its related services can be linked using Generic object services. This is a very clean way of seeing thing right from the application which can be either master data or transactions. This document explains the ways to link the objects that are created in the customer name space. Most of the SAP’s standard services are pre built to perform this action.

When you publish the custom Business object using the function module ‘SWU_OBJECT_PUBLISH’ , a object service toolbox appears for the related business object in its business transaction.

The following services can be started in the toolbox,

Toolbox Entry

Submenu

Link to Description

Create...

Create Attachment

Appending a PC Document to an Object

Create Note

Creating a Note for an Object

Create External Document (URL)

Appending a Link to a Web Page

Store Business Document

Appending and Archiving a PC Document to an Object

Enter Bar Code

Assigning an Object the Bar Code of a Document

Attachment List


Displaying Attachments

Personal Note


Creating a Personal Note for an Object

Send Object with Note

Send Object with Note

Sending an Object with a Note

Object Outbox

Displaying the Object Outbox

Display Relationships


Displaying Relationships

Workflow

Workflow Overview

Displaying Workflows for an Object

Archived Workflows

Start Workflow

Starting a Workflow for an Object

My Objects

Add to My Objects

Adding Object to your Favorites

Subscribe/Cancel Object

Subscribing to Messages About Changes to an Object

Telephony


Telephony

Actions


Activating PPF Actions

In this example document, We will try to demonstrate the incoming and outgoing Idocs can be linked to the Business object and they can be viewed using the relationship service in the toolbox from within the application. The scenario here will be like theis:

The Idocs are created in a separate ALE distribution program and not in the same business transaction. The objective is to link the Idocs created in the separate program to its corresponding business object and should be made available in the relationship service.

The following steps are involved for linking the Idoc to its corresponding Business object.

For illustration let us link the outbound and inbound Idocs to the customized business object ‘Bank account’ (ZUNBANK).

Before linking the Idoc with the business object, the relationship service in the tool box appears disabled as below, meaning that the system cannot show or display the related service objects.

For Outbound Idoc:

Step 1: BDA4: Link the Idoc message type to the Business object type. In this example the message type, the idoc and the business objects are all in the customer name space.

The Idoc message type is linked to the object type.

Step 2:BD95: Define the ALE object type. This is just an object definition and link this to the master table and the key field.

Step 3: BD57: Define the link object type for the message type.

Step 4: BD59: Assignment of object type to message

Step 5: Execute the corresponding ALE distribution program and create the Idoc.

Now the relationship service in the toolbox is enabled.


The corresponding Idoc is displayed

For Inbound Idoc:

The inbound idoc linking is a little bit trickier than the outbound. In the case of the outbound, the file creation is in our hands and we can establish the linkage as we create and distribute the file, whereas in the inbound the same needs to be accomplished in the inbound function module. Though it is only a single step action, I’ll try to put in my next posting.

Thanks to my colleague Praveen Antony for his contributions for this document preparation.






Thursday, November 02, 2006

BDT development

Business Data Toolkit (BDT) is the new way of programming in SAP. This is available in IS-PS (public sector) solution and I guess this is available in some other IS solutions such as insurance etc., This is a concept in which SAP provides you all the development components with which you can build your own screens and fields and weave it nicely within the existing SAP application. This is available mostly for the master data maintenance.

Given this input, I'll try to explain the concept in which I understood. Every SAP transaction can be thought in abstract to have the following components:
1. Data element & Domains
2. Screen fields
3. Field grouping (functional set of fields)
4. Views (Combination of one or more field group)
5. Sections (Combination of one or more views)
6. Screen (Combination of one or more sections)
7. Transaction (With one or more screen in a pre determined sequence)

If this above concept is clear, then it is very easy to understand and can even start development using BDT. For those who do not have enough exposure to the Grants or other modules that have BDT, I’ll try to give an analogy using the customer master record.

In the customer master the fields that are in the KNA1 table are the data elements and domains. The screen fields are the same as the data element, but the screen needs to be built and the definition of the screen specific parameters was defined in SAP’s delivered screen itself. For example the customer name is the data element AD_NAME1 and the related screen field is ADDR1_DATA-NAME1 (Program SAPMF02D/Screen 7000)

The field grouping is the group of functionally related screen fields, which can be turned as Required, Optional or Hidden using the configuration. In this case it could be the set of fields that cover the Street address

The views can be Street address and the PO Box address together

And the Section may be the combination of Name, Search term, Street address and the PO Box address.

The screen could be the Address, Control Data, etc.,

The screen sequence is defined and the transaction XK01/02/03 is created.

With the same idea in mind SAP had given the same concept as a development tool. This eliminates the need of extending the SAP’s standard table by appending structure. And also it gives you the flexibility to append two dimensional objects such as tables as well.

Wednesday, November 01, 2006

interesting problem

Eventhough you work for a long time in programming, say in ABAP, it is very difficult to keep in touch with all the evolving technoloagy and the concepts. and practical requirements are pretty simple and that do not need much of the complex programming techniques.

Most of the trivial programming requiremets are such as GUI operations, MS office interface, etc., can be easily built using the standard functions and can be kept as a tool kit. This will obviously be a effective methadology, as you don't have to dig over and over for the most common jobs.

Let me start posting the ABAP routines, I've developed, which can be used in any implementation.

The first posting will be a reading Excel file from the presentation server. This upload will take care of the excel files which contain macros as well.

Try and let's know if you are having fun

*&---------------------------------------------------------------------*
*& Report ZZ_TEST_EXCEL_LOAD *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

REPORT ZZ_TEST_EXCEL_LOAD .

TYPE-POOLS: truxs.

PARAMETERS: p_file TYPE rlgrap-filename.

TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.

DATA: it_raw TYPE truxs_t_text_data.

* At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.


***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.

IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


***********************************************************************
* END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.