Skip to Content

In our project we came across a requirement where we had to integrate and pass data between standard ABAP transactions and web dynpro ABAP application. While searching on SDN for solution I came across a forum Re: how to exchange data between wda program and abap program? where Thomas Jung had suggested using server side cookies or dumping the data into intermediate tables in order to pass data between standard ABAP and Web Dynpro ABAP.

 

In our scenario we had a collective data comprising of 5 nodes each having around 10-15 attributes in the Web Dynpro application. The data from these nodes was required to be passed to the standard ABAP transaction and vice versa. To accomplish this using table’s meant creating 5 intermediate tables to store the data for communication. And in future if the number of nodes to be transferred increased then the same of number of additional intermediate tables had to be created.

 

To make this communication more generic we used a combination of techniques.

 

The technique involved of following steps:

  • Dumping the data into serializable ABAP class instance(Data transfer objects). 
  • Serialize the ABAP class using transformations to XML string.
  • Store the XML string into an intermediate table.
  • Retrieve the XML string in the target SAP transaction or Web Dynpro application.
  • Deserialize the XML string to construct the ABAP object again.
  • Retrieve the data back from the object.

 

In this blog I would try to guide you in creating a Demo Scenario.

 

SAP System used for the demo: SAP Netweaver 7.01 (EhP1)

 

The objects to be created for the demo are:

 

Name

Type

Description

ZMADYN_ABAP_COMM

Table

Data communication table between Web Dynpro application and ABAP. This table would hold the intermediate serialized data in the form of XML string.

ZSERIAL_DTO

Class

ABAP class which implements the interface IF_SERIALIZABLE_OBJECT. The web dynpro application and the ABAP code would dump the data into the instance of this class. The respective class object would then be serialized into XML string and saved in the communication table for data transfer.

Z_SERIAL_TEST

Executable

An executable report program depicting a standard SAP transaction.

ZWD_SERIAL_TEST

Web Dynpro

The Web Dynpro Component

 

 

The sequence diagram in this link elaborates the exact process flow.

     

Step by step creation of the objects:

 

Step 1) Create the Table ZMADYN_ABAP_COMM

The table has the following attributes:

The unique GUID would be generated by the source SAP transaction (Z_SERIAL_TEST) and then passed as an URL parameter to the web dynpro application. This unique GUID would be used by the web dynpro application to retrieve the communication data (XML String) from the table which would then be deserialized to extract the data. This XML string would be dumped by the SAP transaction against the GUID.

 

After creating the table you can create the rest of the objects by importing the nugget NUGG_SERIAL_ABAP_DYN_COMM-1.0.nugg using the tool SAPlink.

After importing the nugget activate all the created objects and execute the program Z_SERIAL_TEST and skip to the Execution section of this blog.

 

Instead of importing the nugget you can also choose to manually create the objects as per the following steps:

Step 2) Create the ABAP class ZSERIAL_DTO

Implement the interface IF_SERIALIZABLE_OBJECT

 

Create the following attributes to hold the communication data

In the real scenarios the attribute list in the class would have structure and table type for storing communication data corresponding to the web dynpro node values.

 

Create a Public method SET_DATA have the following import parameters and code:


 

Create a Public method GET_DATA have the following export parameters and code:

  


Step 3)
Create the Report Program Z_SERIAL_TEST

 

Program Code:

 

Create the Text Symbols and Selection Text within the program so that the screen looks as follows:

 

On click of the ‘Send data’ button the values filled in the selection screen would be assigned to the ZSERIAL_DTO object instance. A unique GUID will be generated against which the serialized XML string of the object would be stored in the communication table ZMADYN_ABAP_COMM. The web dynpro application would then be called passing the GUID as an URL parameter. The Web Dynpro compoent would then retrieve the XML string based on the GUID and deserialized it into the target object which would house the data transferred.

 

Step 4) Create the Web Dynpro component

Web Dynpro Component name: ZWD_SERIAL_TEST

Web Dynpro Application name: ZWD_SERIAL_TEST

 

Create the following nodes/attributes in the Component controller.

Node Name

Attribute Name

Type

URL_PARA

GUID

GUID_32

DATA

FIRST_NAME

CHAR10

LAST_NAME

CHAR10

AGE

INT3

 

 

Map these nodes to the default Window and the MAIN view context.

 

Create an attributes in the component controller as shown in the figure:

 

 

Create the following import parameters in the default plug’s handler method (HANDLEDEFAULT) of the component’s default window ZWD_SERIAL_TEST:

 

Insert the following code in the HANDLEDEFAULT event handler of the Window.

The code in HANDLEDEFAULT would be responsible for retriving the XML string based on GUID and deserialize it to target object. Once the object has been serialized the values can extracted by calling the method GET_DATA( ) on the object.

 

 

Create and bind the UI element in the MAIN view as per the following image:

 

 

Create an action UPDATE in the MAIN view and bind it to the button ‘Update’.

The action update would consist of the following code.

The code in the UPDATE action would be responsible for updating user changed values back to the object. This method would also serialize the object into XML string and update the communication table ZMADYN_ABAP_COMM with the new XML string based on GUID. 

 

Activate all the objects.

 

Execution:

Steps to execute the test scenario 

  • Run the program Z_SERIAL_TEST.
  • Fill the data to be passed to web dynpro and click the button ‘Send data’. This would open the web dynpro application pre populated with the data which was transferred from the report program.
  • Edit the data in the web dynpro application and click on ‘Update’ button.
  • Go back to the SAP GUI screen click on the ‘Retrieve Data’ button to get the updated data back.
To report this post you need to login first.

2 Comments

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

    1. Ameya Suvarna Post author
      Hi Prabhu,

      We had built a custom application in Web Dynpro ABAP and needed to reuse its functionality from the Create Sales order transaction VA01. And to do so we needed to pass data from VA01 to the Web Dynpro application and collect data back from it.

      Regards,
      Ameya

      (0) 

Leave a Reply