Upload Data in Web Dynpro Table from a Text File with Delimiters



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

Deleting the User Personalization done on Enterprise Portal

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

Configuration of Enterprise Services using SICF and SOA Manager

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

SAP CRM Campaign Automation

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

Creating Transaction and Screen Variants

How to Integrate CRM 2007 WebClient UI with SAP NetWeaver Portal

How to Create an ecatt?

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

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

Step by Step Guide for Language Translation Tool

Reusable WebDynpro Component for Export to Excel from Table UI Element. (Generic Method).

Restricting Search Operators in any Search View

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

SAP NetWeaver Developer Studio 7.30 Installation Guide

LSMW: Upload Master Data using Batch Input Recording

Configuring HTTPs Connection in SAP PI 7.10

Creating New Unit of Measure in SAP BW

Forgot or Lock "Administrator or J2EE_ADMIN" Password

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

Display Options in Transaction SE16

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

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

Splitting the Custom Container & Display more than one ALV

Deploying Crystal Reports on Top of a SAP BI Query

Reverse Transport Mechanism in SAP BI

How to Generate Stack Xml for Ehp4 and Above Upgrade

Process Controlled Workflow SRM 7.0 (Using BRF)

Creating Content Using SO10 Objects and Text Symbols

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

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

Quick Viewer: SAP Report Generating Tool

How to Assign Transport Request for Language Translation?

Web Dynpro: Multiple ALV Grids and Layouts in ALV

SAP CRM 7.0 E2C Setup: CRM via Toolset

SAP FI - Automatic Payment Program (Configuration and Run)

Web Dynpro ABAP: ALV and Table in Popup Window

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

BW Performance Monitoring

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

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

Creation and Configuration of Business Partners in SAP CRM

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

XSLT Mapping in SAP PI 7.1

Order Split Usage in Production Orders

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

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

Multi Provider Creation Based on Sales and Planning Info Cubes

ABAP Debugging Tips and Tricks

How to Modify, Create and Delete Table Entries from SE16

Web Application Designer for Beginners

Step by Step Procedure to Create Broadcasters, to Schedule and to Enhance of SAP- BI Queries from Query Designer

A Step-by-Step guide on SMTP Configuration and File to Mail Scenario Using Process Integration Scenario in PI 7.1

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

SDN Community Contribution

Data Extraction and Retraction in BPC-BI

Working with SAP BI 7.0 Data Transfer Process (DTP)

Understanding OLAP Processor and RSRT

Embedding Crystal Reports inside ECC ALV Reports

ABAP How To on SQL Trace Analysis

Deploying JDBC drivers in PI 7.1x Systems

ABAP Proxy Interfacing

First step to Understand a Payroll Schema

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

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

SAP NetWeaver Portal Development Kits for.net and Java

Mandatory Field Check in Web Dynpro- ABAP

Currency Conversion using Variables in SAP BI -Reporting

SAP BW 7.3: Exploring Semantic Partitioning

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

Consuming Services in SOA Manager

Creating Mobile Applications on Top of SAP, Part 1

Compounding in Infoobject and Analyzing the Infoobject in a Query

Different Types of Alerts for Process Chains. Table of Content

How to Load Data from Flat Files into BW PSA

Understanding DSO (DataStore Object) Part 1: Standard DSO

Query OLAP Cache Optimization in SAP BW

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

Converting and Exporting Data in XML Format

Create Automatic Mail Notification/ Alert for Process Chain Monitoring

SAP Workflow in Plain English

Salesforce Integration Using PI: How to Perform Query and Other DML Operations Using the Enterprise WSDL

Extractor in R/3 and Delta Queue

Inventory Management (0IC_C03) Part - 3

SAP CRM-BW Adapter an Overview

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

Guidelines for Effective Data Migration

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

APD to Update Marketing Attributes from SAP BI to SAP CRM

Step By Step Procedure to Create Logical File Path and Logical File Name

BI 7.0 and EP 7.0 Integration using Template Installer

Inventory Management in SAP BW

Credit Management in Sales and Distribution

Message handling in SAP CRM Web UI

Salesforce.com Integration Using SAP PI: A Case Study

Adobe Document Service Configuration and Troubleshooting Guide

Sending an Image File Through XI in a File-to-Mail Scenario

Invoice Collaboration: Self Billing Invoice

Transcription:

Upload Data in Web Dynpro Table from a Text File with Delimiters Applies to: SAP NetWeaver Web Dynpro. For more information, visit the Portal and Collaboration homepage. Summary This article uploads the data from a text file with delimiters to a Web Dynpro table UI element. Author: Nikhil Tapkir Company: L & T Infotech Created on: 09 November 2009 Author Bio Nikhil Tapkir works as an NetWeaver Consultant in L & T Infotech and has an experience of two years. 2009 SAP AG 1

Table of Contents Application Details and Requirements:... 3 Steps to Create the Application... 3 Application Results... 9 Related Content... 10 Disclaimer and Liability Notice... 11 2009 SAP AG 2

Application Details and Requirements: This application uploads the data from a flat file i.e. a text file and uploads the data into the webdypro Table UI element. In short the application will read data from the text file. The text file should have the following format the columns values should be separated by delimiters and each line should contain a single record if the data is to be uploaded into a table. Below the screen shot has been attached for the flat file. Steps to Create the Application 1. Create a Web Dynpro application. 2009 SAP AG 3

Right Click on Dc Create an application. Click on next.finally on Finish. 2009 SAP AG 4

2. Create a context Structure in the ApplntextileView as shown below. The Properties for the node ctx_va_contexttxt Ctx_va_col1, Ctx_vacol2,ctx_va_col3 and ctx_va_file are of the type String. Ctx_va_resource of the type given below. 2009 SAP AG 5

3. Add the file upload UI element and using apply template create a Table UI element using the ctx_va_contexttxt node Properties of the table UI element. Properties of the File Upload UI element. 2009 SAP AG 6

4. Add a Button UI element and create an action aupload. 5. Go to the implementation tab of the View and copy the following code in the method generated on creating the action aupload. public void onactionaupload( com.sap.tc.web Dynpro.progmodel.api.IWDCustomEvent wdevent) { //@@begin onactionaupload(serverevent) InputStream text = null; int temp = 0; try { File file = new File( wdcontext.currentcontextelement().getctx_va_resource().getresourcename().tostring()); FileOutputStream op = new FileOutputStream(file); if (wdcontext.currentcontextelement().getctx_va_resource()!= null) { text = wdcontext.currentcontextelement().getctx_va_resource().read( false); while ((temp = text.read())!= -1) { op.write(temp); op.flush(); op.close(); String filepath = file.getabsolutepath(); BufferedReader input = new BufferedReader(new FileReader(filePath)); String line = null; "#$", false); while ((line = input.readline())!= null) { StringTokenizer st = new StringTokenizer(line, 2009 SAP AG 7

while (st.hasmoretokens()) { IPrivateApplntextileView.ICtx_va_contenttxtElement ele = wdcontext.createctx_va_contenttxtelement(); String col1 = st.nexttoken(); String col2 = st.nexttoken(); String col3 = st.nexttoken(); if (!col1.equalsignorecase("null")) { ele.setctx_va_col1(col1); else { ele.setctx_va_col1(null); if (!col2.equalsignorecase("null")) { ele.setctx_va_col2(col2); else { ele.setctx_va_col2(null); if (!col3.equalsignorecase("null")) { ele.setctx_va_col3(col3); else { ele.setctx_va_col3(null); wdcontext.nodectx_va_contenttxt().addelement(ele); catch (Exception e) { e.getmessage(); //@@end Note: The delimiter in above case is #$. 6. Save the application right click on the dc build the dc and deploy. 7. Run the application. 2009 SAP AG 8

Application Results 1. Click on browse and upload the correct flat file i.e. the file in which the data is to be uploaded. 2. After selection of the file click on upload button. The data from the text file is uploaded into the table. 2009 SAP AG 9

Related Content Office Control in Web Dynpro II Uploading Excel File With Example in Web Dynpro Java Application For more information, visit the User Interface Technology homepage. 2009 SAP AG 10

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. 2009 SAP AG 11