1 2 Previous Next

ravikumar.allampallam

23 Posts

You have developed a ALV GRID report using REUSE_ALV_GRID_DISPLAY function and the report has come out really well. However, some users want to see a ALV list than the grid. Or you have a existing ALV GRID report and the user want to have a ALV List report.

 

SAP has provided a BADI just for this purpose. The name of the BADI is

ALV_SWITCH_GRID_LIST

. Now create a implementation for this BADI.

For a given user or specific to a report, you can switch on the flag to produce a ALV list.

Here is the simple code for the report

REPORT  Y_RAVI_REUSE_ALV.

 

TYPE-POOLS : SLIS.

 

DATA : T_DATA TYPE TABLE OF ALV_T_T2,

      T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

 

START-OF-SELECTION.

 

  SELECT * FROM ALV_T_T2 INTO TABLE T_DATA UP TO 30 ROWS.

 

END-OF-SELECTION.

 

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

  •     I_PROGRAM_NAME               =

  •     I_INTERNAL_TABNAME           =

      I_STRUCTURE_NAME             = 'ALV_T_T2'

  •     I_CLIENT_NEVER_DISPLAY       = 'X'

  •     I_INCLNAME                   =

  •     I_BYPASSING_BUFFER           =

  •     I_BUFFER_ACTIVE              =

    CHANGING

      CT_FIELDCAT                  = T_FIELDCAT

  •   EXCEPTIONS

  •     INCONSISTENT_INTERFACE       = 1

  •     PROGRAM_ERROR                = 2

  •     OTHERS                       = 3

            .

  IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  •         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

 

  FIELD-SYMBOLS : -DO_SUM = 'C'.

  ENDIF.

 

  DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

  WA_LAYOUT-allow_switch_to_list = 'X'.

 

  DATA : WA_VARIANT TYPE DISVARIANT.

  WA_VARIANT-USERNAME = SY-UNAME.

  WA_VARIANT-REPORT = SY-REPID.

 

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

  •     I_INTERFACE_CHECK                 = ' '

  •     I_BYPASSING_BUFFER                = ' '

  •     I_BUFFER_ACTIVE                   = ' '

  •     I_CALLBACK_PROGRAM                = ' '

  •     I_CALLBACK_PF_STATUS_SET          = ' '

  •     I_CALLBACK_USER_COMMAND           = ' '

  •     I_CALLBACK_TOP_OF_PAGE            = ' '

  •     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

  •     I_CALLBACK_HTML_END_OF_LIST       = ' '

  •     I_STRUCTURE_NAME                  =

  •     I_BACKGROUND_ID                   = ' '

  •     I_GRID_TITLE                      =

  •     I_GRID_SETTINGS                   =

      IS_LAYOUT                         = WA_LAYOUT

      IT_FIELDCAT                       = T_FIELDCAT

  •     IT_EXCLUDING                      =

  •     IT_SPECIAL_GROUPS                 =

  •     IT_SORT                           =

  •     IT_FILTER                         =

  •     IS_SEL_HIDE                       =

  •     I_DEFAULT                         = 'X'

  •     I_SAVE                            = ' '

      IS_VARIANT                        = WA_VARIANT

  •     IT_EVENTS                         =

  •     IT_EVENT_EXIT                     =

  •     IS_PRINT                          =

  •     IS_REPREP_ID                      =

  •     I_SCREEN_START_COLUMN             = 0

  •     I_SCREEN_START_LINE               = 0

  •     I_SCREEN_END_COLUMN               = 0

  •     I_SCREEN_END_LINE                 = 0

  •     I_HTML_HEIGHT_TOP                 = 0

  •     I_HTML_HEIGHT_END                 = 0

  •     IT_ALV_GRAPHICS                   =

  •     IT_HYPERLINK                      =

  •     IT_ADD_FIELDCAT                   =

  •     IT_EXCEPT_QINFO                   =

  •     IR_SALV_FULLSCREEN_ADAPTER        =

  •   IMPORTING

  •     E_EXIT_CAUSED_BY_CALLER           =

  •     ES_EXIT_CAUSED_BY_USER            =

    TABLES

      T_OUTTAB                          = T_DATA

  •   EXCEPTIONS

  •     PROGRAM_ERROR                     = 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.



Here if you have noticed, there are couple of important parameters that need to be passed. Those are

IS_VARAINT

and

IS_LAYOUT

. You have to set this field

allow_switch_to_list

to 'X' and also pass the username and report name in the IS_VARIANT field if you want to switch to the list based on the conditions.

 

Here is the normal output of the grid.

 

image

 

Here is the implementation of the BADI.

 

image

 

Here is the interface for the BADI Implementation

 

image

 

Here is the code

 

image

 

Finally here is the output.

 

image

 

 

If you have a requirement to show some detailed data in an ALV Grid, there are two ways of doing it. You can create your dialog container and assign the grid to the dialog container.

 

SAP has made the job easier for us by giving a class

CL_RS_ALV_GRID_POPUP

, which does exactly the same. Now, all you have to do, is to create the field catalog, create the Grid object and call the method SHOW_DATA. You can even specify the coordinates as to where the grid should appear.

However, the toolbar will NOT appear for this grid but you can have the layout and can chang the way you want it.

 

 

Here is the Class

 

image

 

 

The difference is, here you will have to pass the field catalog / structure which will have the column details, while creating the GRID object as against to doing it while displaying the data in the traditional CL_GUI_ALV_GRID class.

You can also specify the starting coordinates of the grid and width and height of the grid.

 

image

 

 

And here, while displaying the data, all you have to do is to pass the table, which has the data.

 

image

 

 

So, now we don't have to bother about creating a dialog container for showing a ALV grid as popup.

 

Here is a sample code for the same. I am calling this in the double click event of a MAIN ALV GRID.

-CARRID.

  ELSE.

    EXIT.

  ENDIF.

 

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

   EXPORTING

  •    I_BUFFER_ACTIVE              =

      I_STRUCTURE_NAME             = 'ALV_T_T2'

  •    I_CLIENT_NEVER_DISPLAY       = 'X'

  •    I_BYPASSING_BUFFER           =

  •    I_INTERNAL_TABNAME           =

    CHANGING

      CT_FIELDCAT                  = T_FIELDCAT1

  • EXCEPTIONS

  •    INCONSISTENT_INTERFACE       = 1

  •    PROGRAM_ERROR                = 2

  •    OTHERS                       = 3

            .

  IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  •         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

 

  CREATE OBJECT W_POPUP_GRID

     EXPORTING

  •    I_STRUCTURE_NAME =

       I_T_FIELDCATALOG = T_FIELDCAT1

  •    I_S_LAYOUT =

  •    I_CAPTION =

  •    I_REPID =

  •    I_DYNNR =

       I_LEFT = 10

       I_TOP  = 10

       I_HEIGHT = 300

       I_WIDTH = 300

      .

 

  CALL METHOD W_POPUP_GRID->SHOW_DATA

    EXPORTING

      I_T_DATA = T_DATA1.

  .

 

ENDFORM.                    " SHOW_DETAILS

 

</textarea>

 

Well, nothing exceptional, but definitely a handy one to reduce coding.

After seeing what we could do to change the look and feel, I started to play around with the BADI further. And you can actually do a lot with this. You can write methods which will fire for all the standard events of the grid. You can set the handler for specifc events that you want to handle as a part of the BADI. You can add custom buttons and write the code when the user presses the same. If you want to activate the toolbar you need to set the parameter I_TOOLBAR_MANAGER. CREATE OBJECT W_GRID EXPORTING * I_SHELLSTYLE = 0 * I_LIFETIME = I_PARENT = W_CUSTOM_CONTAINER * I_APPL_EVENTS = space * I_PARENTDBG = * I_APPLOGPARENT = * I_GRAPHICSPARENT = * I_NAME = I_GRID_ID = 'Y_RAVI_GRID_XT' I_TOOLBAR_MANAGER = 'X' I_OPTIMIZE_OUTPUT = 'X' EXCEPTIONS ERROR_CNTL_CREATE = 1 ERROR_CNTL_INIT = 2 ERROR_CNTL_LINK = 3 ERROR_DP_CREATE = 4 GRID_ID_INVALID = 5 OTHERS = 6 . IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. Once you do this go to the implementation of your BADI and find out which class is implementing the BADI. image The toolbar parameter Switches on 3-level toolbar management. As you can see from the screen shots below, the toolbar can be expanded the to the extent the user wants. You can also exclude the existing buttons by filling the internal table CT_TOOLBAR_EXCLUDING, which is one of the changing parameters of the BADI. image image image Following is the code that I have written for creating buttons on the toolbar and also handling the events for the same. Now, let us see how these methods (which should be linked to the event firing on the ALV) are created. If you see the class that is implementing the BADI interface, by default you will the methods inherited from the BADI. So, in this case they will be SET_TABLE_FOR_FIRST_DISPLAY and REFRESH_TABLE_DISPLAY. Also, you can notice the interface name is prefixed to the same. image Now, we need add more methods to this class. Go ahead add the methods that you want to implement. Here I have created two new methods MODIFY_TOOLBAR to add add / remove buttons and FUNC_TOOLBAR to respond to the events. image However, the trick is to make sure these event dependent methods. So, go to the details of this method and associate the event, which is nothing one of the standar events provided by the CL_GUI_ALV_GRID. image I have just written some dummy coding to make sure my methods are working. So, I am just showing a message here. image We will continue to explore this and find out more things that we can do.

Have you scratched your head to do minor modifications (change the appearance of a column), add more fields to your output of an existing standard ALV report? I know most of us would have encountered this situation and finally ended up cloning the standard program and struggled with the changes to be done to get your requirements done.

 

Now, there is a way and the good thing is you do NOT have to copy the standard program. SAP has been kind of enough to provide a BADI which can be used just for this purpose. The BADI

ALV_GRID_XT

can be used to alter the output of the report. I will explain below how I have done the same with a quick flight example. In this example, I have take a custom made report and altered the output of the same without actually changing the fields. My basic report displays nothing but the data from the SFLIGHTS table.

So here is the code for my basic report.

&----


*& Report  Y_RAVI_ALV_GRID_BADI

*&

&----


*&

*&

&----


 

REPORT  Y_RAVI_ALV_GRID_BADI.

 

 

DATA : T_DATA TYPE TABLE OF SFLIGHT,

       T_FIELDCAT TYPE LVC_T_FCAT.

 

DATA : W_CUSTOM_CONTAINER  TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

       W_GRID TYPE REF TO cl_alv_grid_xt.

 

START-OF-SELECTION.

 

  SELECT * FROM SFLIGHT INTO TABLE T_DATA.

 

END-OF-SELECTION.

 

  CALL SCREEN 0100.

 

  INCLUDE Y_RAVI_ALV_GRID_BADI_STATUSO01.

 

  INCLUDE Y_RAVI_ALV_GRID_BADI_USER_CI01.

 

----


***INCLUDE Y_RAVI_ALV_GRID_BADI_STATUSO01 .

----


&----


*&      Module  STATUS_0100  OUTPUT

&----


  •       text

----


MODULE STATUS_0100 OUTPUT.

  SET PF-STATUS 'ZALV_BADI'.

  SET TITLEBAR 'ZALV_BADI_TITLE'.

 

 

  IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.

    CREATE OBJECT W_CUSTOM_CONTAINER

           EXPORTING CONTAINER_NAME = 'ALV_BADI'.

 

 

    CREATE OBJECT W_GRID

        EXPORTING

          I_PARENT = W_CUSTOM_CONTAINER

I_GRID_ID = 'Y_RAVI_GRID_XT'.

 

  ENDIF.

 

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

    EXPORTING

  •     I_BUFFER_ACTIVE              =

      I_STRUCTURE_NAME             = 'SFLIGHT'

  •     I_CLIENT_NEVER_DISPLAY       = 'X'

      I_BYPASSING_BUFFER           = 'X'

  •     I_INTERNAL_TABNAME           =

    CHANGING

      CT_FIELDCAT                  = T_FIELDCAT

    EXCEPTIONS

      INCONSISTENT_INTERFACE       = 1

      PROGRAM_ERROR                = 2

      OTHERS                       = 3

            .

  IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

 

 

  CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY

  • EXPORTING

  •    I_BUFFER_ACTIVE               =

  •    I_BYPASSING_BUFFER            =

  •    I_CONSISTENCY_CHECK           =

  •    I_STRUCTURE_NAME              =

  •    IS_VARIANT                    =

  •    I_SAVE                        =

  •    I_DEFAULT                     = 'X'

  •    IS_LAYOUT                     =

  •    IS_PRINT                      =

  •    IT_SPECIAL_GROUPS             =

  •    IT_TOOLBAR_EXCLUDING          =

  •    IT_HYPERLINK                  =

  •    IT_ALV_GRAPHICS               =

  •    IT_EXCEPT_QINFO               =

  •    IR_SALV_ADAPTER               =

    CHANGING

       IT_OUTTAB                     = T_DATA

       IT_FIELDCATALOG               = T_FIELDCAT

  •    IT_SORT                       =

  •    IT_FILTER                     =

    EXCEPTIONS

      INVALID_PARAMETER_COMBINATION = 1

      PROGRAM_ERROR                 = 2

      TOO_MANY_LINES                = 3

      OTHERS                        = 4

          .

  IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

 

 

ENDMODULE.                 " STATUS_0100  OUTPUT

 

</textarea>

 

Here is the output of my report.

 

image

 

Now, let us create a implementation of the BADI in SE18 / SE19 transactions.

 

image

 

And here is the code in my implementation. Once I do this I activate the BADI. Here I am taking a simple case of just changing the colour of o`e singli column

 

.

 

image

 

While creating the BADI implemenation make sure you mention the filter conditions so that the implementation works only for your report and for everyone else's.

 

image

 

This BADI fires just before the

SET_TABLE_FOR_FIRST_DISPLAY

and

REFRESH_TABLE_DISPLAY

methods and all the parameters that are generally available for these methods, are available at the BADI level also so that you can modify anything that you want.

image Do we really understand what ESA is all about, the reason this question came to my mind was that I have heard different people giving different definitions to ESA / SOA. Some say its all about abstracting your technical implementations, some say its all about inter-operability, some say its all about using some set of standards over internet. What I have observed that is this definition changes with the role that person is playing. Now, if we closely look at these definitions each of them are right in their own context. Irrespective of what one might define ESA as, its bound to give us the following benefits. 1. Ease of use of the business application, there by increasing the user productivity. 2. New business process can be easily integrated with the new ones. 3. Reduce the human errors there by the costs. Now, if we leave the benefits apart, the first question that comes to most of us is, how do I identify if there is ESA oppurtunity in my landscape. If yes, how do I identify the same. On the contrary to ESA, the questions that might arise, do I really need ESA. I am able to automate my business process using XI (XI is used for the integrating business applications). So, what is the need for the ESA in my case. Let us take at each of these a little in detail.

Is ESA a necessity?

First let's look at the need for ESA. This question might arise especially in a smaller landscapes where there are limited number of systems and business processes. Data integration happens via XI the landscape has a portal for users to access the applications. Everything is running fine. So, in this case taking steps towards ESA might not make sense, isn't it? However, what about the future? As an organization what are your growth plans, are you planning to grow organically or inorganicall ( Acquistions)? I am sure every organization would be looking for different ways to grow. So, what if you are expanding your business to a different country / continent? Or, to get a head start what if your CEO decides to take over an existing company in a different country. So, when this happens, how do you expand your business applicaion to get the new processes automated (Business expanding) or how do you integrate with already existing applications ( Company Takeover). These things become even more difficult if the new company was operating on a different platform. So, to conclude, no matter how your landscape might look like, I am sure there will be oppurtunites and reasons to go the ESA way. In my view its a matter of time before organizations get there. So, we will all get there sooner or later.

Where to implement to ESA in my landscape?

So, the now the questions comes, how do I identify the opprunities in my business processes for making them ESA enabled. As most of you would have seen the ESA adoption program by SAP you would have seen different stages in ESA adoptions. The stages are something like DISCOVERY EVALUATION IMPLEMENTATION OPERATIONS. DISCOVERY is the phase where you look for the Enterprise Services that can help you improve you business processes. If any of the following things happen in your business process, I am sure there will be an oppurtunity for ESA to help. 1. If the data required by the user is coming from multiple disparate systems. In this case the user is required to login to multiple systems, fetch and analyze the data and then make a decision. An Enterprise service which can communication with all these system can definitely help you in this case. 2. Your business process cuts across multple business systems in your landscape. 3. Your business is spread out in various locations of the world and each of the locations have implemented their own legacy systems / Pacakged applications. 4. All the enterprise services need not be of business step in nature. There might be cases where you might need some help for some look up values from a different application. These services are more of utility in nature. So, the important thing is to identify a business process and then identify the Enterprise Services that can help you out with your processes.

Shameless Plug

We are going to talk on this subject more in deep by taking some business processes at SAP Tech Ed 2005 @ Vienna. The following is the link for the same. http://www.sapteched.com/emea/theater_ppts/session.htm?sid=1003 . Please be there and we can always get into a one on one discussion about the business processes that you may have in your mind and come up with a ESA roadmap.

Closing

In my next blogs I will take some buisness processes, sample landscapes and in that we will see if we have an oppurtunity for ESA and if yes, how do we identify the Enterprise Services that we might start with. image
image As we all know SAP MDM 5.5 gives you individual applications to perform different actions. One of them is the content manager (MDM Client), which can be used for multiple purposes. Some of purposes are to view, edit and create new master data records, add images, documentation / attachments / specification sheets about the data (reading material for products etc). When we started working with our customer, we knew what the customer was looking for, however what we were wondering was how to use the different record modes for the customers data. Which record mode should be used at what time and what kind of data? One of the important things that MDM Client does is that it operates in Six different modes and each of these modes has got a specific purpose. In the blog by Roman Rytov World's fastest and shortest introduction to NetWeaver MDM 5.5 , he has explained the different types of tables we deal with while working with MDM. So, I am not going to go into those aspects. Each of the modes is designed to manipulate specific type of table and repository information. 1. Record Mode: This is probably the most commonly used mode. Here you can see all the details of the record, including the pictures, attached documents etc. You can also edit the records and change the details of the specific fields including the images and documents. image 2. Hierarchy Mode: In this mode you can edit, view the hierarchy tables which include the regular hierarchy tables, taxonomy tables, and the Masks tables. You might be wondering I can do this in the Record mode so what is the difference. Well, in addition to what you can do in record mode, you can also edit the parent / child relationships and also the order of the siblings. image 3. Taxonomy Mode: Here you can edit the taxonomy tables in the repository. You can create and maintain a Category hierarchy and maintain the attributes pertaining to a specific category or sub-category. This can be done in the record mode as well as the hierarchy mode also, however here you can concentrate on creating a pool of attributes and link them with the right category / sub-category. The link in the first column indicates the attributes for the selected category on the left hand side. image 4. Family Mode: This is where you define the families to further break down into smaller chunks of data over and above the taxonomy we have defined. Here you can add an image for the entire list of products pertaining to a specific family. Or in case of vendor / customer, you can add their logo here. image 5. Layout Mode: This mode is entirely from a Catalog designing perspective. This is where you design your layout according to how you want your catalog to look like, what fields you want to display, how the display should look like (vertical / horizontal etc ). image 6. Publication Mode: This will be the last step before you publish your catalog to a DTP application like Quark Express. The publications can done based on a set of records from the main table and then apply Mask and a family hierarchy. After that you completely customize to identify which records to be included and which ones to be filtered. Closing Although MDM as the name suggests if for doing the Master data management, consolidation, harmonization and global data synchronization, it has excellent features for a catalog management solutions and truly so as the product comes from a catalog management background. However, what we have not explored yet is to publish the final publication to a DTP application and print a catalog. image
image  When we started the project we are debating about which is the best way to import material master data from SAP R/3 to SAM MDM. Now, before we got to the core material data, there is some data on which the material data is dependent on like Account groups, Item Category groups, Industries, Units etc etc. This data in MDM terminology is called the look up data.  In this blog we will see how to extract data out of SAP R/3, use the standard maps provided by SAP and load this data. So, the first thing that you do is to unarchive the SAP MATERIAL repository (comes along with the MDM software). This step should be pretty easy.   1.     Specify the DBMS where you want to unarchive the respository. 2.     Specify the name of the repository and the name of the archive (.a2a) file.  That’s all you need to do, you should be able to see the repository in your MDM console. image Now if you see on the right hand side (in MDM), it gives you a complete list of tables that are a part of this repository. image This data model is what is given by SAP as a standard. However, if you have different systems from where the data is coming and this data model, does not fit your requirements, you should be able to change the same according to your requirements.  For now, I am assuming that we are going to go with the standard repository given by SAP. So, given that what do we need to do import the data?  1.     Create Client systems / Agencies (SP01) in MDM. 2.     Decide upon a format in which you are going to import data. MDM can accept data in multiple file formats – Excel, XML. image For now we will concentrate on the XML format.  3.     Extract data from SAP R/3      Check Tables / Look up tables      Material Data  Before we upload the material data, we will have to upload the data for the Check tables. Now the questions comes, how do we extract data for the check tables from SAP R/3. We have write some customer ABAP Programs to extract data in an Excel format or an XML format. However, SAP has been kind enough (Is it really??) to help us out in this context. We have note 830864. which when applied will create these extract programs for the check tables.  •     The extractors with the ending"_552" are synchronized with the MDM 5.5 Support Package 2 and the extractors with the ending "_551" are synchronized with MDM 5.5 Support Package 1. •     Enter the path under which you want the system to save the XML document as the first input parameter (p_fpath). •     Do not select the second input parameter (p_indiv) because this option is not supported for Support Package 1 and Support Package 2 yet. image When you execute the program, the output file will be a bunch of XML files, with the data for the check tables. These files can be directly used to import the data into SAP MDM. A sample XML file for UoM details will look like the below one. image Now, you are ready to import the data. Login to the Import Manager and give this file as input. image You should be able to preview the source data in the bottom of the screen. image Now, select the source and target tables in the import manager (on the top). image Now the next step to map the source and target fields. If it is not standard you can do the mapping manually and store the mappins as a .map file. In the current case as we are using standard data, SAP has gives the standard mapping file.  Before mapping image   Now, open the map file – File --> Open image Once you choose the right mapping file, you should be able see the mappings on the tab, in green colour. image In the TAB – Match Records, specify which field or fields to be used to determine duplicates. image Here you specify what is the action you want to perform. Default will set to Skip. Change that to create so that the data records are created. If you want to test the creation of the records, you can always set the CREATE status (Import Action) for specific records. (See the picture above). image In the Import Status tab, you should be able see what is the next step to be done. In case you have missed anything it will ask you to do the specific step and will not let you proceed. image Right now, we are all set to import the data Unit of Measurements. Now go ahead and click the Import (Exclamation mark) button on the top toolbar. image If everything is good, message pops up informing how many records have been imported. Other wise a report is generated showing the errors.  Closing   In further blogs we will see how to import the actual material data, how to map data manually and lots of other features that MDM gives. You might be wondering, where does XI fit in this case. As we are dealing with standard data and SAP has provided the extractors to write XML files, here you might not need XI. I am talking only about standard data coming from SAP R/3. If your data is coming from other systems you might need XI to map and write an XML file to specific location.  While loading the actual material data, an MATMAS 05 IDOC is sent to XI and XI will write the data into an XML file which can be picked up by MDM. The places where are dealing with non-SAP systems, its left to technical design team as to how to execute the process.  One has to repeat this process for every table modeled in MDM (Painful isn’t it). Well that is the way it has be done because unlike SAP R/3, MDM does not deal at an object level rather it deals at table level. Note : The repository structure, mapping files might change for different releases.  image
After the initial problems of downloading MDM SP02, we were finally successful in getting the server up. However the tricky part is getting the iViews. Because unless the standard business packages, MDM gives you couple of .SDA files which when deployed will get the MDM connector up and some MDM content on the EP stuff. It will not give us ready made iViews which we can start using immediately. And there are good reason behind the same. The reasons are that the repository will be different from customer to customer and so will be the data model. So, the iView has to pick fields from the specified repository and then build the screen. In order to do that, the standard thing that you will have to do is to create a MDM system on the Enterprise Portal, where in you specify the MDM server details and also specify which repository you want to connect to. Once that is done, do the user mapping for the MDM system. Now, coming to the creation of iViews, what SAP gives you as standard are the following iView types for MDM. The following is the screen shot taken from what will be displayed in EP while you are creating the iView. (I did this because I don&#146;t have to type the list myself). image You might be wondering what each of these mean it looks different from the standard iView types that usually see for R/3, CRM etc systems. Let me try and explain the same. The following 4 are meant for customizing the search criteria. MDM Search Hierarchies - This iView will allow you to search the data by any look table that you have defined as Look up &#150;Hierarchy. So, while creating this iView it will prompt you to enter which Hierarchy table you want to use, if you have multiple. image MDM Search Attributes - This iView is to search on the attributes of your product. However, this has the dependency as it requires a Category so that it can take the list of attributes for that category. image Now that we have chosen the category, the iView that we have created by specifying the table. In the above picture, we have selected Goggles as the category. So, below we see the attributes of the Category. I have tried to show that it also lists the possible of each of the attribute, so that if you want to further narrow down your search, you can do that too. image MDM Search Picklists - This is more or less a straight forward search on a specific column of your main table in the repository. In this case I have chosen Manufacturers. image MDM Search Texts This is the best iView that I personally like. Here you can search by a Keyword. image Now comes the fun part, as I have narrowed down my search, where is my list of product list being displayed. This happens in the MDM Resultset iView image Now, we need to keep in mind that these iViews are interdependent on each other. The data is the filtered data which you have done in the other iViews. While creating this iView you can select what are the fields that you want to display. MDM Item Details This is pretty straight forward, once you select the radio button in the resultset iView, this one shows all the details of the product. In this also, while creating this iView you can select what are the fields that you want to display. If the product has got attachments, they will appear as hyper links, and once click will open the corresponding document. image Oops, I almost forgot about the last iView type &#150; MDM Search States What this does is that it will tell you what are the search criteria the user has applied. image image If you want to remove search criteria, its pretty straight forward, just click on reset search for the specific field or the button for resetting the entire search criteria. So, from a Catalog management perspective we are good to go. We need to remember that the standard functionality given by these iViews are only Search and Display. If you have business process that requires extension for the same, we need to enhance this. In further continuation for learning process of MDM, we will see about the process of synchronizing data between R/3 and MDM using Syndicator and XI.

Often we come across the dilemma of which adapater should I use while integrating with SAP systems. Will try and discuss on the options available and what could be some of the points that one should consider before you zero in one of the adapters. If you see the list of Adapters given by SAP, a quick seggregation can be done depending on the type of systems that these adapters are going to communicate with. Now, one of the obvious systems with which XI is going to communicate will the SAP systems (SAP R/3 - 4.6C, 4.7, ECC 5.0, CRM, SRM etc etc). Now these systems could be on the sending side or on the receiving side or could be on both sides where R/3 is integrating with SRM / CRM .... or vice versa. So, what are the options that SAP gives us to communicate with SAP systems. 1. IDOC Adapter 2. RFC Adapter 3. Proxy Now, how do you choose the right one for a given scenario. One of the things that SAP strongly suggests is the usage of PROXIES. Now, if you take a close look at the adapters specified here, the one thing that strikes right away is the usage of proxies. We know that proxy generation is possible only if your WAS is >= 6.20. So, that is one parameter that comes up straight away for the usage of proxies. -- Use Proxies only if the WAS version is >= 6.20. We will also look into other reasons where we should go for a proxy. Let's take a case and discuss the same. The immediate question that probably you are getting is : I am on WAS 6.2 or higher and also at the same time either I have a standard BAPI / Remote enable function module for the given functionality on the application system. So, what should I do now? In this case, there are 2 ways in which the implementation can happen. 1. Configure a RFC Adapter and call the BAPI / RFC. However the potential problem that I could see is that the RFC adapter existing on the Java stack communciating with the BAPI existing on the SAP application system. 2. The second option that I have got is to write a proxy on the SAP application system (which will be called by XI) and internally the proxy will call the BAPI. At this point of time if your question is, as long as I am dealing with the latest versions of SAP systems, should I totally avoid using RFC Adapters - MY TAKE on this would be, YES. Do NOT use RFC Adapter, rather go ahead and use the proxy. However, the problem could be that the pre-built meta data and the mapping that SAP delivers might not be useful as the BAPI is wrapped with a PROXY now. But as the proxy is also expected to have the same message interface as that of the BAPI, we might still be able use the pre-defined mapping. This is something that we need to try out and then decide how do I go about this interface. But for whatever reasons, if you are not getting advantage of the pre-defined integration content, PROXY is the way to go. Now, if you are dealing with SAP systems < 6.20, we do NOT have choice of PROXY anyway, so go ahead and use a RFC adapter. Now, as far as the IDOC adapter is concerned I think the choice would be straight forward. Where ever there is a standard IDOC given by SAP (usually mapping also will be delivered for SRM / CRM system integrations), so go ahead and use the same. The questions that you might be having now is that for a standard object if I have an IDOC as well as a BAPI, which one do I go for. My opinion would be its going to be dependent on the specific scenario that you are trying to develop. We can think of multiple variations of design for this case. For Exapme
1. Send one IDOC at a time.
2. Club multiple IDOCS and send as a single IDOC.
3. Make one single RFC call, for each business transaction.
4. Avoid making multiple calls to the same BAPI / RFC, rather have a wrapper BAPI and send all the records in one time.
5. Use the PROXY and send all the data in one shot and make single calls to the BAPI from the PROXY on the application system - only if you can use PROXIES.
The biggest advantage of the proxy is that it always by passes the Adapter Engine and will directly interact with the application system and Integration engine - so it will and should give us a better performance. So, there are the choices that you have while designing a SAP interface, so take a close look at the interface and identify your priorities for the interfaces. The parameteres could be some thing like PERFORMANCE, ERROR LOG, AUDIT LOG, MONITORING OF THE TRANSACTIONS INDIVIDUALLY. Do a comparison of the pros and cons of the choice of adapters that you have for the parameters for the specific interface and then make a call. Initially, it might look alike - what's the big deal, its a simple case of sending / receiving data from SAP - especially if you are coming from R/3 world, but bellive me, you have got good chances of landing up in trouble, if you don't take care of your priorities of the interface.


SAP XI IN ACTION-I



Please read the blog SAP XI IN ACTION before continuing further. I actually planned to depict the implementation of entire approach in this blog but we are stuck up with the XI server issues and due to which I cannot take good snapshots. In this blog , I just want to share a generic mapping object which is used extensively in the design. We have used generic mapping object for converting any flat file structure to any hierarchical idoc structure. It is required because file adapter has the generic interface structure as specified in the previous blog and sample xml file generated for MRI interface would look like this:


It has to be converted to the hierarchical structure of MRI Idoc as shown below. It cannot be done at the file adapter CC due to the limitation of adapter. I have taken a simple Idoc structure for ease of demonstration.


XML after file CC





It is very complex to design the mapping in graphical editor so I went for java mapping. Even in this case we have to develop mapping programs for every interface and each developer has to put his own logic for his interface. Instead I thought of an approach, which would make the code generic, and each developer just specifies the Idoc structure in his interface specific code and generic code will convert any file structure to hierarchical structure .It cuts down the development efforts as each individual has to just specify the structure and the generic code transforms the input Idoc structure as specified in the interface. It worked out really fantastic in the project.


Idoc Structure




Interface Specific Code :


MRIGenToHierMap.java


/*****************************************************************************************************

  • Mapping Program to Convert NOM IDOC Master Structure to the Generic structure Expected by

  • the FTP Receiver adapter

******************************************************************************************************/

import com.sap.aii.mapping.api.*;

import java.io.*;

import java.util.Map;

import java.util.Vector;

import javax.xml.parsers.*;

import javax.xml.transform.*;

import javax.xml.transform.dom.DOMSource;

import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.*;

import org.xml.sax.*;

//Specify the Hirearchial Structure

class MRIGenToHierMap implements StreamTransformation

{

 

 

     public Vector v;

    private Map map;

    /** * method setParamters is required, but we do not anything with it */

     public void setParameter(Map param)

     {

          map = param;

     } /** * method execute is called by the XI mapping program */

 

public void buildXsd()

{

 

 

  Relation  mriRel ;

  v = new Vector();

  mriRel = new Relation();

  mriRel.parents = new String[1];

  mriRel.elements = new String[6];

  mriRel.node =  "A00" ;

  mriRel.parents[0] =   "NULL" ;

  mriRel.elements[0] =  "TRANSACTION_TYPE" ;

  mriRel.elements[1] =  "ORGANISATION_ID" ;

  mriRel.elements[2] =  "FILE_TYPE" ;

  mriRel.elements[3] =  "CREATION_DATE" ;

  mriRel.elements[4] =  "CREATION_TIME" ;

  mriRel.elements[5] =  "GENERATION_NUMBER" ;

  v.add(mriRel) ;

 

  mriRel = new Relation();

  mriRel.parents = new String[1];

  mriRel.elements = new String[39];

  mriRel.node = "N90";

  mriRel.parents[0] =   "NULL" ;

  mriRel.elements[0] =  "TRANSACTION_TYPE" ;

  mriRel.elements[1] =  "CONFIRMATION_REFERENCE" ;

  mriRel.elements[2] =  "METER_POINT_REFERENCE" ;

  mriRel.elements[3] =  "EFFECTIVE_DATE" ;

  mriRel.elements[4] =  "METER_LOCATION_CODE" ;

  mriRel.elements[5] =  "METER_LOCATION_DESCRIPTION" ;

  mriRel.elements[6] =  "METER_INSTRUCTIONS" ;

  mriRel.elements[7] =  "BUILDING_NUMBER" ;

  mriRel.elements[8] =  "BUILDING_NAME" ;

  mriRel.elements[9] =  "DEPENDENT_STREET" ;

  mriRel.elements[10] =  "PRINCIPAL_STREET" ;

  mriRel.elements[11] =  "DEPENDENT_LOCALITY" ;

  mriRel.elements[12] =  "POST_TOWN" ;

  mriRel.elements[13] =  "COUNTY" ;

  mriRel.elements[14] =  "METERING_SET_REFERENCE" ;

  mriRel.elements[15] =  "BYPASS_FITTED_INDICATOR" ;

  mriRel.elements[16] =  "METER_SERIAL_NUMBER" ;

  mriRel.elements[17] =  "METER_MODEL_NAME" ;

  mriRel.elements[18] =  "IMPERIAL_METER_INDICATOR" ;

  mriRel.elements[19] =  "METER_NO_OF_DIGITS_OR_DIALS" ;

  mriRel.elements[20] =  "METER_MECHANISM" ;

  mriRel.elements[21] =  "METER_STATUS" ;

  mriRel.elements[22] =  "METER_COLLAR_FITTED_INDICATOR" ;

  mriRel.elements[23] =  "METER_PULSE_VALUE" ;

  mriRel.elements[24] =  "METER_READING_FACTOR" ;

  mriRel.elements[25] =  "CORRECTOR_SERIAL_NUMBER" ;

  mriRel.elements[26] =  "NO_OF_CORRECTED_DIALS" ;

  mriRel.elements[27] =  "NO_OF_UNCORRECTED_DIALS" ;

  mriRel.elements[28] =  "CORRECTION_FACTOR" ;

  mriRel.elements[29] =  "LAST_READ_DATE" ;

  mriRel.elements[30] =  "LAST_INSPECTION_DATE" ;

  mriRel.elements[31] =  "GAS_ACT_OWNERSHIP_TYPE" ;

  mriRel.elements[32] =  "METER_MANUFACTURER_CODE" ;

  mriRel.elements[33] =  "METER_MANUFACTURED_YEAR" ;

  mriRel.elements[34] =  "CONVERTER_MANUFACTURER" ;

  mriRel.elements[35] =  "CONVERTER_MODEL" ;

  mriRel.elements[36] =  "CONVERTER_MANUFACTURED_YEAR" ;

  mriRel.elements[37] =  "CONVERTER_READING_UNITS" ;

  mriRel.elements[38] =  "CORRECTOR_CORRECTION_FACTOR" ;

  v.add(mriRel) ;

 

  mriRel = new Relation();

  mriRel.parents = new String[1];

  mriRel.elements = new String[39];

  mriRel.node = "U06";

  mriRel.parents[0] =   "NULL" ;

  mriRel.elements[0] =  "TRANSACTION_TYPE" ;

  mriRel.elements[1] =  "CONFIRMATION_REFERENCE" ;

  mriRel.elements[2] =  "METER_POINT_REFERENCE" ;

  mriRel.elements[3] =  "EFFECTIVE_DATE" ;

  mriRel.elements[4] =  "METER_LOCATION_CODE" ;

  mriRel.elements[5] =  "METER_LOCATION_DESCRIPTION" ;

  mriRel.elements[6] =  "METER_INSTRUCTIONS" ;

  mriRel.elements[7] =  "BUILDING_NUMBER" ;

  mriRel.elements[8] =  "BUILDING_NAME" ;

  mriRel.elements[9] =  "DEPENDENT_STREET" ;

  mriRel.elements[10] =  "PRINCIPAL_STREET" ;

  mriRel.elements[11] =  "DEPENDENT_LOCALITY" ;

  mriRel.elements[12] =  "POST_TOWN" ;

  mriRel.elements[13] =  "COUNTY" ;

  mriRel.elements[14] =  "METERING_SET_REFERENCE" ;

  mriRel.elements[15] =  "BYPASS_FITTED_INDICATOR" ;

  mriRel.elements[16] =  "METER_SERIAL_NUMBER" ;

  mriRel.elements[17] =  "METER_MODEL_NAME" ;

  mriRel.elements[18] =  "IMPERIAL_METER_INDICATOR" ;

  mriRel.elements[19] =  "METER_NO_OF_DIGITS_OR_DIALS" ;

  mriRel.elements[20] =  "METER_MECHANISM" ;

  mriRel.elements[21] =  "METER_STATUS" ;

  mriRel.elements[22] =  "METER_COLLAR_FITTED_INDICATOR" ;

  mriRel.elements[23] =  "METER_PULSE_VALUE" ;

  mriRel.elements[24] =  "METER_READING_FACTOR" ;

  mriRel.elements[25] =  "CORRECTOR_SERIAL_NUMBER" ;

  mriRel.elements[26] =  "NO_OF_CORRECTED_DIALS" ;

  mriRel.elements[27] =  "NO_OF_UNCORRECTED_DIALS" ;

  mriRel.elements[28] =  "CORRECTION_FACTOR" ;

  mriRel.elements[29] =  "LAST_READ_DATE" ;

  mriRel.elements[30] =  "LAST_INSPECTION_DATE" ;

  mriRel.elements[31] =  "GAS_ACT_OWNERSHIP_TYPE" ;

  mriRel.elements[32] =  "METER_MANUFACTURER_CODE" ;

  mriRel.elements[33] =  "METER_MANUFACTURED_YEAR";

  mriRel.elements[34] =  "CONVERTER_MANUFACTURER" ;

  mriRel.elements[35] =  "CONVERTER_MODEL" ;

  mriRel.elements[36] =  "CONVERTER_MANUFACTURED_YEAR" ;

  mriRel.elements[37] =  "CONVERTER_READING_UNITS" ;

  mriRel.elements[38] =  "CORRECTOR_CORRECTION_FACTOR" ;

  v.add(mriRel) ;

 

  mriRel = new Relation();

  mriRel.parents = new String[2];

  mriRel.elements = new String[6];

  mriRel.node =  "K15" ;

  mriRel.parents[0] =   "N90" ;

  mriRel.parents[1] = "U06";

  mriRel.elements[0] =  "TRANSACTION_TYPE" ;

  mriRel.elements[1] =  "METER_INSTALLATION_DATE" ;

  mriRel.elements[2] =  "METER_LINK_CODE" ;

  mriRel.elements[3] =  "GAS_NOMINATION_TYPE_CODE" ;

  mriRel.elements[4] =  "DATA_LOGGER_SERIAL_NUMBER" ;

  mriRel.elements[5] =  "DATA_LOGGER_UNIQUE_NUMBER" ;

  v.add(mriRel) ;

 

 

}

public void execute(InputStream in, OutputStream out) throws com.sap.aii.mapping.api.StreamTransformationException

{

     MRIGenToHierMap rel = new MRIGenToHierMap();

     rel.buildXsd();

     new GenToHierMap(in,out,rel.v,"MRI_ABSTRACT","urn:horzon:MRI");

 

}

public static void main (String[] args) throws Exception

     {

          try

          {

               MRIGenToHierMap rel = new MRIGenToHierMap();

               FileInputStream in = new FileInputStream ("H:/j2sdk1.4.2_07/bin/DOM_IN.xml");

               FileOutputStream out = new FileOutputStream ("H:/j2sdk1.4.2_07/bin/DOM_OUT.xml");

               rel.buildXsd();

               new GenToHierMap(in,out,rel.v,"MRI_ABSTRACT","urn:horzon:MRI");

 

          }catch(Exception e) {e.printStackTrace();}

     }

}

 

//Transformation of flat structure to hirearchial structure

 

All the 3 files have to be kept in the same directory and the generic java files should be compiled. Input XML has to be kept in the folder specified in the generic code. I would blog more details about the code depending on the demand for the same.

Ravikumar Allampallam

SAP XI IN ACTION

Posted by Ravikumar Allampallam Jun 22, 2005

SAP XI IN ACTION

Blog highlights the approach followed in the real time for integrating 3rd party file system with SAP IS-U using the SAP XI. It also throws light on the pro&#146;s and con&#146;s of the approach. This blog discusses the approach specific for file to idoc scenarios. In our current project we have around 80 different outbound file based interfaces, which has to be posted as Idocs into SAP IS-U system. We have to configure the 80 file adapters to poll the files, which will be a performance bottleneck. We as a team decided to go for a common approach, which can overcome the above bottleneck. We implemented it and found it really easy and useful. We also developed lot of generic objects, which benefited the project and the team. I will share them in the upcoming blogs.

Let me quickly depict the approach:

1.3rd Party file system sends files and those files are routed to a common folder.
2.Common file CC adapter will poll for CSV files belonging to any interface.
3.After files are received, common file adapter routes them to a common ccBPM.
4.Common ccBPM does content based routing to interface specific ccBPM using the file type in the payload of the file.
5.Interface specific ccBPM converts the common file structure into interface specific idoc structure.
6.Idoc adapter converts the incoming XML file into Idoc format and routes it to the receiver configured in the integration directory.

It can be depicted graphically as shown below:

Generic Approach

Pro&#146;s:

1.Good Performance.

2.Re-usable integration directory and repository objects.

3.Cut down of development effort.

4.Approach itself can be re-used across any XI projects, which involve File-Idoc scenarios.

Con&#146;s:

1.Having one file adapter might slow down the performance, as it is queue based messaged processing. Messages might be held up in case the file adapter is down. However, appropriate number of file adapters can be designed basing on the volume and frequency of file specific to XI project.

2.Initial efforts have to be done to make the proto-type work. Since already the initial efforts are done to make the prototype work, which I will be sharing in the upcoming blogs, the efforts for the upcoming projects are minimized.

Please wait for the upcoming blogs for granule details of the implementation!!!!!!!!!!!!

In this weblog we will see how to give access in a controlled manner to the user to change or create new layouts for the reports. We will also see how the user can select a layout on the selection screen, i.e., even before executing the report



How to restrict the user from creating new layout / changing existing layouts.



Before going into the details we need to understand that there 2 different types layouts available &#150; Global layout and User-Defined layouts. As the name suggests global layouts will be available for all the users, where as the user-defined layouts will be available for only those users who have created it.



Normally this is what the user sees, when an ALV report is displayed.

image

Here the user has got access to do everything with the layouts.



Not sure if you have observed in the last weblog when the SET_TABLE_FOR_FIRST_DISPLAY method was called, there was a parameter called I_SAVE and we passed a value &#145;A&#146; to it. This implies that the user will have all kinds of access to the layouts. Now if we do NOT pass anything to this parameter, the user will loose the privileges to delete / create new layouts. However he will still be able to select a different layout and change an existing one, however he will not be able to save the changed one.



image

Next variation - I_SAVE = &#145;X&#146;.



This is where the trick happens. When you pass &#145;X&#146;, although you see all the options for the layouts, the user will not be able save User-Defined Layouts.



image

image

Next variation - I_SAVE = &#145;U&#148;.



This is exactly opposite to the previous one. The user will be able save only user-define layouts.



image

So, here is the summary.

I_SAVE = SPACE (Default)- Layouts cannot be saved

I_SAVE = &#145;U&#146; - Only User-Define Layouts can be saved

I_SAVE = &#145;X&#146; - Only Global Layouts can be saved

I_SAVE = &#145;A&#146; - Both user-defined and global layouts can be saved.



In addition to these we will see how to remove some of the standard functionality given the standard ALV toolbar.



Now, that we have seen how to control the layouts, we will now see how to access them on the selection screen.



Define a parameters on the selection &#150; screen (Eg: P_LAYOUT LIKE DISVARIANT-VARIANT)



Invoke the following subroutine on value request for the parameter






This subroutine will throw a message if there are no layouts




image


Or, show the list of layouts if available

image


You can select one of the layouts and the name will be populated in the parameter field. Now the question is how to you make sure that this layout is used while showing the grid.



If you have observed there was one more parameter that we passed to SET_TABLE_FOR_FIRST_DISPLAY called IS_VARIANT and the variable that we passed to this was WA_VARIANT. Fill the variable as shown below and the layout tha was selected on the selection will be used to display the grid.



WA_VARIANT-REPORT = SY-REPID.
WA_VARIANT-USERNAME = SY-UNAME.
WA_VARIANT-VARIANT = P_LAYOUT.



Now we know all the options to play with Layouts. However the combination the IS_VARIANT and I_SAVE also play a crucial role. So, use them according to your requirements.



In the next weblog we will see how to restrict the user from using some standard features of the ALV toolbar by not displaying them. Also, we will see how to add custom functions to the toolbar and respond to the events.

Most of us have been developing and using ALV reports for quite sometime now. I haven&#146;t noticed any web logs that give steps of how to go about creating an ALV report from scratch, using control framework technology. Using reusable function module, I am sure the programmers should be able figure out how to use the same. So, I thought it would be a good idea to give the basic steps in creating an ALV report and then follow it up with next web logs where the advanced features of the ALV grid will be used.


Once we reach a certain stage with ALV grid, we will move on to other controls that SAP provides (Tree Control, Text Edit Control etc).


The main difference between a classical report and an ALV report is that we need to create a screen with controls on the same in an ALV report as opposed to in a classical report where we do NOT deal with screens directly, rather use a write statement.


In the example report we will try to develop a simple report to display the material details.


Following the basic structure of a report program ...





In the Screen 100

On the screen, place a control (Can found in the toolbar on the left hand side and maximize to occupy the entire screen (200 x 240). In the attributes of the screen, check the resizing options for both vertical and horizontal. By doing this system will automatically take care of the double scroll bars that might appear, one for the grid if you have got more data and the other one for the screen.


image



image





This report should display a basic ALV Report with the standard toolbar of ALV, which will give the user options to SORT, change the display order, total, sub-total by a specific column etc.



In the next weblog we will see how to control access to the save / change layouts, how to select a layout at the selection screen level etc etc.

We all know about ALV reports and the flexibility and user friendliness that ALV offers to users and ease of development for the technical consultants.

However, off late I have seen requirements where the users want dynamically add or remove columns depending on the data selected. For example, there is a report which compares the same set of fields for a given dimension. To be more precise if for a vendor / RFQ, you want to compare a list of fields and the user wants the comparison to be displayed vertically, that means more number of vendors / RFQ&#146;s, more number of fields need to be added to the output.

Now to the field catalog you can add more fields at runtime depending on the data coming in. However, how to add more columns to the internal table that will be used to display the data on the ALV grid. One crude of way doing is declare an internal table big enough to handle maximum fields and depending on the actual fields coming in at runtime, build the field catalog only for those field required so that the extra fields will not be visible. However, this is not the efficient way doing the same and more over you have every chance that the code might short dump as the field catalog and the structure of the output internal table are in sync.


So the elegant solution for this is to create a table dynamically, with the list of the fields that we have determined at run time. The question is how do we do that. Here is a quick solution.

1. Create your field catalog either manually or automatically using the function module, LVC_FIELDCATALOG_MERGE. Add more rows to the field catalog table (T_FIELDCAT) at run time.


2. Use the field catalog to create a table dynamically using the method below.


DATA: T_OUTPUT TYPE REF TO DATA

FIELD-SYMBOLS: &LT;T_OUTPUT&GT; TYPE TABLE

Call Method CL_ALV_TABLE_CREATE->CREATE_DYNAMIC_TABLE

Exporting

IT_FIELDCATALOG = T_FIELDCAT

Importing

EP_TABLE = T_OUTPUT

ASSIGN T_OUTPUT->* TO &LT;T_OUTPUT&GT;.



Now the field symbol &LT;T_OUTPUT&GT; is pointing to an output table of the structure that contains the fields which were determined at runtime. Now fill this table with the data and pass &LT;T_OUTPUT&GT; to the method SET_TABLE_FOR_FIRST_DISPLAY and the ALV grid should show the data properly.


However, if you want to access or modify or fill in the data for specific columns, you have to use the ASSIGN COMPONENT statement for the specific field name and do it.

 

ABAP Proxies in XI(Client Proxy)



The other way of interfacing XI is through proxies. From WAS 6.20, proxy generation feature enables application systems to communicate with XI using proxies. Proxy generation enables you to create proxies in application systems. Proxies encapsulate the creation or parsing of XML messages and the communication with the relevant runtime components required to send or receive the messages.

Proxies

There are two types of Proxies.

1. Java Proxies.
2. ABAP Proxies.

Java proxies are used when java applications needs to send and receive data and ABAP proxies are used when ABAP applications needs to send and receive data. I am going to demonstrate a simple client proxy which sends the employee data to XI and it routes the information to a file.

We use two clients of XI here. Client 100 acts as XI server .Client 105 acts as a client ABAP proxy which sends employee information as a message to XI which routes the info to a file. Logical flow is depicted as shown below. Note that conversion of sending system format to XI specific format is not done at the outbound side of the XI server.

 

Demonstration of ABAP Proxy
Necessary integration repository objects are developed at the design time. The out bound client proxy message interface and message type is depicted as shown below.

Message Interface

Message Type

After the message interface is developed in the integration repository, proxy is generated on the client 100 using SPROXY transaction. SPROXY transaction lists all the message interfaces in the integration repository. We have to choose our message interface Proxy_Interface_OB and click Create.

Create Proxies

ABAP proxy will generate 3 objects :

1. ABAP Class ( ZBLOGCO_ Proxy_Interface_OB).

2. Structure for the message type in ABAP Data Dictionary (ZBLOGEMP_PROFILE_MSG).

3. Structure for the data type in ABAP Data Dictionary (ZBLOGEMP_PROFILE_DT).

Proxy Objects

Once the proxy objects are activated we can check the ZBLOGCO_Proxy_Interface_OB in the SE24 editor. Since the proxy message interface is asynchronous the ZBLOGCO_ Proxy_Interface_OB has EXECUTE_ASYNCHRONOUS and message type ZBLOGEMP_PROFILE_MSG as the importing parameter. With this proxy generation is over.

Activate Proxy

Proxy Class

ABAP Proxy Class(SE24)

Outbound  Proxy Mesage Structure

We need to develop an ABAP Report in 100 client to trigger a client proxy. The following report is executed in the SE38 Editor for triggering an ABAP Proxy request from client 105.



Receiver adapter configurations should be done in the integration directory and the necessary sender/receiver binding should be appropriately configured. We need not do any sender adapter configurations as we are using proxies.

Sender Service

Receiver Service

 

Triggering ABAP Proxy
We can trigger the ABAP proxy by logging into client 105 of XI server and executing the ABAP report through SE38 editor. Once the report is executed we can see the file on the XI server and contents of file by double clicking the file.

File

Contents of File

I hope this blog will be useful for trying out real time applications on ABAP Proxies.