You are on page 1of 34

Script Error Fix

script-error.smartpcfixer.com Follow These 3 Steps Instantly, Fix Script Error Under 2 Min!
HOME ABAP INTERVIEW QUESTIONS Privacy Policy REPORTS SAP DIALOG PROGRAMMING Dow nloads SCRIPTS SMARTFORMS BDC

Home ENHANCEMENTS About Us Contact US

SAP Interview Questions w ith Answ ers Books

Cross Applications

RFC

BAPI

ALE IDOC

Object Oriented ABAP

Web Dynpro

Work Flow

Downloads

Sap ABAP

C# Script

Perl Script

Post Script
Your contribution can keep this blog alive!!!

SAP ABAP Interview Questions


Like 1,583 people like SAP ABAP Interview Questions.

Script Error Fix


script-error.smartpcxer.com Follow These 3 Steps Instantly, Fix Script Error Under 2 Min!

F acebook social plugin

Script Tutorial Real Time Scenario on Purchase Order Creation


Recommend this on Google

GOOGLE TRANSLATOR
Select Language
Powered by

Translate

FOLLOW BY EMAIL
Email address... Submit

Sap ABAP Tutorial Window Shell Script C# Script

Python Script Examples Perl Script Programming Script

Search
FOLLOW US ON TWITTER!

Dear Readers this post explains the Script Tutorial Real Time Scenario on Creation of Purchase Order, in this post i'm explained step by step procedure to create Script on Purchase Order. This post gives the complete idea about the creation of Script for beginners. Lets's go through this post for more details about creation of script. Interested ABAP'ers click on read more to read the post.

SAP ABAP Intervie


Follow
+ 136

+1

POPULAR POSTS
SAP OO ABAP, OOPS ABAP Interview Questions Answers

Script Tutorial Real Time Scenario on Purchase Order Creation


10 Best SAP Interview Tips for Freshers Experienced 50 SAP ABAP Interview Questions for Freshers & Experienced SAP Project Management Realtime Interview Questions Answers ALV Reports Interview Questions in SAP ABAP SAP Web Dynpro ABAP Interview Questions Answers 50 SAP ABAP ALE IDOC Interview Questions ALE IDOC EDI Network Techniques SAP to SAP & SAP to Non SAP

Dear Readers this post explains the Script Tutorial Real Time Scenario on Creation of Purchase Order, in this post i'm explained step by step procedure to create Script on Purchase Order. This post gives the complete idea about the creation of Script for beginners. Lets's go through this post for more details about creation of script.

Business Requirement for Creation of Script.


Module Pool Programming Interview Questions in SAP ABAP
converted by Web2PDFConvert.com

ABAP SAP BADI Interview Questions in ABAP

Create a Purchase Order Script Form with below layout.

BLOG ARCHIVE
2014 (28) 2013 (60) 2012 (71) December (7) August (1) June (1) May (1) Script Tutorial Real Time Scenario on Purchase Ord... April (22) March (11) February (23) January (5)

TOTAL PAGEVIEWS

492762

Follow below steps to creation of Script Form.

Step 1 : Create a Page by name PAGE1

Step 2 : Create Required no of Window as per the layout given

Step 3: Create Page Windows and specify height/width

Step 4 : Create Paragraph Formats

Step 5 : Create a TABS for Paragraph Formats

Step 6 : Create a Character Format

Step 7 : Write the code for Printing Headings, Line item information, Grand total in Mainwindow

converted by Web2PDFConvert.com

Step 8 : Write the code for Printing Vendor address in Address window

Step 9 : Write the code for Printing Footer information in Footer window

Step 10 : Write the code for Printing Logo in Logo window

Step 11 : Similarly, Write the code for Printing PO Details/PageNo/Title

Step 12 : Print the standard text using SO10 Tcode

Step13 : Arrange all the windows as per the given Layout.

Step14 : Create a Driver Program

Step15 : EXECUTE THE driver program

Step16 : Create a Second Page Layout

Step17 : Increase the height of MAIN window

Step18 : Printing Terms&Conditions using STARTFORM AND END FORM

Step19 : Change the Driver Program for using STARTFORM AND END FORM

Now Let's Start step by step procedure to create Script Form.

Detailed Steps: 1. Go to Se71 Tcode -->Give formname -->ZPO_SCRIPT, Click on --> Create Button.

converted by Web2PDFConvert.com

A pop-up message will be displayed, no need to do any thing press Enter Button.

2. give Meaning (Description for the script)

converted by Web2PDFConvert.com

->click on BASIC settings. 3. Select page format Landscape Specify Page Format, First Page, Default Paragraph.

converted by Web2PDFConvert.com

Step 1 : Create a Page by name PAGE1 4. Click on PAGES

Click on EDIT --> select CRATE ELEMENT

converted by Web2PDFConvert.com

Give page as PAGE1 and meaning as Main Page->> Give Next Page as Page1

converted by Web2PDFConvert.com

5. click on WINDOWS

Click on EDIT --> select CRATE ELEMENT (by default, MAIN window will be added)

converted by Web2PDFConvert.com

Main Window will be added by default.

Create another window by going to EDIT --> Create Element Give the window name as TITLE , Description as Window for Title.

converted by Web2PDFConvert.com

Step 2 : Create Required no of Window as per the layout given 6. click on EDIT->create element->give window name as logo and meaning as window for logo.

Repeat the same step for all the required windows.

Step 3: Create Page Windows and specify height/width 7. Click on Page windows

converted by Web2PDFConvert.com

Click on EDIT->CRATE ELEMENT->Double click on each window so that the window would be added to the page.

Give the appropriate height, width, left / right margin as below for each window

converted by Web2PDFConvert.com

Repeat the same procedure for all Page Windows.

Step 4 : Create Paragraph Formats

converted by Web2PDFConvert.com

Create the paragraph Formats as below.

Click on paragraph Formats Button.

Click on EDIT->CRATE ELEMENT

Give the Paragraph Format and specify the description

Maintain the Font Attributes ( Font Family, Size, Bold, Italic, Underline ) as required.

converted by Web2PDFConvert.com

Step 5 : Create a TABS for Paragraph Formats

Give Tabs for HEADER paragraph format as below. Tabs are nothing but positions to display data. Create 5 Tabs with required positions.

converted by Web2PDFConvert.com

Create all required Paragraph Formats as below.

converted by Web2PDFConvert.com

Step 6 : Create a Character Format

Create character format as below.

Click on EDIT --> Create Element --> Give Character Format and Description and Maintain Font Attributes as requirement

converted by Web2PDFConvert.com

Step 7 : Write the code for Title, Headings, Line item information, Grand Total in Mainwindow

Goto->Pagewindows

For Title Select Title Page Window and click on Text Editor CLICK ON GOTO CHANGE EDITOR--->write the below code

converted by Web2PDFConvert.com

Write the Below Code under editor TL --> Paragraph Format and " PURCHASE ORDER " is the title.

Now Select the Main Window, Select the editor and write below code.

Write Below code under text editor

converted by Web2PDFConvert.com

Here,

HD is a Paragraph format for Header data.

/: TOPENDTOP is used to print header information in the main window so that the it flows on to every page . /E (Text Element) BODY----this is used to print body. All the line item values . /E (Text Element) Total----used to print total at the end of main window . This element is called after the loop..endloop..so that Grand total is printed immediately after the main window .

Step 8 : Write the code for Printing Footer information in Footer window Select Footer in Page windows and write code for Footer in text editor. Goto->Pagewindows-> Double click on FOOTER window and click on texteditor-> write the below code.

FT--&ULINE(60)& FT--ALL RIGHTS RESERVED TO <C1>ABC COMPANY</> LIMITED

Here FT is paragraph format and CH is char format with bold.

converted by Web2PDFConvert.com

Box is used to create box.

Step 9 : Write the code for Printing PO Details/PageNo/Title Similarly, for all windows write the below code in the text editor Goto->Pagewindows->Double click on PO_NO window and click on texteditor ->write the below code

DF-- PO No : &wa_ekko-ebeln& DF-- PO Date : &wa_ekko-aedat&

Goto->Pagewindows->Double click on PAGE_NO window and click on texteditor>write the below code

DF--Page.No : &PAGE&/&SAPSCRIPT-FORMPAGES(C)&

converted by Web2PDFConvert.com

Step 10 : Write the code for Printing Vendor address in Address window

Goto->Pagewindows->Double click on ADDRESS window and click on texteditor>write the below code.

Now we have to Upload the Logo to display on Script.

Uploading Logo Using SE78 Tcode.

Goto SE78

--> Form Graphics

--> Stored on Document Server

--> select Graphics


converted by Web2PDFConvert.com

--> Graphics

--> Click on Bitmap Images

--> Import (Left Green Button)

Click on F4 to select the Bitmap Image from computer to SAP Document Server.

Only bitmap images are displayed no other formats are displayed.

Select the URL of the Image and Give the Name and Description of the Image.

Select the Radio button Color bitmap Image.

Click on Enter to upload the logo. The Logo will be uploaded.


converted by Web2PDFConvert.com

To cheek the the Image whether it is uploaded or not, Give the image name and select color bitmap image and click on the Print Preview (F8) button.

The uploaded image will be displayed as below.

converted by Web2PDFConvert.com

Step 11 : Write the code for Printing Logo in Logo window Goto->Pagewindows ->Double click on LOGO window and click on texteditor ->write the below code or Click on INSERT->GRAPHICS

->Select Stored on Document Server ->Give Name 'LOGO' (Image name Uploaded through SE78) ->Give object : GRAPHICS ID : BMAP Select color Bitmap Image->Press Enter

converted by Web2PDFConvert.com

The Below syntax will come automatically

BITMAP 'LOGO' OBJECT GRAPHICS ID BMAP TYPE BCOL

Step 12 : Print the standard text using SO10 Tcode

Now we have to create Standard Text for this Script Using "SO10" Tcode.

We can write the text directly in the window. But in the real time we use a concept called standard Text.

Goto SO10
converted by Web2PDFConvert.com

--> Give name

--> Provide Text ID as 'ST'

--> click on Create

--> go to EDIT

--> Change Editor

--> Write some text in Text editor,

save and activate the standard text.

Go back to script Goto -->Pagewindows -->Double click on TEXT window and click on texteditor -->write the below text.

/: INCLUDE ZV_PO_TEXT OBJECT TEXT ID ST THIS IS STD TEXT THRU SO10 TXN.

Or

CLick on Insert->Text->Standard

A pop will appear->give text name as ZPO_STD_TEXT-> Press Enter

converted by Web2PDFConvert.com

The code will be displayed automatically.

Step13 : Arrange all the windows as per the given Layout

Finally, Lets Re-arrange all the window positions again by going to Graphical Form Painer.

Click on SETTINGS -->FORM PAINTER -->Select Checkbox Graphical Form Painter And press enter.

converted by Web2PDFConvert.com

The form should look as below. If not arrange all the windows as below by dragging and dropping.

Arrange all the windows like below screen shot by dragging and dropping the windows as per our business requirement.

Footer window as below.

converted by Web2PDFConvert.com

Now goback to PC EDITOR. Minimize the above window and Settings --> Form Painter --> Un check the Graphical Form Painter, now pc editor will be displayed.

Click on Save to Save the Script and Activate script.

To Activate Click on Form Button --> Activate Script.

Step14 : Create a Driver Program in SE38 to print Script Form

Driver Program for script.

*&---------------------------------------------------------------------* *& Report ZPO_SCRIPT_DP *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZPO_SCRIPT_DP NO STANDARD PAGE HEADING.

****** TABLES USED TABLES : EKKO, EKPO, LFA1, ADRC.

********** DATA DECLARETIONS DATA : I_EKPO TYPE TABLE OF EKPO, WA_EKKO TYPE EKKO, WA_EKPO TYPE EKPO, WA_LFA1 TYPE LFA1, WA_ADRC TYPE ADRC, V_TOT TYPE EKPO-NETWR. ****** PARAMETER FOR EBELN SELECTION PARAMETERS : P_EBELN TYPE EBELN.
converted by Web2PDFConvert.com

******* SELECTING PO HEADER DATA SELECT SINGLE * FROM EKKO INTO WA_EKKO WHERE EBELN = P_EBELN. ******* SELECTING PO ITEM DATA SELECT * FROM EKPO INTO TABLE I_EKPO WHERE EBELN = P_EBELN. ********* FETCHING VENDOR DATA FOR ADDRESS USING EKKO SELECT SINGLE * FROM LFA1 INTO WA_LFA1 WHERE LIFNR = WA_EKKO-LIFNR. ********** FETCHING VENDOR ADDRESS FROM ADRC TABLE USING VENDOR SELECT SINGLE * FROM ADRC INTO WA_ADRC WHERE ADDRNUMBER = WA_LFA1ADRNR. ********** READING DATA PO ITEM TABLE TO WORK AREA READ TABLE I_EKPO INTO WA_EKPO INDEX 1. ******* TO READ DATA 100 TIMES FOR DEMO PURPOSE DO 100 TIMES. APPEND WA_EKPO TO I_EKPO. ENDDO. ********* CALLING THE SCRIPT USING OPEN_FORM CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZPO_SCRIPT' LANGUAGE = SY-LANGU. ********** LOOP THE ITAB TO WA TO READ DATA LOOP AT I_EKPO INTO WA_EKPO. ****** FOR CALCULATING THE TOTAL V_TOT = V_TOT + WA_EKPO-NETWR. ******* WRITING THE DATA ON SCRIPT CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'BODY ' WINDOW = 'MAIN'. ******** TO DISPLAY TOTAL AT END OF THE SCRIPT AT LAST. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'TOTAL' WINDOW = 'MAIN'. ENDAT. ENDLOOP. ******* TO CLOSE THE FORM WHICH IS OPENED BY OPEN FORM CALL FUNCTION 'CLOSE_FORM'.

converted by Web2PDFConvert.com

Save and Activate the Program. Now Execute the Program and give PO number as : 3000000007

The Output of the Script form is look likes below: First Page:

Last Page:

converted by Web2PDFConvert.com

Previous Posts:

SAP ABAP Real Time Interview Questions Part-1

SAP ABAP Real Time Interview Questions Part-2

SAP ABAP Real Time Interview Questions Part-3

SAP ABAP Real Time Interview Questions Part-4

For More Real Time Interview Questions See Below Posts

ABAP Interview Questions

Data Dictionary Interview Questions

converted by Web2PDFConvert.com

Reporting Interview Questions

BDC Interview Questions

Enhancements / Exits / BADI Interview Questions

Module Pool / Dialog Pgmng Interview Questions

Scripts Interview Questions

Smart Forms Interview Questions

ALE-IDOC Interview Questions

OOABAP Interview Questions

Cross Applications RFC / BAPI Interview Questions

Dear ABAP'ers if any Suggestions, Comments, Doubts feel free to leave a comment in the below comment box.

"You found the information helpful and want to say thanks? Your donation is enough to inspire us to do more. Thanks a bunch!"

Posted in: Scripts

Reverse address lookup

Writing a business plan

Landscape Design

Newer Post

Home

Older Post

0 comments: Post a Comment


converted by Web2PDFConvert.com

Note: only a member of this blog may post a comment.

Enter your comment...

Comment as: Google Account

Publish

Preview

Categories

ABAP Interview Questions (106)


ALE IDOC (6) ALE IDOC Interview Questions (6) (6) BDC Interview Questions (6)

ABAP Syntax Rules (6) BDC

Data

Dictionary (22)
IDoc Tutorials (6)

Object Oriented ABAP (19) Object Oriented ABAP Interview Questions (15) OOABAP (9) Reports (13) Reports Interview Questions (9) SAP ABAP Interview Questions (35) SAP ABAP Introduction (45)

SAP Basics (67)


SAP Tcodes (10) Webdynpro (12) SAP Webdynpro ABAP (12)

Protected Blog

Copyright 2013 SAP ABAP Interview Questions | Powered by Blogger


This blog is not affiliated to SAP AG |SAP is trademark of SAP AG |The information collected from various sources use information with your own risk.

converted by Web2PDFConvert.com

You might also like