loading

Logout succeed

Logout succeed. See you again!

ebook img

Execute an ABAP Report From WebDynpro and Display the List Output PDF

pages30 Pages
release year2008
file size0.61 MB
languageEnglish

Preview Execute an ABAP Report From WebDynpro and Display the List Output

Execute an ABAP Report From WebDynpro and Display the List Output In a WebDynpro View. Applies to: Webdynpro ABAP Summary This tutorial shows how to execute an ABAP report, which produces a list output, from a webdynpro screen and then displays the result in the same webdynpro screen. The tutorial demonstrates the use of dynamic programming in Webdynpro ABAP. Author: Priyank Kumar Jain Company: Bristlecone (www.bcone.com) Created on: 08 August 2008 Author Bio Priyank Jain is a senior development consultant working for Bristlecone India. He has been involved in various projects as a technical consultant in ABAP and Webdynpro. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 1 Execute an ABAP Report From WebDynpro and Display the List Output In a WebDynpro View. Table of Contents Create a report program.....................................................................................................................................3 Report Selection screen..................................................................................................................................3 Report output..................................................................................................................................................4 Creating webdynpro assistance class................................................................................................................4 Class Attributes...............................................................................................................................................4 Class Methods................................................................................................................................................5 Creating Webdynpro component and view.........................................................................................................6 Creating the webdynpro component...............................................................................................................6 Creating the View............................................................................................................................................6 Creating the view context.............................................................................................................................................7 Creating the view layout...............................................................................................................................................8 Create actions for button and Inputfield.......................................................................................................................9 Implementing the event handlers of the view.............................................................................................................11 Coding the wddoModifyview method.........................................................................................................................15 Implementing Assistance class methods...................................................................................................................23 Create Webdynpro Application..................................................................................................................................25 Output........................................................................................................................................................................25 Limitations.........................................................................................................................................................28 Related Content............................................................................................................................................29 Disclaimer and Liability Notice..........................................................................................................................30 SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 2 Execute an ABAP Report From WebDynpro and Display the List Output In a WebDynpro View. Create a report program To start off, create a report program in ABAP that is going to be executed from the webdynpro application. In this example, we will create a report with a selection screen having parameters, checkboxes and radio- buttons. Name the report as ZTEST_REPORT. The report will display the data based on the selections made by the user on the selection screen. The selection screen will later be replicated in the webdynpro view for taking user inputs. Report Selection screen A sample selection screen looks like the one below Note: Please note that this example does not deal with select-options and the usage of selection-screen blocks. It can of course be used and replicated in webdynpro but is not in the scope of this basic tutorial. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 3 Execute an ABAP Report From WebDynpro and Display the List Output In a WebDynpro View. Report output The report produces the following sample output. Note that this is a list output based on the inputs in the selection screen above. Creating webdynpro assistance class Before we create our webdynpro component and view, let’s first create a class that is going to serve as the assistance class for the webdynpro component. This class will define the methods that will execute the report as well as pass the selection-screen information to the report from webdynpro to the report. Open transaction SE24 and create a new class. Name it as ZTESTASSISTANCE. Create the class as a usual ABAP class. Class Attributes Create the attributes of the class as shown below SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 4 Execute an ABAP Report From WebDynpro and Display the List Output In a WebDynpro View. Here, I created a Z-table type ZTT_RADIO_LEADSEL for the attribute MT_RADIO_LEADSEL. It has a line type whose structure is as below. The other attributes have standard SAP types. NODE_NAME TYPE CHAR255 NODE_REF TYPE REF TO IF_WD_CONTEXT_NODE LEAD_SEL TYPE INT1 Class Methods Declare the following methods in the class. The implementation of these methods will be done at a later stage in the tutorial. Method Name Level Visibility Parameters Name Type Associated Type Description EXEC_REPORT Instance Public REPNAME Importing STRING Report name TAB_OUTPUT Exporting STRING_TT Table of strings CT_PARAMS Changing RSPARAMS_TT RSPARAMS table GET_REP_SELSCREEN_INFO Instance Public REPNAME Importing STRING Report Name CT_SSCR Exporting RSBK_T_RSSCR Selection-Screen info. CT_TEXTTAB Exporting TEXTPOOL_TABLE Text elements SET_ATTR_INFO Instance Public CT_ATTR_INFO Importing ZTT_WDR_CONTEXT_ATTRIBUTE_INFO* CT_SELTEXT Importing TABLE_OF_TEXTPOOL CT_RADIO_LEADSEL Importing ZTT_RADIO_LEADSEL CT_SSCR Importing RSBK_T_RSSCR GET_ATTR_INFO CT_ATTR_INFO Exporting ZTT_WDR_CONTEXT_ATTRIBUTE_INFO* CT_SELTEXT Exporting TABLE_OF_TEXTPOOL CT_RADIO_LEADSEL Exporting ZTT_RADIO_LEADSEL CT_SSCR Exporting RSBK_T_RSSCR *ZTT_WDR_CONTEXT_ATTRIBUTE_INFO is a table type having WDR_CONTEXT_ATTRIBUTE_INFO as its line type. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 5 Execute an ABAP Report From WebDynpro and Display the List Output In a WebDynpro View. Creating Webdynpro component and view Creating the webdynpro component Open transaction SE80 and create a new webdynpro component. Name it as ZWDTEST_REPORT. Assign the class created above as the assistance class for this webdynpro component. Creating the View A view named MAIN will get created by default when the webdynpro component is created and saved. If not, then create one and name it as MAIN. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 6 Execute an ABAP Report From WebDynpro and Display the List Output In a WebDynpro View. Creating the view context Create nodes and attributes in the context tab of the view MAIN as shown in the following screenshot. The types of the attributes should be as below. Node Attribute name Attribute type REPORT REPNAME STRING SUBMIT VISIBLE WDUI_VISIBILITY SELSCREEN_CONTAINER VISIBLE WDUI_VISIBILITY RBG TEXT STRING RPT_OUTPUT OUTPUT_TEXT string Ensure that all the nodes created above have the default cardinality of 1:1 and selection 0:1. The initialization lead selection checkbox is checked for all the nodes. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 7 Execute an ABAP Report From WebDynpro and Display the List Output In a WebDynpro View. Creating the view layout Open the layout tab of the view and insert UI elements required to be displayed on the view. The layout of the view should look like the one shown in the following screenshot. The UI elements list is shown below As you can see above, the view contains a label, an input field for the name of the report to be executed, a selection screen container which will hold the dynamically replicated report selection screen and a text view element which will be used to show the list output of the report. Bind the properties of the UI elements to the respective context attribute as mentioned in the following table. UI Element Property Node Attribute REPNAME VALUE REPORT REPNAME SELSCREEN_CONTAINER VISIBLE SELSCREEN_CONTAINER VISIBLE SUBMIT VISIBLE SUBMIT VISIBLE TEXT_VIEW TEXT RPT_OUTPUT OUTPUT_TEXT SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 8 Execute an ABAP Report From WebDynpro and Display the List Output In a WebDynpro View. Create actions for button and Inputfield We need to define an action for the Submit button on the view. Create an action named as SUBMIT for the event OnAction of the button. The properties of the SUBMIT button will thus look like below. Also, create another action for the OnEnter event of the input field REPNAME. Name this action as ENTER. The properties of the input field should look like the screenshot below. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 9 Execute an ABAP Report From WebDynpro and Display the List Output In a WebDynpro View. Creating these actions will create the event handler methods named ONACTION_SUBMIT and ONACTION_ENTER in the view controller. Navigate to the ‘Methods’ tab to find these methods there. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 10

See more

The list of books you might like