Table Of ContentPro SAP Scripts,
Smartforms, and
Data Migration
ABAP Programming Simplified
—
Sushil Markandeya
Pro SAP Scripts,
Smar tforms, and Data
Migration
ABAP Programming Simplified
Sushil Markandeya
Pro SAP Scripts, Smartforms, and Data Migration
Sushil Markandeya
Saket, New Delhi, India
ISBN-13 (pbk): 978-1-4842-3182-1 ISBN-13 (electronic): 978-1-4842-3183-8
https://doi.org/10.1007/978-1-4842-3183-8
Library of Congress Control Number: 2017961575
Copyright © 2017 by Sushil Markandeya
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage
and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or
hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are
not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material
contained herein.
Cover image by Freepik (www.freepik.com)
Managing Director: Welmoed Spahr
Editorial Director: Todd Green
Acquisitions Editor: Nikhil Karkal
Development Editor: Matthew Moodie
Technical Reviewer: Srivastava Gauraw
Coordinating Editor: Prachi Mehta
Copy Editor: Lori Jacobs
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail
orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC
and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc).
SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail rights@apress.com, or visit http://www.apress.com/
rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions
and licenses are also available for most titles. For more information, reference our Print and eBook Bulk
Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available
to readers on GitHub via the book’s product page, located at www.apress.com/978-1-4842-3182-1.
For more detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
To those of my trainees who persuaded me that my classroom training
material can be transformed into books.
Contents
About the Author ���������������������������������������������������������������������������������������������������xvii
About the Technical Reviewer ��������������������������������������������������������������������������������xix
Acknowledgments ��������������������������������������������������������������������������������������������������xxi
Introduction ����������������������������������������������������������������������������������������������������������xxiii
■ Chapter 1: SAP Script–Forms, Styles, and Standard Texts ������������������������������������1
SAP Script–A Brief Description of Its Components �����������������������������������������������������������2
An Overview of SAP Script Form Elements ��������������������������������������������������������������������������������������������3
Style Elements and Standard Text ����������������������������������������������������������������������������������������������������������6
SAP Script Form and ABAP Print Programs ����������������������������������������������������������������������6
Generating Business Documents Using SAP Script—Architecture ����������������������������������7
SAP Script Relationship with Client Code �������������������������������������������������������������������������8
SAP Script Relationship with Language Key ��������������������������������������������������������������������9
Navigation and Transaction Codes �����������������������������������������������������������������������������������9
Transaction Code SE74—Format Conversion ���������������������������������������������������������������������������������������11
Transaction Code SE75–SAP script Settings ����������������������������������������������������������������������������������������11
Fonts in SAP Script Environment ������������������������������������������������������������������������������������12
Font Families ����������������������������������������������������������������������������������������������������������������������������������������12
Proportionate and Non-proportionate Fonts �����������������������������������������������������������������������������������������13
System Fonts ����������������������������������������������������������������������������������������������������������������������������������������14
Printer Fonts, System Bar Codes, and Printer Bar Codes ���������������������������������������������������������������������15
True Type Font Installation ��������������������������������������������������������������������������������������������������������������������15
A Note on Naming Convention of Objects in the Book ���������������������������������������������������21
v
■ Contents
Form Graphics–Import Graphics ������������������������������������������������������������������������������������22
Forms: Searching and Classification ������������������������������������������������������������������������������25
Dimensions in SAP Script Environment ��������������������������������������������������������������������������28
A Detail on SAP Script Form Elements–A Tour of the Form MEDRUCK ��������������������������28
Form Element—Header ������������������������������������������������������������������������������������������������������������������������30
Form Element—Page Formats �������������������������������������������������������������������������������������������������������������32
Form Elements–Windows and Page Windows��������������������������������������������������������������������������������������35
Form Elements–Windows and Page Windows: Tour of Form MEDRUCK Continued �����������������������������40
Form Element–Paragraph Formats ������������������������������������������������������������������������������������������������������43
Form Element–Character Formats �������������������������������������������������������������������������������������������������������46
Form Element—Text Elements �������������������������������������������������������������������������������������������������������������48
Demonstration I ��������������������������������������������������������������������������������������������������������������52
Form Header �����������������������������������������������������������������������������������������������������������������������������������������53
Page Format �����������������������������������������������������������������������������������������������������������������������������������������53
Specifications of the Text in the Variable Window ��������������������������������������������������������������������������������54
Paragraph Formats �������������������������������������������������������������������������������������������������������������������������������55
Complete Mandatory Entries in the Form Header ��������������������������������������������������������������������������������56
Windows and page windows ����������������������������������������������������������������������������������������������������������������56
Character Formats ��������������������������������������������������������������������������������������������������������������������������������61
Text in Text Element ������������������������������������������������������������������������������������������������������������������������������62
Test or Print Preview Form �������������������������������������������������������������������������������������������������������������������64
Recapitulation ���������������������������������������������������������������������������������������������������������������������������������������65
Demonstration II �������������������������������������������������������������������������������������������������������������66
Create Style YCH01_01 �������������������������������������������������������������������������������������������������������������������������66
Create Standard Text YCH01_01_SEL_TABLES �������������������������������������������������������������������������������������68
Create Form YCH01_02_SEC_FRM, Page Format FIRST, Graphic Window LOGO, etc� ��������������������������71
Create a Variable Window VARIABLE, Page Window and Include Standard Text �����������������������������������71
Test Print Form YCH01_02_SEC_FRM ��������������������������������������������������������������������������������������������������73
Recapitulation ���������������������������������������������������������������������������������������������������������������������������������������74
vi
■ Contents
Demonstration III ������������������������������������������������������������������������������������������������������������74
Create Form YCH01_03_MLIST1, Page Format FIRST, etc� �������������������������������������������������������������������78
Create Variable Window, Its Corresponding Page Window, Create Text Element, etc� ��������������������������78
Create Page Window for the Main Window, Create Text Element, etc� ��������������������������������������������������79
Create an ABAP Program YCH01_01_MLIST_ONE_MWINDOW (Print Program), etc� ����������������������������80
Test form YCH01_03_MLIST1, Execute Program YCH01_01_MLIST_ONE_MWINDOW �������������������������82
Recapitulation ���������������������������������������������������������������������������������������������������������������������������������������83
Form Check Text �������������������������������������������������������������������������������������������������������������83
Demonstration IV ������������������������������������������������������������������������������������������������������������86
Create Form YCH01_04_MLIST2 ����������������������������������������������������������������������������������������������������������87
Create and Test ABAP Program YCH01_02_MLIST_TWO_MWINDOWS (Print Program) �����������������������90
Test Form YCH01_04_MLIST2, Execute Program YCH01_02_MLIST_TWO_MWINDOWS ���������������������91
Recapitulation ���������������������������������������������������������������������������������������������������������������������������������������91
Conclusion ����������������������������������������������������������������������������������������������������������������������91
■ Chapter 2: SAP Script–Hands-on Exercises ���������������������������������������������������������93
Hands-on Exercise I–Output Vendors’ Address Labels
of a Specific Company Code�������������������������������������������������������������������������������������������93
Output Specification and Layout �����������������������������������������������������������������������������������������������������������94
Output Considerations ��������������������������������������������������������������������������������������������������������������������������95
Inputs ����������������������������������������������������������������������������������������������������������������������������������������������������96
Text element contents in the main window ������������������������������������������������������������������������������������������97
Source program ������������������������������������������������������������������������������������������������������������������������������������98
Creation of Form YCH02_01_ADR_STK and Print Program
YCH02_01_PPRG_YCH02_01_ADR_STK ��������������������������������������������������������������������������������������������100
Output �������������������������������������������������������������������������������������������������������������������������������������������������100
Hands-on Exercise Recapitulation ������������������������������������������������������������������������������������������������������101
Hands-on Exercise II—Output Custom Purchase Order �����������������������������������������������102
Hands-on Exercise–Scope and Limits ������������������������������������������������������������������������������������������������102
Output and Layout Specification ���������������������������������������������������������������������������������������������������������102
Output Considerations ������������������������������������������������������������������������������������������������������������������������106
vii
■ Contents
Data Inputs and Data Input Considerations ����������������������������������������������������������������������������������������108
Creation of SAP Script Form, Print Program, and Related Workbench Objects ����������������������������������110
Output �������������������������������������������������������������������������������������������������������������������������������������������������124
Hands-on Exercise Recapitulation ������������������������������������������������������������������������������������������������������128
Hands-on Exercise III—Output Custom Purchase Order—Use Control
Command PERFORM ����������������������������������������������������������������������������������������������������129
Output, Layout Specification, and Output Considerations ������������������������������������������������������������������129
Creation of SAP Script Form, Print Program, and Related Workbench Objects ����������������������������������131
Output �������������������������������������������������������������������������������������������������������������������������������������������������138
Hands-on Exercise Recapitulation ������������������������������������������������������������������������������������������������������140
Hands-on Exercise: IV–Copy, Modify, and Customize SAP Delivered
Form MEDRUCK ������������������������������������������������������������������������������������������������������������140
Output Specifications �������������������������������������������������������������������������������������������������������������������������140
Copy Form MEDRUCK to Y Namespace�����������������������������������������������������������������������������������������������140
Modifications to the Copied Form YCH02_04_MEDRUCK �������������������������������������������������������������������142
Output �������������������������������������������������������������������������������������������������������������������������������������������������153
Hands-on Exercise Recapitulation ������������������������������������������������������������������������������������������������������160
Form YCH02_04_MEDRUCK vis-à-vis Form YCH02_03_PORDER2 �����������������������������������������������������160
Hands-on Exercise V—Output Customer-wise Sales Summary of a
Company Code—Use SAP Script Form ������������������������������������������������������������������������161
Output Specification and Layout ���������������������������������������������������������������������������������������������������������161
Data Inputs �����������������������������������������������������������������������������������������������������������������������������������������162
SAP Script Form YCH02_05_SALESSUM ��������������������������������������������������������������������������������������������163
Print Program YCH02_05_PPRG_YCH02_05_SALESUM for SAP Script Form
YCH02_05_SALESUM �������������������������������������������������������������������������������������������������������������������������165
Check and Activate Form ��������������������������������������������������������������������������������������������������������������������167
Output �������������������������������������������������������������������������������������������������������������������������������������������������167
Hands-on Exercise Recapitulation ������������������������������������������������������������������������������������������������������168
Classifying Forms ���������������������������������������������������������������������������������������������������������169
SAP Script Form Documentation ����������������������������������������������������������������������������������175
SAP Script Tidbits ���������������������������������������������������������������������������������������������������������176
Conclusion ��������������������������������������������������������������������������������������������������������������������177
viii
■ Contents
■ Chapter 3: Smartforms—Forms, Styles, and Text Modules �������������������������������179
SAP script and Smartforms—Similarities and Differences ������������������������������������������179
Extra Features and Facilities in Smartforms over SAP Script ��������������������������������������180
SAP Script Objects Available in Smartforms Environment �������������������������������������������181
Smartforms Form Elements and Smartforms Form Environment ��������������������������������181
Application Toolbar �����������������������������������������������������������������������������������������������������������������������������182
Menu Bar and Menu Options ��������������������������������������������������������������������������������������������������������������183
Node: Global Settings �������������������������������������������������������������������������������������������������������������������������184
Node: Pages and Windows �����������������������������������������������������������������������������������������������������������������189
Recapitulation—Node: Pages and Windows ��������������������������������������������������������������������������������������213
Smartforms Form Environment—Settings and Field List�������������������������������������������������������������������214
Smartforms Form and ABAP Driver Program ���������������������������������������������������������������215
Generating Business Documents Using Smartforms—Architecture ����������������������������215
Demonstration I ������������������������������������������������������������������������������������������������������������217
Recapitulation of Specifications of Text in Secondary Window ����������������������������������������������������������217
Create Style ����������������������������������������������������������������������������������������������������������������������������������������218
Create Form—Form Attributes and Page Format �������������������������������������������������������������������������������222
Create Form—Graphic and Secondary Window ���������������������������������������������������������������������������������223
Create Form—Text �����������������������������������������������������������������������������������������������������������������������������226
Test or Print Preview Form �����������������������������������������������������������������������������������������������������������������231
Recapitulation �������������������������������������������������������������������������������������������������������������������������������������232
Demonstration II �����������������������������������������������������������������������������������������������������������233
Create Text Module YCH03_01_SEL_TABLES �������������������������������������������������������������������������������������233
Create Form YCH03_02_SEC_FRM—Page Format FIRST and Graphic Window LOGO �����������������������234
Create Form—Create a Secondary Window VARIABLE and Include Text Module �������������������������������235
Test Print Form YCH03_02_SEC_FRM ������������������������������������������������������������������������������������������������237
Recapitulation �������������������������������������������������������������������������������������������������������������������������������������238
Demonstration III ����������������������������������������������������������������������������������������������������������238
Create Style YCH03_02 �����������������������������������������������������������������������������������������������������������������������241
Create Form YCH03_03_MLIST1, Page Format FIRST, etc� �����������������������������������������������������������������241
ix
■ Contents
Create Secondary Window, Create Text, etc� ���������������������������������������������������������������������������������������243
Adjust Dimensions of Main Window, Create Text in Main Window, etc� ����������������������������������������������245
Create an ABAP Program YCH03_01_MLIST1 (Driver Program), etc� ��������������������������������������������������246
Test Form YCH03_03_MLIST1, Execute Program YCH03_01_MLIST1 ������������������������������������������������247
Recapitulation �������������������������������������������������������������������������������������������������������������������������������������248
Demonstration IV ����������������������������������������������������������������������������������������������������������248
Create ABAP Dictionary Structure YCH03_2REC_MAKT_STRU �����������������������������������������������������������251
Create Form YCH03_04_MLIST2 ��������������������������������������������������������������������������������������������������������251
Create and Test ABAP Program YCH03_02_MLIST2 (Driver Program) ������������������������������������������������254
Test Form YCH03_04_MLIST2, Execute Program YCH03_02_MLIST2 ������������������������������������������������257
Recapitulation �������������������������������������������������������������������������������������������������������������������������������������258
Conclusion ��������������������������������������������������������������������������������������������������������������������258
■ Chapter 4: Smartforms–Hands-on Exercises �����������������������������������������������������259
Hands-on Exercise I—Output Vendors’ Address Labels
of a Specific Company Code�����������������������������������������������������������������������������������������259
Output Specification and Layout ���������������������������������������������������������������������������������������������������������260
Output Considerations ������������������������������������������������������������������������������������������������������������������������260
Inputs �������������������������������������������������������������������������������������������������������������������������������������������������263
Creation of Style YCH04_01, Form YCH04_01_ADR_STK and Driver Program
YCH04_01_DPRG_YCH04_01_ADR_STK ��������������������������������������������������������������������������������������������264
Output �������������������������������������������������������������������������������������������������������������������������������������������������272
Hands-on Exercise Recapitulation ������������������������������������������������������������������������������������������������������273
Hands-on exercise II—Output Purchase Orders Using Custom Form ��������������������������274
Hands-on Exercise—Scope and Limits ����������������������������������������������������������������������������������������������274
Output and Layout Specification ��������������������������������������������������������������������������������������������������������275
Output Considerations ������������������������������������������������������������������������������������������������������������������������277
Data Inputs and Data Input Considerations ����������������������������������������������������������������������������������������278
Creation of Smartforms Form, Driver Program, and Related Workbench Objects ������������������������������281
Output �������������������������������������������������������������������������������������������������������������������������������������������������307
Hands-on Exercise Recapitulation ������������������������������������������������������������������������������������������������������311
x
Description:Master SAP scripts, Smartforms, and data migration with hands-on exercises. The information provided in this book will help you decode the complexities and intricacies of SAP ABAP programming. Pro SAP Scripts, Smartforms, and Data Migration begins by describing the components of a SAP script: forms,