Mandatory Field Check in Web Dynpro- ABAP



Similar documents
Table of Contents. Passing Data across Components through Component Controller between Two Value Nodes

This document applies to SAP ECC 6.0, SAP Netweaver 2004s. For more information, visit the Web Dynpro ABAP homepage.

Quick Viewer: SAP Report Generating Tool

Step by Step Guide for Language Translation Tool

Web Dynpro: Multiple ALV Grids and Layouts in ALV

Splitting the Custom Container & Display more than one ALV

Web Dynpro ABAP: ALV and Table in Popup Window

Tutorial - Creating Pop Up Window Using New Features in WebDynpro Java CE 7.1 Ehp1

Step by Step Guide How to Copy Flat File from Other Application Server to BI and Load through Info Package

SAP CRM System 6.0/7.0. For more information, visit the Customer Relationship Management homepage

SAP CRM Campaign Automation

How to Assign Transport Request for Language Translation?

Creating Transaction and Screen Variants

Deleting the User Personalization done on Enterprise Portal

Embedding Crystal Reports inside ECC ALV Reports

How to Modify, Create and Delete Table Entries from SE16

Display Options in Transaction SE16

Exposing RFC as Web Service and Consuming Web Service in Interactive Forms in ABAP

Configuration of Enterprise Services using SICF and SOA Manager

Step by Step Guide to Extract Batch Master Data via Generic and Classification Datasource to BW

ALV List with Radio Buttons

Message handling in SAP CRM Web UI

Step by Step Procedure to Block and Debug a CIF Queue Flowing from R/3 to APO System

ALE Settings, for Communication between a BW System and an SAP System

SAP FI - Automatic Payment Program (Configuration and Run)

Restricting Search Operators in any Search View

Standard SAP Configuration of SMS through HTTP with Third Party SMS Gateway

ABAP Debugging Tips and Tricks

SAP BI Generic Extraction Using a Function Module

Creating Web Service from Function Modules/BAPIs & Integrating with SAP Interactive Forms

Reverse Transport Mechanism in SAP BI

SAP BW - Excel Pivot Chart and Pivot Table report (Excel)

Creating Content Using SO10 Objects and Text Symbols

How to Create an ecatt?

Drag and Drop Functionality in Web Dynpro ABAP Application

SAP NetWeaver Developer Studio 7.30 Installation Guide

Creating New Unit of Measure in SAP BW

Order Split Usage in Production Orders

SAP Workflow in Plain English

Invoice Collaboration: Self Billing Invoice

Guidelines for Effective Data Migration

Understanding BW Non Cumulative Concept as Applicable in Inventory Management Data Model

Release Strategy Enhancement in Purchase Order

How to Generate Stack Xml for Ehp4 and Above Upgrade

LSMW: Upload Master Data using Batch Input Recording

Multi Provider Creation Based on Sales and Planning Info Cubes

SDN Community Contribution

ABAP How To on SQL Trace Analysis

BW Performance Monitoring

Step by Step guide of Report-to- Report Interface in BW Reporting

Creation and Configuration of Business Partners in SAP CRM

SAP MM: Purchase Requisition with Classification and Workflow Approval

SAP CRM 7.0 for Newbies: (Part 1) Simple BOL Object Creation for CRM Webclient UI

First step to Understand a Payroll Schema

ABAP Proxy Interfacing

Deploying Crystal Reports on Top of a SAP BI Query

Working with SAP BI 7.0 Data Transfer Process (DTP)

Understanding OLAP Processor and RSRT

Deleting the Requests from the PSA and Change Log Tables in Business Intelligence

Workflow Troubleshooting and Monitoring in SAP ECC 6.0

Business Scenario Using GP/Web Dynpro with Back and Forth 3 Level Process and Dynamic Approvers in a Loop

Using PI to Exchange PGP Encrypted Files in a B2B Scenario

SAP BW - Generic Datasource Function Module (Multiple Delta Fields)

Transfer of GL Master from Source SAP System to a Target SAP System through IDOCS

How to Develop Programs for SAP Mobile RF

Process Controlled Workflow SRM 7.0 (Using BRF)

Salesforce.com Integration Using SAP PI: A Case Study

Different Types of Alerts for Process Chains. Table of Content

How to Integrate CRM 2007 WebClient UI with SAP NetWeaver Portal

How to Get Work Items from Workflow in your Outlook Inbox

Compounding in Infoobject and Analyzing the Infoobject in a Query

SAP CRM 7.0 E2C Setup: CRM via Toolset

Create Automatic Mail Notification/ Alert for Process Chain Monitoring

Converting and Exporting Data in XML Format

Table of Content. SAP Query creation and transport Procedure in ECC6

Scenario... 3 Step-by-Step Solution Virtual Infocube... 4 Function Module (Virtual InfoCube)... 5 Infocube Data Display... 7

SAP CRM-BW Adapter an Overview

Understanding BEx Query Designer: Part-2 Structures, Selections and Formulas

SPDD & SPAU Adjustments Handbook

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

Extractor in R/3 and Delta Queue

Creating Mobile Applications on Top of SAP, Part 1

Step by Step Guide to Create a Generic Datasource Based on Infoset Query Populated Via External Program

Inventory Management (0IC_C03) Part - 3

Step by Step Procedures to Load Master Data (Attribute and Text) from FlatFile in BI 7.0

Vendor Consignment. Applies to: Summary. Author Bio. SAP ECC 6.0. For more information, visit the Supply Chain Management homepage.

Creating and Scheduling Publications for Dynamic Recipients on SAP Business Objects Enterprise

Consuming Services in SOA Manager

Valuation of Materials using FIFO Method

Implementing TinyMCE JavaScript HTML Editor for Web Page Composer (WPC) within the SAP Portal

Dynamic Authorization Concept and Role Assignment in BI

Data Flow from LBWQ/SMQ1 to RSA7 in ECC and Delta Extraction in BI

Embedding Custom Images Inside Tables in Web Templates

ESS- Performance Management System Configuration on Portal for ECC 6 Ehp4

Sales Commission Calculation & Settlement Handling through Order Processing

Introduction to COPA and COPA Realignment

Configuration and Utilization of the OLAP Cache to Improve the Query Response Time

Currency Conversion using Variables in SAP BI -Reporting

ALV Object Model Simple 2D Table Event Handling

This article demonstrates in a step-by-step process to write ABAP Reports that use BAPI function modules.

Transcription:

Mandatory Field Check in Web Dynpro- ABAP Applies to: SAP ECC 6.0 Onwards. For more information, visit the Web Dynpro ABAP homepage. Summary Efficient way to Apply Mandatory/Obligatory field Check on Input fields in a View. Author: Akash Rana Company: Deloitte Touche Tohmatsu Created on: 7 April 2011 Author Bio Akash Rana is a SAP ABAP Technical Consultant with expertise in development across multiple modules. He is experienced in developing Web dynpro based applications, UI, forms, ALE / IDOCS and data transfer across multiple modules. 2011 SAP AG 1

Table of Contents Introduction... 3 Application Overview... 3 Step by Step Process... 3 Step 1: Create a Web Dynpro Component.... 3 Step 2: Create Context for View V_MAIN.... 3 Step 3: Design Layout.... 5 Step 4: Implement Hook Method WDDOBEFOREACTION( ).... 6 Step 5: Implement Event Handler Method, Activate and Create an Application.... 7 Application... 8 Mandatory Field Check... 8 Related Content... 9 Disclaimer and Liability Notice... 10 2011 SAP AG 2

Introduction Sometimes we have a requirement to except entries on a view and perform a mandatory check on them. If all of the fields for mandatory check are filled, we need to process the data accordingly, if all fields are not filled then we need to issue a message and cancel the further processing. There are many ways to perform the above task, here I will share a very efficient way to perform mandatory field check, without checking mandatory fields in related action handler methods manually. Application Overview Our application will accept Batch, Material and Plant (Mandatory fields in view) and display corresponding Sales Document's and its Item details - Sales Document, Item No., Net value and Document Currency in a table. Input Fields are Batch, Material and Plant, which are mandatory fields. We would apply mandatory check on these fields, if any of the above fields is empty, error message would be returned on the view and further processing would be canceled. Step by Step Process Step 1: Create a Web Dynpro Component. Go to SE80 and create a WD Component. Step 2: Create Context for View V_MAIN. In the view context create node- ND_FILTER (Node attributes will be used as Input Fields on View V_MAIN) Attributes- CHARG (Type VBAP-CHARG), MATNR (Type VBAP-MATNR), WERKS (Type VBAP-WERKS). Cardinality- 1..1 2011 SAP AG 3

ND_SALES_DOC (Node will be Attached to Data Source of UI Table in view V_MAIN) Attributes- VBELN (Type VBAP-VBELN), POSNR (Type VBAP-POSNR), NETWR (Type VBAP-NETWR), WAERK (Type VBAP-WAERK) Cardinality- 0..n 2011 SAP AG 4

Step 3: Design Layout. Create Input Fields using Node ND_FILTER for attributes - CHARG (Batch No.) MATNR (Material), WERKS (Plant) and set the value for the STATE Property of Input Fields as "required". This would result a red asterisk in front of input fields, to indicate that it's a mandatory entry field. This is only for display option, we need to explicitly implement this check. Create a Button and Action- GET_DETAILS to fetch Sales Document details based on entries in input fields. Create a Table UI with Data Source linked to context node ND_SALES_DOC and columns as Sales Document, Item No., Net value and Document Currency. 2011 SAP AG 5

Step 4: Implement Hook Method WDDOBEFOREACTION( ). Hook method WDDOBEFOREACTION is triggered before any Event Handler associated with an Action. We need to check weather user has enters all the mandatory fields once he triggers Event Handler Method - ONACTIONGET_DETAILS associated with Button Submit. Hook method WDDOBEFOREACTION would be triggered before Event Handler Method - ONACTIONGET_DETAILS, here we can check for the mandatory field check using class CL_WD_DYNAMIC_TOOL, following is the implementation of wddobeforeaction( ) hook method. Implementation of Hook Method- WDDOBEFOREACTION- METHOD wddobeforeaction. * Reference to View API DATA lo_api_controller TYPE REF TO if_wd_view_controller. * Reference to Action DATA lo_action TYPE REF TO if_wd_action. * Get API of View Controller lo_api_controller = wd_this->wd_get_api( ). * Get Current Action Called. lo_action = lo_api_controller->get_current_action( ). * Check Action 2011 SAP AG 6

IF lo_action IS BOUND. CASE lo_action->name. * Check of Action Get Details associated with button submit on View V_MAIN WHEN 'GET_DETAILS'. CALL METHOD cl_wd_dynamic_tool=>check_mandatory_attr_on_view EXPORTING view_controller = lo_api_controller. "Export current view API ENDCASE. ENDIF. ENDMETHOD. Here we have used method CHECK_MANDATORY_ATTR_ON_VIEW of class CL_WD_DYNAMIC_TOOL to perform Mandatory check for input field UI elements with property STATE as 'required'. Once the error message is raised Further processing of event handler method or navigation or wddomodifyview( ) method will not be executed as Error message raise by above method are error message with a context reference. Step 5: Implement Event Handler Method, Activate and Create an Application. 2011 SAP AG 7

Application Mandatory Field Check 2011 SAP AG 8

Related Content Navigation in Web Dynpro ABAP Using Dynamic ALV with Web Dynpro ABAP with Editable Fields Assign Search Help to a Field at Runtime in Web Dynpro ABAP For more information, visit the Web Dynpro ABAP homepage 2011 SAP AG 9

Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document. 2011 SAP AG 10