1) How to export Structure and Table of details as input Parameters for RFC call
2) It will also explains how to use Templates (Custom Templates and View Templates) effectively.
3) How to use View Sets
This blog will be very useful for starters as it gives a details and complete walk through..
We will carry out our remote calls to the backend ABAP system using an Adaptive RFC model. To write data into the table in the ABAP system we will make use of existing functions in the form of writing BAPIs that are implemented as RFC function modules.
For each function module that we need in our Web Dynpro application, the corresponding Java proxy classes will be generated. All the generated proxy classes and interfaces are bundled together with the corresponding Dictionary information from the ABAP system in the RFC model and are treated as part of our Web Dynpro project.
Many of us know about these details. Here I am going to explain clearly about how to handle Structure and Table of details as import parameters for BAPIs with an example scenario.
In this web log we are going to see full details about how to create Sales order for an organization using adaptive RFC model .
Creating Sales order is a very common process followed in any business cycle.
Let us go with our example scenario Sales Order Creation using Adaptive RFC Models…
I. Import required models
Here we need to import the BAPIs required to create sales order as models. Here we need two bapis.
To create sales order using the bapi BAPI_CREATESALESORDERFROMDAT2 following details are commonly required.
- A) Header details:
- 1. Document Type
- 2. Sales group
- 3. Sales org
- 4. Sales group
- 5. Distri channel
- 6. Divition
- B) Partner Details:
- 1. Partner number
- 2. Partner role
- C) Item Details:
- 1. Item Number
- 2. Material
- 3. Unit of measure
- 4. Order quantity
- D) Schedules Item details
- 1. Item no
- 2. Order quantity
These are the common details required to create a sales order.
- This method executes a COMMIT WORK command in the ABAP system. It is required for transactions developed externally in the ABAP system that change data in the system via BAPI calls. When you call BAPIs in your client application that changes data in the ABAP system, we must then call this method to write the changes to the database.
One more important point here is we need to commit our process within the same session.
So better is to import these 2 BAPIs in one model.
Then the Project Structure will be like this.
II. Include the imported models in Used Models of our Component.
In the used model of Salesordercreate component include this model.
III. Creating the Contexts of the Custom Controllers Using Custom Template
The custom controller SOCREATECust is responsible for creating the Sales order to the SAP system, so it needs to be able to map the corresponding input and output to the SOCREATE model. We can use two methods to establish this correspondence between the custom controller and the model
1) Using Data modeler method.
2) Using the Custom Template.
Here we are going to use Custom Templates because it is very easy and simple one.
In this way, we can ensure that the model data is stored and manipulated in a central location. The template will create corresponding context mapping and methods required top initialize and execute the Bapis input node.
Then select appropriate nodes from the template screen.
During this process we can also create method to execute that bapi.
Now the Custom controller context structure will be like this.
The created wdDoInit () and Execute methods will be like this..
Similar Process has to be repeated for BAPI_TRANSACTION_COMMIT.
IV) Creating Corresponding Contexts in CreateSalesOrder View using DATA MODELER.
To display and change the data which is stored in the back end, you also need to create an appropriate context in the CreateSalesOrderView which is mapped to the SOCreateCust context. This mapping can be done as like this.
As this weblog is too long we will see the important Topic of Handling structure and Table details for RFC and effective Usageof Viewsets in our Next blog.