0% found this document useful (0 votes)
1K views

Step by Step Tutorials in Bapi-SAP ABAP

Uploaded by

Nelson Garcia
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

Step by Step Tutorials in Bapi-SAP ABAP

Uploaded by

Nelson Garcia
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 116

Step By Step Tutorials in SAP ABAP.

This Bolg has tutorials on Reports,


Interfaces, Conversions, Enhancements, BAPIS, RFCs, ALE, EDI, RFID, ALVs, Smart Forms, Sap
Scripts, Adobe Forms.

Search

Thursday, February 21, 2008


BAPI Sales Order Create Code
Bapi Sales Order Create Code

We saw in the earlier example as to how to create a sales order from


the SE37 interface. Now we need to create a program and call the
BAPI to create sales orders. Later we will discuss ways to call a BAPI
from a non-sap system.
Given an appropriate name to the program. Please follow the naming
conventions as per your company. ABAP programs should always
start with a 'Z' or a 'Y'.
Enter suitable description.
Create a $tmp objects or create a transport request. Transport
requests would be covered in the later tutorials.
Follow the menu path EDIT----->Pattern

Enter the name of the BAPI as shown below.


The inserted BAPI is shown below.
We now need to get the import parameters, export parameters and
the tables.
Note: Take care that the data declaration in the program for the above
mentioned parameters matches exactly as given in the BAPI. To
ensure that please open the BAPI using transaction SE37 and copy
the exact names of the parameters from the BAPI structure.

If this is not followed your program will give an 'ABAP DUMP'.


Check the Import parameters
The following figure shows the import parameter BAPISHEAD and we
need to declare a structure in our ABAP program as follows.

Data: st_BAPISDHEAD like BAPISDHEAD, " Sales Order Header


Data

Make sure you follow the ABAP naming conventions.


Similarly for tables pick up the names from the function module.

Data: st_BAPISDHEAD like BAPISDHEAD, " Sales Order Header


Data
ta_BAPIITEMIN like BAPIITEMIN occurs 0 with header line, " Ln
item
ta_BAPIPARTNR like BAPIPARTNR occurs 0 with header line, "
Partner
d_BAPIRETURN1 like BAPIRETURN1, " Bapi return msg
d_vbeln like bapivbeln-VBELN. " Sales Order Number
The complete program is given below. Please make sure that you use
the data specific to your system. In the following some of the values
are hard coded. You need to use variables and pick up the values.

Please note in the following program, sold to party (SP) has been
entered as 'AG' and ship to party (SH) as 'RG'.

SP--------AG
SH--------RG

Order type 'OR' as 'TA'

Please use TA instead of OR

Also if you set the * CONVERT_PARVW_AUART = 'X' parameter to


'X' you can use sold to party as SP and ship to party as SH.

REPORT ZEX_BAPISALESORDCRT .

*-------------------------Data Declaration-----------------------------*
Data: st_BAPISDHEAD like BAPISDHEAD, " Sales Order Header
Data
ta_BAPIITEMIN like BAPIITEMIN occurs 0 with header line, " Ln item
ta_BAPIPARTNR like BAPIPARTNR occurs 0 with header line, "
Partner
d_BAPIRETURN1 like BAPIRETURN1, " Bapi return msg
d_vbeln like bapivbeln-VBELN. " Sales Order Number

* Move the data to create sales order in the repective parameters------


*
move: 'TA' to st_BAPISDHEAD-DOC_TYPE, " Sales document type
'15493' to st_BAPISDHEAD-PURCH_NO_C,
'00010' to ta_BAPIITEMIN-ITM_NUMBER,
'Y-351' to ta_BAPIITEMIN-MATERIAL,
'1100' to ta_BAPIITEMIN-PLANT,
'1' to ta_BAPIITEMIN-REQ_QTY,
'AG' to ta_BAPIPARTNR-PARTN_ROLE, " Sold to Party
'0000007777' to ta_BAPIPARTNR-PARTN_NUMB.
* Append the internal tables-------------------------------------------*
append ta_BAPIPARTNR.
clear ta_BAPIPARTNR.
append ta_BAPIITEMIN.
clear ta_BAPIITEMIN.
* Move ship to party---------------------------------------------------*
move: 'RG' to ta_BAPIPARTNR-PARTN_ROLE, " Ship to party
'0000007777' to ta_BAPIPARTNR-PARTN_NUMB.
* Append the internal tables-------------------------------------------*
append ta_BAPIPARTNR.
clear ta_BAPIPARTNR.

* Call the Bapi to create the sales order

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'


EXPORTING
ORDER_HEADER_IN = st_BAPISDHEAD
* WITHOUT_COMMIT = ' '
* CONVERT_PARVW_AUART = ' '
IMPORTING
SALESDOCUMENT = d_vbeln
* SOLD_TO_PARTY =
* SHIP_TO_PARTY =
* BILLING_PARTY =
RETURN = d_BAPIRETURN1
TABLES
ORDER_ITEMS_IN = ta_BAPIITEMIN
ORDER_PARTNERS = ta_BAPIPARTNR
* ORDER_ITEMS_OUT =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CCARD =
* ORDER_CFGS_BLOB =
* ORDER_SCHEDULE_EX =
.
if d_vbeln <> space.
write: 'Sales order No. ', d_vbeln.
endif.

Posted by ABAP FRIEND at 2:10 AM


Labels: Bapi Sales Order create, BAPI_SALESORDER_CREATEFROMDAT1, Sample
program to create sales order using BAPI, SAP ABAP BAPI, SAP BAPI, Using BAPI,
Using BAPIs

0 comments:
Post a Comment

Links to this post


Create a Link

Newer Post Older Post Home

ABAP TIPS

PREVIOUS NEXT RANDOM

Always specify your conditions in the Where-clause instead of checking them yourself with check
statements. The database system can then use an index (if possible) and the network load is
considerably less.

Since your web browser does not support JavaScript, here is a non-JavaScript version of
the image slideshow:

Always specify your conditions in the Where-clause instead of checking them yourself with
check statements. The database system can then use an index (if possible) and the
network load is considerably less.

For all frequently used Select statements, try to use an index. You always use an index if
you specify (a generic part of) the index fields concatenated with logical Ands in the Select
statement's Where clause. Note that complex Where clauses are poison for the statement
optimizer in any database system.

If there exists at least one row of a database table or view with a certain condition, use the
Select Single statement instead of a Select-Endselect-loop. Select Single requires one
communication with the database system, whereas Select-Endselect needs two.

It is always faster to use the Into Table version of a Select statement than to use Append
statements.

To read data from several logically connected tables use a join instead of nested Select
statements. Network load is considerably less.

If you want to find the maximum, minimum, sum and average value or the count of a
database column, use a select list with aggregate functions instead of computing the
aggregates yourself. Network load is considerably less.

If you process your data only once, use a Select-Endselect-loop instead of collecting data
in an internal table with Select Into Table. Internal table handling takes up much more
space.

Use a select list or a view instead of Select * , if you are only interested in specific columns
of the table. Network load is considerably less.
For all frequently used, read-only tables, try to use SAP buffering. Network load is
considerably less.

Whenever possible, use array operations instead of single-row operations to modify your
database tables. Frequent communication between the application program and database
system produces considerable overhead.

Whenever possible, use column updates instead of single-row updates to update your
database tables. Network load is considerably less.

Instead of using nested Select loops or FOR ALL ENTRIES it is often possible to use
subqueries. Network load is considerably less.

Use the special operators CO, CA, CS, instead of programming the operations yourself. If
ABAP/4 statements are executed per character on long strings, CPU consumption can rise
substantially.

Some function modules for string manipulation have become obsolete and should be
replaced by ABAP/4 statements or functions: STRING_CONCATENATE... ->
CONCATENATE, STRING_SPLIT... -> SPLIT, STRING_LENGTH -> strlen(), STRING_CENTER
-> WRITE...TO...CENTERED, STRING_MOVE_RIGHT -> WRITE...TO...RIGHT-JUSTIFIED

Use the CONCATENATE statement instead of programming a string concatenation of your


own.

If you want to delete the leading spaces in a string, use the ABAP/4 statement SHIFT...LEFT
DELETING LEADING... .Other constructions (with CN and SHIFT...BY SY-FDPOS PLACES,
with CONDENSE if possible, with CN and ASSIGN CLA+SY-FDPOS(LEN) ...) are not as fast.
In any case, avoid using SHIFT inside a WHILE-loop!

Use the SPLIT statement instead of programming a string split yourself.

Use the strlen( ) function to restrict the DO loop to the relevant part of the field, e.g. when
determinating a check-sum.

Use "CLEAR f WITH val" whenever you want to initialize a field with a value different from
the field's type-specific initial value.

Try to keep the table ordered and use binary search or used a table of type SORTED
TABLE. If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes
only O( log2( n ) ).

A dynamic key access is slower than a static one, since the key specification must be
evaluated at runtime. However, for large tables the costs are dominated by number of
comparison needed to locate the entry.
If you need to access an internal table with different keys repeatedly, keep your own
secondary indices.With a secondary index, you can replace a linear search with a binary
search plus an index access.

LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the
specified condition internally. As with any logical expressions, the performance is better if
the operands of a comparison share a common type. The performance can be further
enhanced if LOOP ... WHERE is combined with FROM i1 and/or TO i2, if possible.

Always use Pretty Printer and Extended Program Check before releasing the code. Do not leave
unused code in the program. Comment the code thoroughly. Align the comments and the Code.
Follow the SAP Standards and SAP Best Practices guidelines. Its a good practice to take a dump
of the code on your local drive.

Sap Scripts and SmartForms ABAP Debugger Break Points Pop Up a Calender
Bar Codes ABAP Debugger WatchPoints Module to Read a File
Ole Automation Part1 Standard Reports and Sap Drill Down Reports Concept Module to Reverse A String
Ole Automation Part 2 Scripts Creating a HOT SPOT Run an Executable Program
Processing Blocks in ABAP Important Standard Reports Interactive Programs and Hide with Parameters
Simple ABAP Report in SAP Technique Program for POP up Screen
ALV Grid - Changing Colors Abap Tricks and Tips String Concatenate Printing Selection
ALV Report Example Bapi Sales Order Get Week of the Year Parameters for a Report
Creating Variants For ABAP BAPI Purchase Order SAP ABAP to Add Days to a Uploading and DownLoading
Reports Creating Function Modules in Date a Report
Recording BDC using SAP Add Months to a Date SAP ABAP Version
Transaction Creating Tables in SAP Get Month in the Year Management
Sales Document Flow in Finding User Exits in SAP Display Clock SAP ABAP Short Cuts
ABAP Function Module Create Text ABAP Code For Progress List of Important System
User Exits in SAP SD and Read Text BAR Variables
SAP ABAP Naming Important Transaction Codes ABAP Function Module For ABAP MACROS
Standards in SAP Caluclator ABAP Calling a File Selector
SAP SD Tables ABAP Function Module for ABAP Function Module For Some Important Function
SAP ABAP Data Dictionary Submitting a Program Calender Modules
Tables ABAP Game Tic Tac Toe Displaying Messages in ABAP String Operations
MM Important Transaction ABAP Internal Table To Excel ABAP ABAP Function Module to
Codes in SAP Sheet Function Module Pop Up To Check Validity of Date
Passing g Data From One ABAP Function Module to Confirm Transfer Internal Table
ABAP Program to Another create Directory Conversion Routines in SAP Contents to a File
ABAP Compute Add Collect Different Types of Menus in SAP ABAP Authorization SAP ABAP Program Types
and Append SAP SAP ABAP Module Pool BAPI to Read Customer Data
SAP ABAP Determining Function Modules in SAP to Tutorial Checking Validity of Date
Attributes of Data check Loged in Users SAP ABAP RFC Download to Application
SAP ABAP Editor Icons ABAP Function Module for Finding Path to SAP Server
BAPI for Displaying Material Adding Days to Dates Transaction in Menu ABAP Debugger Breakpoint
Data Call a Transaction From a SAP Purchasing Documents and Watchpoint
BAPI to get customer bank Remote System SAP and ABAP Shortcuts BAPI to get Company Code
details SAP MM simple Procurement Logical Databases Details
EDI Outbound Process Cycle Advantages of Logical Creating Material Using BAPI
SAP EDI Process Overview BAPI Material EDIT Databases part 2
Function Module for Vendor Finding Decimal Places in Copy to Clipboard Generating a Valid Password
Bank details Currency BAPI Create Material Logical Databases Structure
SAP IDOC Getting negative sign before Finding and Running Making Fields OBligatory in
a number in ABAP Programs in ABAP Selection Screen
Program Editor Lock Unlock Program Syntax Check and ABAP Views
Creating a Valid Password in Restricting Select Options Extended Syntax Check Getting a Company Code for
SAP List of BAPIs in the system Select Options upper lower a Plant
SAP BADIs Introduction SAP Function Module case Importing contents of
SAP ABAP MACROS Scramble a String BAPI Sales Order Simulate Clipboard in SAP
POP UP function Module to LSMW Get PLANT and Description Getting a Plant for a Material
Confirm and Save Data POP up table contents on the for a Material Plant Material and Storage
Select Options screen MRP List Function Module Location
BAPI for availability check SAP R3 Bookmarking Production Planning and SAP Production Planning
String to Numerical Websites Controlling Standard Reports
SAP Goods Movement Stock Requirements List Applications in SAP R3 NetWeaver Components
Process Function Module Tool Based Reports Supported Databases and
Getting a List of Plants for a Retail Transaction Codes Important Transaction Codes Operating Systems
Material in SAP
SAP R3 Clients Concept SAP Stock per Bin
ABAP Adobe Forms
Authorization Object Tables
SAP Industry Specific
Solutions

Its TRUE that SAP is expanding its solutions to


allow for integration to other NON-SAP systems. And
JAVA is being used to accomplish this. This does not in
any way mean that ABAP will be replaced by JAVA.
Millions of lines of ABAP codes has been written
which exists in the forms of Reports Interfaces and
Enhancements. This codes runs the biggest companies
of the world. SAP is continuously in the
effort of improving ABAP.

Subscribe to FREE Post

Enter Email

Subscribe

Delivered by FeedBurner
Blog Archive
2008 (205)
o August (2)
Aug 14 (1)
SAP ABAP Important KeywordsThe following list
disp...
Aug 13 (1)
SAP ABAP Function Module to Wrap Long TextThe
foll...
o July (16)
Jul 29 (3)
SAP Retail Transaction Codes: Subsequent
Settlemen...
SAP Retail Transaction Codes: Fresh Items
Procurem...
Important Transaction Codes in SAP Retail: Non-rep...
Jul 28 (3)
SAP Retail Transactions Procurement of
Replenishab...
SAP Retail Transactions Assortment Management
SAP Retail Transaction Codes Pricing
Jul 24 (1)
SAP IS-Retail Transaction Codes Merchandise
Jul 16 (1)
Netweaver Components AUTOID Infrastructure RFID
Jul 15 (1)
SAP Supported Databases Operating Systems
Jul 10 (1)
SAP and Adobe Forms
Jul 09 (1)
SAP Authorization Objects Tables
Jul 08 (1)
SAP Userand Authorization SystemRelated Tables
Jul 07 (1)
SAP Industry Specific Solutions SAP Business Solut...
Jul 02 (1)
SAP Stock Per Bin
Jul 01 (2)
SAP Plant Storage Location Data
SAP Plant Details Company code and Controlling
Are...
o June (50)
Jun 30 (3)
SAP PLant for a Material
SAP Company Code for a Plant
SAP Plant Material and Storage Location
Jun 27 (1)
SAP POP UP TABLE CONTENTS ON THE SCREEN
Jun 26 (2)
SAP Get Plant Description for a Material
SAP Plants for a given Material
Jun 25 (1)
SAP ABAP Finding and Running Programs
Jun 24 (2)
SAP Function Module String Numerical
SAP Function Module String Scramble
Jun 23 (3)
SAP ABAP Negative Sign Before a Number
SAP Function Module Import Clipboard
SAP ABAP Copy to ClipBoard Function Module
Jun 22 (1)
SAP Tool Based Reports
Jun 20 (2)
SAP Goods Movement
SAP Production Planning and Controlling Standard
R...
Jun 19 (2)
SAP MRP List Function Module
SAP Stocks/Requirements List Function Module
Jun 18 (2)
SAP Availability Check BAPI/Function Module
Creating a Valid Password in SAP
Jun 17 (2)
SAP R/3 Bookmarking Websites
SAP R/3 Clients Concept
Jun 16 (1)
Standard Reports in SAP Production Planning
Jun 15 (1)
SAP ABAP Generate Password Function Module
Jun 14 (1)
SAP BAPI Sales Order Simulate
Jun 12 (1)
SAP BAPI List of BAPIS in the System
Jun 11 (1)
SAP LSMW Legacy System Migration Workbench
Jun 10 (2)
SAP R/3 Applications
Standard Reports in SAP Production Planning
Jun 08 (1)
SAP ABAP Macros
Jun 06 (1)
BAPI to get company code details
Jun 05 (5)
SAP ABAP Program EDITOR LOCK/UNLOCK
Using Logical Databases in SAP ABAP
Jun 04 (5)
Jun 03 (5)
Jun 02 (5)
o May (50)
May 31 (3)
May 30 (1)
May 29 (3)
May 28 (2)
May 27 (2)
May 26 (3)
May 23 (1)
May 21 (2)
May 20 (2)
May 16 (2)
May 14 (2)
May 13 (3)
May 12 (2)
May 11 (2)
May 10 (3)
May 08 (3)
May 07 (3)
May 06 (3)
May 05 (2)
May 04 (1)
May 03 (1)
May 02 (1)
May 01 (3)
o April (21)
Apr 30 (2)
Apr 29 (1)
Apr 28 (2)
Apr 27 (1)
Apr 25 (1)
Apr 24 (1)
Apr 23 (2)
Apr 22 (1)
Apr 21 (1)
Apr 17 (1)
Apr 14 (2)
Apr 10 (1)
Apr 09 (2)
Apr 04 (1)
Apr 03 (1)
Apr 01 (1)
o March (32)
Mar 31 (1)
Mar 28 (1)
Mar 27 (1)
Mar 26 (1)
Mar 25 (2)
Mar 24 (1)
Mar 23 (1)
Mar 22 (3)
Mar 21 (1)
Mar 19 (2)
Mar 17 (3)
Mar 14 (1)
Mar 13 (2)
Mar 12 (1)
Mar 07 (2)
Mar 06 (4)
Mar 05 (4)
Mar 04 (1)
o February (28)
Feb 29 (1)
Feb 28 (2)
Feb 27 (2)
Feb 26 (2)
Feb 25 (1)
Feb 22 (1)
Feb 21 (1)
Feb 20 (1)
Feb 19 (1)
Feb 18 (2)
Feb 16 (1)
Feb 15 (3)
Feb 14 (1)
Feb 13 (1)
Feb 10 (1)
Feb 07 (1)
Feb 06 (1)
Feb 05 (1)
Feb 03 (1)
Feb 02 (3)
o January (6)
Jan 31 (1)
Jan 24 (1)
Jan 23 (1)
Jan 22 (1)
Jan 12 (1)
Jan 05 (1)

BAPI RFC Function Modules A Simple ABAP Report MODULE POOL ABAP Naming Standards BDC SAP SCRIPTS BAR
CODE STANDAR REPORTS USER EXITS List of Important Variables ABAP Tricks and Tips Important Transaction Codes
in ABAP Creating Tables in SAP Sales Document Flow SAP SD Related Tables Finding User Exits in SAP Processing
Blocks in ABAP Function Modules Create Text And Save Text OLE Automation OLE For EXCEL Simple ABAP ALV Report
Creating Variants For ABAP Programs SAP ABAP Authorizations Conversion Routines in SAP

Privacy Policy
This site is owned and operated by G Rajesh. All product names are trademarks of their respective companies. This site is in no
way affiliated with SAP AG. Use information on this site at your own risk. The articles are copyrighted to G Rajesh and can
only be reproduced given the author's permission. You can contact me on [email protected]. Your privacy on
the Internet is of the utmost importance to us.We want to make your online experience satisfying and safe. Because we gather
certain types of information about our users, we feel you should fully understand our policy and the terms and conditions
surrounding the capture and use of that information. This privacy statement discloses what information we gather and how we use
it.

Information we gathers through aggregated tracking information derived mainly by tallying page views throughout our sites. This
information allows us to better tailor our content to readers needs and to help our advertisers and sponsors better understand the
demographics of our audience. Under no circumstances we divulge any information about an individual user to a third party.

Cookie Tracking: We may place a text file called a cookie in the browser files of your computer. The cookie itself does not
contain Personal Information although it will enable us to relate your use of this site to information that you have specifically and
knowingly provided. But the only personal information a cookie can contain is information you supply yourself. A cookie cant read
data off your hard disk or read cookie files created by other sites. We may use cookies to track user traffic patterns (as described
above).

We allow third-party advertising companies (like Google Adsense) to serve ads when you visit our Web site. If you would
like more information about this practice and to know your choices about not having this information used by these
companies, Visit This.http://www.google.com/privacy_ads.html
*******************************************************************************

Step By Step Tutorials in SAP ABAP. This Bolg has tutorials on Reports,
Interfaces, Conversions, Enhancements, BAPIS, RFCs, ALE, EDI, RFID, ALVs, Smart Forms, Sap
Scripts, Adobe Forms.

Search

Showing posts for query sales order creation. Show all posts
Showing posts for query sales order creation. Show all posts
Monday, July 28, 2008
SAP Retail Transaction Codes Pricing

Find below a list of transaction Codes for SAP Retail Pricing

Transaction Description
V-61 Create Customer Discount Condition
BD22 Delete Change Pointers
WVN0 Generate Pricing Worklist
WVN1 Release Worklist
MEI4 Create Automatic Document worklist
VA01 Create Sales Order
WVA3 Display VKP Calculation Sur
WKK1 Create Market-basket Price Calculation
WMB1 Create Price Entry
VKP5 Create Price Calculation
WPMA Direct Request For POS Outbound
WVA7 Display VKP Calculation Sur
WEV3 Display Ret. Markup SP Ca
MEKE Conditions By Vendor
V-64 Display Customer Discount
VK13 Display Condition Records
V/LD Execute Pricing Report

See Also:

SAP Industry Specific Solutions SAP Business Solutions By Industry


SAP IS-Retail Transaction Codes Merchandise
Important Transaction Codes for ABAP
____________________________________________________________________
____

Posted by ABAP FRIEND at 10:26 PM 0 comments Links to this post

Saturday, June 14, 2008


SAP BAPI Sales Order Simulate
SAP BAPI Sales Order Simulate

In SAP before creating a sales order there is a way to simulate it using a BAPI. This can be done
using the following BAPI.

SAP ABAP BAPI to Simulate a Sales Order.

BAPI_SALESORDER_SIMULATE

This is very useful in case you want to check the Availability and
Pricing. The parameters obtained are given below.

BAPIITEMEX Communication Fields: Issue SD


Document Item: WWW
BAPISDHEDU Struture of VBEP (Sales Document:
Schedule Line Data)
BAPICOND Communication Fields for Maintaining
Conditions in the Order
BAPIINCOMP Communication Fields: Incompletion

Find the code below.

Note: This is very similar to Sales Order Create BAPI


'BAPI_SALESORDER_CREATEFROMDAT1' but in this case the
actual Sales Order is not created instead a simulation is carried out.
REPORT ZEX_SALORDSIMULATE.

*-------------------------Data Declaration-----------------------------*
Data: st_BAPISDHEAD like BAPISDHEAD, " Sales Order Header
Data
ta_BAPIITEMIN like BAPIITEMIN occurs 0 with header line, "
Ln item
ta_BAPIPARTNR like BAPIPARTNR occurs 0 with header line,
" Partner
int_BAPIITEMEX like BAPIITEMEX occurs 0 with header line,
int_BAPISDHEDU like BAPISDHEDU occurs 0 with header
line,
int_BAPICOND like BAPICOND occurs 0 with header line,
int_BAPIINCOMP like BAPIINCOMP occurs 0 with header
line,
d_BAPIRETURN1 like BAPIRETURN. " Bapi return msg

* Move the data to create sales order in the repective


parameters------*
move: 'TA' to st_BAPISDHEAD-DOC_TYPE, " Sales document
type
'15493' to st_BAPISDHEAD-PURCH_NO_C,
'00010' to ta_BAPIITEMIN-ITM_NUMBER,
'Y-351' to ta_BAPIITEMIN-MATERIAL,
'1100' to ta_BAPIITEMIN-PLANT,
'1' to ta_BAPIITEMIN-REQ_QTY,
'AG' to ta_BAPIPARTNR-PARTN_ROLE, " Sold to Party
'0000007777' to ta_BAPIPARTNR-PARTN_NUMB.
* Append the internal tables-------------------------------------------*
append ta_BAPIPARTNR.
clear ta_BAPIPARTNR.
append ta_BAPIITEMIN.
clear ta_BAPIITEMIN.
* Move ship to party---------------------------------------------------*
move: 'RG' to ta_BAPIPARTNR-PARTN_ROLE, " Ship to
party
'0000007777' to ta_BAPIPARTNR-PARTN_NUMB.
* Append the internal tables-------------------------------------------*
append ta_BAPIPARTNR.
clear ta_BAPIPARTNR.

* Call BAPI to SIMULATE the Order

CALL FUNCTION 'BAPI_SALESORDER_SIMULATE'


EXPORTING
ORDER_HEADER_IN = st_BAPISDHEAD
* CONVERT_PARVW_AUART =''
IMPORTING
* SALESDOCUMENT =
* SOLD_TO_PARTY =
* SHIP_TO_PARTY =
* BILLING_PARTY =
RETURN = d_BAPIRETURN1
TABLES
ORDER_ITEMS_IN = ta_BAPIITEMIN
ORDER_PARTNERS = ta_BAPIPARTNR
* ORDER_SCHEDULE_IN =
ORDER_ITEMS_OUT = int_BAPIITEMEX
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CCARD =
* ORDER_CCARD_EX =
ORDER_SCHEDULE_EX = int_BAPISDHEDU
ORDER_CONDITION_EX = int_BAPICOND
ORDER_INCOMPLETE = int_BAPIINCOMP
* MESSAGETABLE =
* EXTENSIONIN =
* PARTNERADDRESSES =
.

IF SY-SUBRC = 0.

ENDIF.
Posted by ABAP FRIEND at 11:52 PM 0 comments Links to this post
Labels: BAPI, BAPI_SALESORDER_SIMULATE, Function Module, Sales order
Simulation

Monday, April 14, 2008


SAP ABAP Calling Executable Programs
SAP ABAP Calling Executable Programs

If you wish to call an executable ABAP progra from another ABAP program/report you can do so
by using the SUBMIT statement. For example your wish to call program <CALLEDPROGARM>
from the current program <CURRENTPROGRAM> then the control can either be passed to the
called program or once the called program has finished its job the control cab be RETURNED to
the calling program. Please find the Syntax below.

SUBMIT prog|(variable) [AND RETURN] [options].

The called program name can be directly mentioned in the code or


you can dynamically pass the called program using a variable. As
mentioned above once the called program finishes its job, the
program can be either returned to the calling program using the
RETURN option. In case RETURN is omitted then all data and list
levels of the calling program (the entire internal session) are deleted.
After the called executable program has finished, control returns to
the level from which you started the calling program. Whereas if the
RETURN option is used then the control is returned to the statement
after SUBMIT and the calling program continues its operation.

In case the called program has a selection screen then the SUBMIT
statement can be used with the various options as shown below.

SUBMIT [VIA SELECTION-SCREEN]


[USING SELECTION-SET var]

The following code will make things clearer.

The following is the called program

REPORT ZEXERCISE_1 MESSAGE-ID ZEXERCISE1.


.
************************************************************************
*
*
* This Report Displays Sales Order Header
Data *
*
*
*
*
************************************************************************

* Tables Declaration----------------------------------------------------
Tables: VBAK, " Sales Document: Header Data
VBPA, " Sales Document: Partner
VBKD. " Sales Document: Business Data

* Data Declaration------------------------------------------------------
data: d_soldto(10), " Sold to party
d_shipto(10), " Shipt to Party
d_buyer(10), " Buyer
d_billto(10). " Bill to Party

* Select Options--------------------------------------------------------
Select-options: S_VBELN for vbak-vbeln. " Sales Order Number

* Start of Selection----------------------------------------------------
Start-Of-Selection.
Select vbeln
netwr
waerk into (vbak-vbeln, vbak-netwr, vbak-waerk) from vbak
where
vbeln in s_VBELN.

endselect.
* Select Buyer---------------------------------------------------------
select single kunnr
into d_buyer from vbpa where parvw = 'BU' or parvw = 'RE' and
vbeln = S_VBELN-LOW.
* Select Bill to Party-------------------------------------------------
select single kunnr
into d_billto from vbpa where parvw = 'BP' or parvw = 'WE' and
vbeln = S_VBELN-low.
* Select Sold to Party--------------------------------------------------
select single kunnr
into d_soldto from vbpa where parvw = 'SP' or parvw = 'AG'
and
vbeln = S_VBELN-low .
* Select Shipt to Party-------------------------------------------------
select single kunnr
into d_shipto from vbpa where parvw = 'SH' and
vbeln = S_VBELN-low .
* Output the data-------------------------------------------------------

write:/ vbak-vbeln, d_buyer, vbak-netwr, d_billto, d_soldto, d_shipto,


vbak-waerk.

The following the the calling program.

REPORT ZEXERCISE_SUBMIT .

Data: d_value1(10).

d_value1 = 'Test1'.

SUBMIT ZEXERCISE_1 via selection-screen and RETURN.

write: d_value1.

EXERCISE

Please try the following options.

1) From the calling program's SUBMIT statement remove the and


RETURN Option and see the result. If and RETURN is removed the
the value of d_value1 is not written on the screen. Where as if and
RETURN is not omitted then the control is given back to the called
program at the next statement after SUBMIT and the value of
d_value1 ie Test1 is written on the screen.

2) Create a variant for the program (see creating variants for ABAP
Programs). And use the statement given below. And see the result.
Note that SORD is the variant name and you need to replace it with
the name given by you.

SUBMIT ZEXERCISE_1 using selection-set 'SORD'.

Posted by ABAP FRIEND at 4:15 AM 0 comments Links to this post

Monday, March 24, 2008


SAP Hold Data Set Data Own Data and System Status
SAP Hold Data Set Data Own Data and System Status

SAP SYSTEM INFORMATION

If you are on a particular screen and wish to check the current transaction in
SAP then you can follow the menu path given below.
System----->Status.
Please refer the diagram shown below.
Once you click on Status you will see the screen shown below.
In the above screen you can see the complete SAP system
information.

SAP OWN DATA

In the SAP System if you want to set defaults or want to give your
own preferences then you can follow the menu path given below.

SYSTEM -------- USER PROFILE -------- OWN DATA.

Please refer the screen shown below.


For example you can change the way system date is displayed.
(mm.dd.yyyy) or (dd.mm.yyyy)
Hold Data and Set Data

Suppose you want to create multiple Sale Orders or Purchase Orders


with similar data. Then you need not type in all the fields again and
again. This can be done by using the Hold Data and Set Data
functionality.

To check this functionality pleas run transaction VA01 ---- SAP Sales
Order Create. Type in the required fields like

Ship-to Party
Sold-to Party
Purchase Order Number
Material No
Quantity

and then click on HOLD Data (Menu Path >>>>>>>>> System


---------- User Profile ------- Hold Data)

Please refer the figure below.


The fields that contain data will be held even after saving the sales
Order and will remain when the next VA01 screen appears. Now you
can make changes in the data and Save the Order.

Similarly you can use Set Data. By using Set Data the values remain
on the screen but are not available for editing. Set Data can be used
if you are sure that you would be creating multiple objects in same
with exactly the same data values.

Posted by ABAP FRIEND at 9:19 AM 0 comments Links to this post


Labels: Own Data, SAPHold Data, Set Data, System Status

Wednesday, March 19, 2008


SAP ABAP Tutorial for creating an RFC (Remote enabled Function
Module)
SAP ABAP Tutorial for creating an RFC (Remote enabled Function
Module)

Task: To create an RFC for creating a Sales order in SAP.

In the earlier posts we have already seen how to use a BAPI to


create a SALES order in SAP ABAP. Today we will create an RFC to
post a sales order.

Note: You can use the following BAPIs and Function modules to
create a Sales Order in SAP.

BAPI_SALESORDER_CREATEFROMDAT1 Sales Order: Create


Sales Order
BAPI_SALESORDER_CREATEFROMDAT1 Sales Order: Create
Sales Order
SD_SALESDOCUMENT_CREATE

Other BAPIs related to Sales Order are as follows.

BAPISDORDER_GETDETAILEDLIST Sales Order: List of All


Order Data
BAPI_ORDER_CHANGE_STATUS_GET Change status for order
BAPI_SALESORDER_CHANGE Sales Order: Change Sales Order
BAPI_SALESORDER_GETLIST Sales order: List of all orders for
customer
BAPI_SALESORDER_GETSTATUS Sales order: Display status
BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales
Ord

Transactions used in this Tutorial.

SE37 Function Builder


SE38 ABAP Editor
SE80 Object Navigator
SHDB BDC Recorder

First we will do a BDC recording using transaction SHDB. To see


details on how to do a BDC recording please click here.

In this case you need to use the transaction VA01 to do the recording.

We will do the recording for the following fields.

Order Type

Sold-to Party
Ship-to Party
Purch Ord No
Material
Quantity

In the function module that we create these will be the Import


Parameters.

Note: you need to do the BDC recording for all the mandatory fields
for creating a Sales Order.

Once the BDC recording is complete for Transaction VA01 as shown


in the previous post (Refer this)

We need to create a program for this recording (Refer this).

Once the above two tasks are complete we need to do some clean
up as we have to transfer this program to a function module. Please
refer to the following program.

*******************************************************************************
***************************************************

report ZSALESORDER
no standard page heading line-size 255.

DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER


LINE,
CTUMODE LIKE CTU_PARAMS-DISMODE VALUE 'A',
CUPDATE LIKE CTU_PARAMS-UPDMODE VALUE 'L',
MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER
LINE,
L_SUBRC LIKE SY-SUBRC,
L_MSTRING(480),
NODATA VALUE '/'.

*include bdcrecx.

start-of-selection.

perform bdc_dynpro using 'SAPMV45A' '0101'.


perform bdc_field using 'BDC_CURSOR'
'VBAK-SPART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBAK-AUART'
'OR'.
perform bdc_field using 'VBAK-VKORG'
''.
perform bdc_field using 'VBAK-VTWEG'
''.
perform bdc_field using 'VBAK-SPART'
''.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBKD-BSTKD'
'15493'.
perform bdc_field using 'KUAGV-KUNNR'
'7777'.
perform bdc_field using 'KUWEV-KUNNR'
'7777'.
perform bdc_field using 'RV45A-KETDAT'
'04/01/2008'.
perform bdc_field using 'RV45A-KPRGBZ'
'D'.
perform bdc_field using 'VBKD-PRSDT'
'03/19/2008'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-KWMENG(01)'.
perform bdc_field using 'RV45A-MABNR(01)'
'y-351'.
perform bdc_field using 'RV45A-KWMENG(01)'
' 1'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_field using 'VBKD-BSTKD'
'15493'.
perform bdc_field using 'KUAGV-KUNNR'
'7777'.
perform bdc_field using 'KUWEV-KUNNR'
'7777'.
perform bdc_field using 'RV45A-KETDAT'
'04/01/2008'.
perform bdc_field using 'RV45A-KPRGBZ'
'D'.
perform bdc_field using 'VBKD-PRSDT'
'03/19/2008'.
perform bdc_field using 'VBKD-ZTERM'
'ZB01'.
perform bdc_field using 'VBKD-INCO1'
'CIF'.
perform bdc_field using 'VBKD-INCO2'
'Dsseldorf'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-MABNR(02)'.
perform bdc_dynpro using 'SAPLSPO2' '0101'.
perform bdc_field using 'BDC_OKCODE'
'=OPT1'.
perform bdc_transaction using 'VA01'.

Form bdc_transaction using tcode.

CALL TRANSACTION TCODE USING BDCDATA


MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.
L_SUBRC = SY-SUBRC.

WRITE: / 'CALL_TRANSACTION',
TCODE,
'returncode:'(I05),
L_SUBRC,
'RECORD:',
SY-INDEX.
LOOP AT MESSTAB.

ENDLOOP.

endform.
*----------------------------------------------------------------------

* Start new screen

*----------------------------------------------------------------------

FORM BDC_DYNPRO USING PROGRAM DYNPRO.


CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.

*----------------------------------------------------------------------

* Insert field

*----------------------------------------------------------------------

FORM BDC_FIELD USING FNAM FVAL.


IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.

*******************************************************************************
***************************************************
Please make a note that the above program has been modified from
the program that was generated using transaction SHDB. The include
BDCRECX has been commented out and the code has been inserted
in the main program. We will do further modifications to this program
while inserting this code in the Remote Enabled Function Module
RFC.

We will now create a Function Module and make it Remotely


Enabled. How to create a function module see here.

Before creating a function module you need to create a function


group see here.

Once the structure of the function module is created we need to


create the Import Parameters. The import parameters we vary from
system to system and will depend on the fields that you need to
transfer to SAP R/3. Ideally there will be Import Parameters, Tables
and Export Parameters.

Please see the figure below.

IMPORTANT: Note that the Pass Value filed has been selected.
This filed has to be selected for all RFCs.
Once the Import Parameters are set you can create the export
parameters.

Here we will be exporting the Sales Order Number.

IMPORTANT: Note that the Pass Value filed has been selected.
This filed has to be selected for all RFCs.

Now we need to create an Include program as shown below.

Put the following code in a separate include program. This include


program will be inserted in one of the includes of the function module.
Namely LZSALESTOP. Please note that this name fill differ in your
system. But the last three letters of the include will be TOP.

Also make a note of the following.

The include ending with UXX (in our case LZSALESUXX) should not
be modified. SAP generates the following code in this include.

*****************************************************************
* THIS FILE IS GENERATED BY THE FUNCTION
LIBRARY. *
* NEVER CHANGE IT MANUALLY,
PLEASE! *
*****************************************************************

Put the following code in a separate include program. This include


program will be inserted in one of the includes of the function module.
Namely LZSALESTOP. Please note that this name fill differ in your
system. But the last three letters of the include will be TOP.

INCLUDE LZSALESU01.

***INCLUDE ZSALESCREATEI .

DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER


LINE,
CTUMODE LIKE CTU_PARAMS-DISMODE VALUE 'A',
CUPDATE LIKE CTU_PARAMS-UPDMODE VALUE 'L',
MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER
LINE,
L_SUBRC LIKE SY-SUBRC,
L_MSTRING(480),
NODATA VALUE '/'.

Form bdc_transaction using tcode.

CALL TRANSACTION TCODE USING BDCDATA


MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.
L_SUBRC = SY-SUBRC.

WRITE: / 'CALL_TRANSACTION',
TCODE,
'returncode:'(I05),
L_SUBRC,
'RECORD:',
SY-INDEX.

endform.
*----------------------------------------------------------------------

* Start new screen

*----------------------------------------------------------------------
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.

*----------------------------------------------------------------------

* Insert field

*----------------------------------------------------------------------

FORM BDC_FIELD USING FNAM FVAL.


IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.

Now the main code has to be inserted in the body of the function
module. The code shown below needs to be inserted in the body of
the function module.

Please note that in the code given below the hard coded values are
replaced by IMPORT Parameters of the function module.

FUNCTION Z_SALES_CREATE.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(ORDTYP) LIKE VBAK-AUART
*" VALUE(SOLDTO) LIKE KNA1-KUNNR
*" VALUE(SHIPTTO) LIKE KNA1-KUNNR
*" VALUE(PURCHORDNO) LIKE VBKD-BSTKD
*" VALUE(MATNO) LIKE MARA-MATNR
*" VALUE(QTY) LIKE RV45A-KWMENG
*" EXPORTING
*" VALUE(SALESORDNO) LIKE VBAK-VBELN
*"----------------------------------------------------------------------

perform bdc_dynpro using 'SAPMV45A' '0101'.


perform bdc_field using 'BDC_CURSOR'
'VBAK-SPART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBAK-AUART'
ORDTYP.
perform bdc_field using 'VBAK-VKORG'
''.
perform bdc_field using 'VBAK-VTWEG'
''.
perform bdc_field using 'VBAK-SPART'
''.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBKD-BSTKD'
PURCHORDNO.
perform bdc_field using 'KUAGV-KUNNR'
SOLDTO.
perform bdc_field using 'KUWEV-KUNNR'
SHIPTTO.
perform bdc_field using 'RV45A-KETDAT'
'04/01/2008'.
perform bdc_field using 'RV45A-KPRGBZ'
'D'.
perform bdc_field using 'VBKD-PRSDT'
'03/19/2008'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-KWMENG(01)'.
perform bdc_field using 'RV45A-MABNR(01)'
MATNO.
perform bdc_field using 'RV45A-KWMENG(01)'
QTY.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_transaction using 'VA01'.

GET PARAMETER ID 'AUN' FIELD SALESORDNO.


ENDFUNCTION.

Note that the remotely enabled and Start Immediately radio


buttons are selected as shown below.

Please add the following line once the Call Transaction is completed.

GET PARAMETER ID 'AUN' FIELD SALESORDNO.

The above command will get the newly created Sales Order in the
filed SALESORDNO. Alternatively you can follow the procedure given
below using the USEREXIT.

GET PARAMETER ID 'AUN' FIELD SALESORDNO. Is a simpler way


of getting the latest sales order number.

For more details on GET PARAMETER ID and SET PARAMETER ID


please see the following.

SAP SPA/GPA Parameters


Important. The Sales Order number should be obtained in the
EXPORT parameters of the function module. This is not handled
in the code given below. But I will mention the user-exit from
where the Sales Order number needs to be exported to this
function module. We will discuss IMPORTING and EXPORTING
from SAP Memory in the next Post.

User Exit Program Name: MV45AFZZ

FORM
USEREXIT_SAVE_DOCUMENT.

* Example:
* CALL FUNCTION 'ZZ_EXAMPLE'
* IN UPDATE TASK
* EXPORTING
* ZZTAB = ZZTAB.
LOOP AT XVBEP WHERE UPDKZ NE
UPDKZ_DELETE
AND NOT AUFNR IS INITIAL.
SET PARAMETER ID 'ANR' FIELD XVBEP-
AUFNR.
ENDLOOP.

ENDFORM.

The Sales order number will be generated at the above point and can
be exported to SAP Memory which can then be imported back into
the function module.
Posted by ABAP FRIEND at 9:59 AM 2 comments Links to this post
Labels: Creating RFCs in SAP ABAP, Remote Function Call, SAPRFC

Monday, March 17, 2008


SAP ABAP Tutorial: Module Pool Programming. Part 3
SAP ABAP Tutorial: Module Pool Programming. Part 3
We will now proceed further and see the code that needs to be put in place to actually create the
sales order.

Code for the PBO Module


*&---------------------------------------------------------------------*
*& Module pool ZSALESORDSCREEN *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

INCLUDE ZSALESORDERTOP . "

* INCLUDE ZSALESORDERO01 . *
* INCLUDE ZSALESORDERI01 . *
* INCLUDE ZSALESORDERF01 . *

*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'ZSALES'.
SET TITLEBAR 'ZSL'.

ENDMODULE. " STATUS_9000 OUTPUT


*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_9000 INPUT.

CASE OK_CODE.

When 'BACK'.
leave to screen 0.

When 'ORDE'.

Perform Create_Salesord.
leave to screen 0.

endcase.

ENDMODULE. " USER_COMMAND_9000 INPUT


*&---------------------------------------------------------------------*
*& Form Create_Salesord
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM Create_Salesord.
*-------------------------Data Declaration-----------------------------*
Data: st_BAPISDHEAD like BAPISDHEAD, " Sales Order Header Data
ta_BAPIITEMIN like BAPIITEMIN occurs 0 with header line, " Ln item
ta_BAPIPARTNR like BAPIPARTNR occurs 0 with header line, " Partner
d_BAPIRETURN1 like BAPIRETURN1, " Bapi return msg
d_vbeln like bapivbeln-VBELN. " Sales Order Number

* Move the data to create sales order in the repective parameters------*


move: txtordtype to st_BAPISDHEAD-DOC_TYPE, " Sales document type
txtpurchord to st_BAPISDHEAD-PURCH_NO_C,
* '00010' to ta_BAPIITEMIN-ITM_NUMBER,
txtmatno to ta_BAPIITEMIN-MATERIAL,
* '1100' to ta_BAPIITEMIN-PLANT,
txtqty to ta_BAPIITEMIN-REQ_QTY,
'AG' to ta_BAPIPARTNR-PARTN_ROLE, " Sold to Party
txtsoldto to ta_BAPIPARTNR-PARTN_NUMB.
* Append the internal tables-------------------------------------------*
append ta_BAPIPARTNR.
clear ta_BAPIPARTNR.
append ta_BAPIITEMIN.
clear ta_BAPIITEMIN.
* Move ship to party---------------------------------------------------*
move: 'RG' to ta_BAPIPARTNR-PARTN_ROLE, " Ship to party
txtshipto to ta_BAPIPARTNR-PARTN_NUMB.
* Append the internal tables-------------------------------------------*
append ta_BAPIPARTNR.
clear ta_BAPIPARTNR.

* Call the Bapi to create the sales order

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'


EXPORTING
ORDER_HEADER_IN = st_BAPISDHEAD
* WITHOUT_COMMIT =''
* CONVERT_PARVW_AUART = 'X'
IMPORTING
SALESDOCUMENT = d_vbeln
* SOLD_TO_PARTY =
* SHIP_TO_PARTY =
* BILLING_PARTY =
RETURN = d_BAPIRETURN1
TABLES
ORDER_ITEMS_IN = ta_BAPIITEMIN
ORDER_PARTNERS = ta_BAPIPARTNR
* ORDER_ITEMS_OUT =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CCARD =
* ORDER_CFGS_BLOB =
* ORDER_SCHEDULE_EX =
.
if d_vbeln <> space.
* Message I001.
* Message I002 with D_vbeln.
Message ID 'ZEXERCISE2' TYPE 'S' Number '000'.
* write: 'Sales order No. ', d_vbeln.
endif.

ENDFORM. " Create_Salesord

*&---------------------------------------------------------------------*
*& Include ZSALESORDERTOP *
*& *
*&---------------------------------------------------------------------*

PROGRAM ZSALESORDSCREEN .

Data: ok_code(4),
txtordtype(2),
txtsoldto(10),
txtshipto(10),
txtpurchord(10),
txtmatno(18),
txtqty(13).
Posted by ABAP FRIEND at 9:28 AM 0 comments Links to this post
SAP ABAP Tutorial: Module Pool Programming. Part 2
SAP ABAP Tutorial: Module Pool Programming. Part 2

Once the program 'ZSALESORDSCREEN' is created Saved and Activated, run Transaction
SE51.

Enter screen number '9000'

Screen numbers can be up to 4 characters long, all of which must be digits. Screen numbers from
9000 are reserved for customer-specific screens.
In the Screen Painter enter a short Description and Activate the screen.

Once this is done you will be presented with a screen that will have three tabs, namely
Attributes/Element List/Flow Logic

Click on Element List and type Ok_Code and Activate.

Now click on Flow Logic.

You should see the following code in the Flow Logic.


PROCESS BEFORE OUTPUT.
MODULE STATUS_9000.

PROCESS AFTER INPUT.


MODULE USER_COMMAND_9000.

Create MODULE STATUS_9000 by double clicking on it. The following code will be
automatically created.

INCLUDE ZSALESORDERTOP . "

* INCLUDE ZSALESORDERO01 . *
* INCLUDE ZSALESORDERI01 . *
* INCLUDE ZSALESORDERF01 . *

*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_9000 OUTPUT

Uncomment the following code.

SET PF-STATUS 'ZSALES'. ------------------ Menu Bar for the custom Sales Order Screen.
SET TITLEBAR 'ZSL'. -------------------- Title.

Give appropriate names to PF-STATUS and TITLE BAR. Once the code is uncommented and the
appropriate names are given. Double click on the name ZSALES. Once you see the prompt click
on create object.

You will see the following three options in the resulting screen.

Menu bar Status for Sales Order Screen


Application toolbar Status for Sales Order Screen
Function keys Status for Sales Order Screen

Click on the Function Keys Drop Down Box. You will see the Standard Tool Bar with Icons that
you normally see in the SAP Screen.
Enter the following values in the empty fields.

Standard Toolbar

Ente SAVE BACK EXIT CANCEL PRINT FIND FINDNEXT FIRSTPAGE


PREVP NEXT LAST
Activate the PF-STATUS.

You will be prompted to enter the Function Text and Info Text for the button Enter.
Please enter the following values.

Function Text 'Ente'


Info Text 'Enter'

Execute Transaction SE80 and Activate the complete program by right clicking on it.

We will now create a transaction code for our program. To create a transaction code right click on
the main program and from the pop-up menu select Create-----Transaction.

In the dialog box enter the following values.

Transaction Code 'ZSALESORD'


Short Description 'Create Sales Order'

And Click on Save.


You will now be asked to enter Program name and Screen Number. Enter the following values.

Program ZSALESORDSCREEN
Screen 9000

Save and Activate the Program

Now we need to enter code to create the Sales order. We also need to create the Screen
Elements.

In transaction SE80 in the left pane click on Screens and then double click on 9000.
Now from the menu click on LAYOUT button.

We need to create Labels and Text Boxes for the following fields.

Filed (Label Display) Label Name TextBox Name Def Length


Order Type lblordtyp txtordtyp 2
Sales Org lblsalesorg txtsalesorg 4
Distribution Channel lbldistchnl txtdistchnl 2
Division lbldiv txtdiv 2
Sold-to Party lblsoldto txtsoldto 10
Ship-to Party lblshipto txtshipto 10
Purchase Ord lblpurchord txtpurchord 10
Material lblmat txtmat 18
Quantity lblqty txtqty 13

We also need to create a command button as follows

Label Name
Create Order lblcreateord

We will now look at the property box which is displayed after double clicking on each screen
element.
Order Type (Label)
Name lblordtyp
Text Order_Type

Order Type (Text Box)


Name txtordtyp
Text
Def. Length 2

Similarly fill the Property box for other fileds

Important

Property Box for Command Button in this case the Function Code is important

Create Order
Name cmdord
Text Create Order
Fct Code ORDE

SAP ABAP Tutorial: Module Pool Programming. Part 3

Posted by ABAP FRIEND at 2:59 AM 0 comments Links to this post


SAP ABAP Module Pool Programming Tutorial Part 1
SAP ABAP Tutorial: Module Pool Programming. Part 1

Related Transaction Codes:

SE51: Screen Painter Initial Screen


SE41: Menu Painter Initial Screen
SE38: ABAP Editor Initial Screen
SE80: Object Navigator

In this tutorial we will explore module pool programming. We will


create a sales order.
We will combine the Initial screen and the Overview Screen of
Transaction VA01 Create Standard Order into one screen.

We will use the following BAPI to create the Sales Order

BAPI_SALESORDER_CREATEFROMDAT1
The following fields will be updated.

Order Type OR
Sales Org 1000
Dsitribution Channel 10
Division 00

Sold-to Party 7777


Ship-to Party 7777
Purch Ord No 15493
Material y-351
Order Quantity 10

We will now proceed and create the main program.


Run Transaction SE80 and create a program
'ZSALESORDSCREEN'. First just create this program save and
activate.

To do so in the dropdown box select Program and type the name


'ZSALESORDSCREEN' in the filed below and hit enter.
You will see a prompt that says 'Program does not exist' do you want
to create a new object?

Say yes.
Create a program with TOPINCLUDE, give an appropriate name to
the TOPINCLUDE and save the program.

See SAP ABAP Tutorial: Module Pool Programming. Part 2

Posted by ABAP FRIEND at 2:12 AM 0 comments Links to this post


Labels: ModulePool Programming, SAP BAPI, SAP SCREEN TRANSACTIONS

Tuesday, February 26, 2008


Function Module POP UP TO CONFIRM
Function Module 'POPUP_TO_CONFIRM'.
Another function module that is used frequently is
'POPUP_TO_CONFIRM' it is used as follows.

REPORT ZEX_POPUPTOCONFIRM .

*-------------------------Data Declaration-----------------------------*

Data: d_response(1). " Response from popup

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = 'Create Sales Order '

* DIAGNOSE_OBJECT = ' '

TEXT_QUESTION = 'Create sales order?'

TEXT_BUTTON_1 = 'YES'(001)

* ICON_BUTTON_1 = ' '

TEXT_BUTTON_2 = 'NO'(002)

* ICON_BUTTON_2 = ' '

* DEFAULT_BUTTON = '1'

DISPLAY_CANCEL_BUTTON = 'X'

* USERDEFINED_F1_HELP = ' '

* START_COLUMN = 25

* START_ROW = 6

* POPUP_TYPE =

IMPORTING

ANSWER = d_response

* TABLES

* PARAMETER =
EXCEPTIONS

TEXT_NOT_FOUND = 1

OTHERS = 2

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Posted by ABAP FRIEND at 7:58 AM 0 comments Links to this post


Labels: ABAP FUNCTION MODULE POPUP, ABAP user confirmation,
POPUP_TO_CONFIRM, SAP ABAP Function Modules, SAP ABAP POUP*, SAP ABAP
USER INPUT

Monday, February 25, 2008


Displaying Messages in ABAP
Displaying Messages in ABAP

DownLoad PDF

In ABAP you need to display a message on various occasions, for


example if the user has input erroneous data then a message needs
to be displayed, instructing the user to rectify the error, or after a
certain task is accomplished, you may need to display a message.

A message class is used to display messages from the program and


the transaction used for this purpose is SE91. The messages are
stored in the table T100. Examples of calling a message are shown
below.

You may need to create a message class for displaying your


message. You need to check if a message class has already been
created by other ABAP colleagues. Note that messages classes
would already exist in your system, but you may have to create a new
class for your programs.

To create a new message class type the name following the naming
standards and type the name as shown in the figure below.
Alternatively you can goto transaction SE91 to create a new message
class.

In this example we will type the name as shown below and double
click on the name 'ZEXERCISE1'.

The following prompt will appear. Click on Yes.


Click on Yes again.

Type an appropriate short text.


Create a $tmp object

Type a message that you would like to display. Please note the
number associated with the message. In this case the message is
'000'.

We have created 3 messages.


We now need to display these messages in our program. We will
make changes in the Create Sales order program as shown below.

Some examples of calling a message.

1. MESSAGE xnnn.
2. MESSAGE ID id TYPE mtype NUMBER n.
3. MESSAGE xnnn(mid).

There are six kinds of message type:


A (Abend)
Termination

E (Error)
Error

I (Info)
Information

S (Status)
Status message

W (Warning)
Warning

X (Exit)
Termination with short dump

See the syntax shown below for displaying a message in your


programs.

MESSAGE ID id TYPE mtype NUMBER n.

ID
message class in our case ZEXERCISE1 or ZEXERCISE2

TYPE
message type (A,E,I,S,W,X)

NUMBER
message number

Example

MESSAGE ID 'ZEXERCISE' TYPE 'S' NUMBER '000'.


Once the program is run the messages will be displayed as follows.
Choose the one that suits your requirement.
The following message is displayed just to show as to how to
explicitly call another message class.

Posted by ABAP FRIEND at 6:22 AM 0 comments Links to this post


Labels: ABAP Messages, Calling messages in ABAP, Displaying messages in ABAP,
SAP ABAP messages, Table T100, Transaction Code SE91, Tutorial on ABAP messages
Thursday, February 21, 2008
BAPI Sales Order Create Code
Bapi Sales Order Create Code

We saw in the earlier example as to how to create a sales order from


the SE37 interface. Now we need to create a program and call the
BAPI to create sales orders. Later we will discuss ways to call a BAPI
from a non-sap system.

Given an appropriate name to the program. Please follow the naming


conventions as per your company. ABAP programs should always
start with a 'Z' or a 'Y'.
Enter suitable description.

Create a $tmp objects or create a transport request. Transport


requests would be covered in the later tutorials.
Follow the menu path EDIT----->Pattern

Enter the name of the BAPI as shown below.


The inserted BAPI is shown below.

We now need to get the import parameters, export parameters and


the tables.
Note: Take care that the data declaration in the program for the above
mentioned parameters matches exactly as given in the BAPI. To
ensure that please open the BAPI using transaction SE37 and copy
the exact names of the parameters from the BAPI structure.

If this is not followed your program will give an 'ABAP DUMP'.

Check the Import parameters


The following figure shows the import parameter BAPISHEAD and we
need to declare a structure in our ABAP program as follows.

Data: st_BAPISDHEAD like BAPISDHEAD, " Sales Order Header


Data

Make sure you follow the ABAP naming conventions.


Similarly for tables pick up the names from the function module.

Data: st_BAPISDHEAD like BAPISDHEAD, " Sales Order Header


Data
ta_BAPIITEMIN like BAPIITEMIN occurs 0 with header line, " Ln
item
ta_BAPIPARTNR like BAPIPARTNR occurs 0 with header line, "
Partner
d_BAPIRETURN1 like BAPIRETURN1, " Bapi return msg
d_vbeln like bapivbeln-VBELN. " Sales Order Number
The complete program is given below. Please make sure that you use
the data specific to your system. In the following some of the values
are hard coded. You need to use variables and pick up the values.
Please note in the following program, sold to party (SP) has been
entered as 'AG' and ship to party (SH) as 'RG'.

SP--------AG
SH--------RG

Order type 'OR' as 'TA'

Please use TA instead of OR

Also if you set the * CONVERT_PARVW_AUART = 'X' parameter to


'X' you can use sold to party as SP and ship to party as SH.

REPORT ZEX_BAPISALESORDCRT .

*-------------------------Data Declaration-----------------------------*
Data: st_BAPISDHEAD like BAPISDHEAD, " Sales Order Header
Data
ta_BAPIITEMIN like BAPIITEMIN occurs 0 with header line, " Ln item
ta_BAPIPARTNR like BAPIPARTNR occurs 0 with header line, "
Partner
d_BAPIRETURN1 like BAPIRETURN1, " Bapi return msg
d_vbeln like bapivbeln-VBELN. " Sales Order Number

* Move the data to create sales order in the repective parameters------


*
move: 'TA' to st_BAPISDHEAD-DOC_TYPE, " Sales document type
'15493' to st_BAPISDHEAD-PURCH_NO_C,
'00010' to ta_BAPIITEMIN-ITM_NUMBER,
'Y-351' to ta_BAPIITEMIN-MATERIAL,
'1100' to ta_BAPIITEMIN-PLANT,
'1' to ta_BAPIITEMIN-REQ_QTY,
'AG' to ta_BAPIPARTNR-PARTN_ROLE, " Sold to Party
'0000007777' to ta_BAPIPARTNR-PARTN_NUMB.
* Append the internal tables-------------------------------------------*
append ta_BAPIPARTNR.
clear ta_BAPIPARTNR.
append ta_BAPIITEMIN.
clear ta_BAPIITEMIN.
* Move ship to party---------------------------------------------------*
move: 'RG' to ta_BAPIPARTNR-PARTN_ROLE, " Ship to party
'0000007777' to ta_BAPIPARTNR-PARTN_NUMB.
* Append the internal tables-------------------------------------------*
append ta_BAPIPARTNR.
clear ta_BAPIPARTNR.

* Call the Bapi to create the sales order

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'


EXPORTING
ORDER_HEADER_IN = st_BAPISDHEAD
* WITHOUT_COMMIT = ' '
* CONVERT_PARVW_AUART = ' '
IMPORTING
SALESDOCUMENT = d_vbeln
* SOLD_TO_PARTY =
* SHIP_TO_PARTY =
* BILLING_PARTY =
RETURN = d_BAPIRETURN1
TABLES
ORDER_ITEMS_IN = ta_BAPIITEMIN
ORDER_PARTNERS = ta_BAPIPARTNR
* ORDER_ITEMS_OUT =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CCARD =
* ORDER_CFGS_BLOB =
* ORDER_SCHEDULE_EX =
.

if d_vbeln <> space.


write: 'Sales order No. ', d_vbeln.
endif.

Posted by ABAP FRIEND at 2:10 AM 0 comments Links to this post


Labels: Bapi Sales Order create, BAPI_SALESORDER_CREATEFROMDAT1, Sample
program to create sales order using BAPI, SAP ABAP BAPI, SAP BAPI, Using BAPI,
Using BAPIs

Wednesday, February 20, 2008


BAPI Sales Order Create
BAPI to Create Sales Order. DownLoad PDF

We will see the functionality of


BAPI_SALESORDER_CREATEFROMDAT1.

As shown below, run transaction SE37.

and enter the name of the BAPI


BAPI_SALESORDER_CREATEFROMDAT1.
Press F8 or click on execute. First we need to enter the header data.

Click on the single entry Icon as shown below.


Enter doc type and purchase order number. This will depend on your
requirement and the data will vary from system to system.

Order type ---------- 'OR'


Once the header data is entered we need to enter the line item data.
Please note that in this example we would be entering minimum data
required just to create a sample sales order. In real life scenario you
need to enter all the fields as per the companies requirement.

Enter the following fields.

Item Number ---- 000010


Material----------y-351
Plant-------------1100
Required quantity 1
Purchase Order number 15393

Please not that all the above data is system specific and you need to
enter the values available in your system. You can refer to an existing
sales order with the help of transaction VA03.
Need to enter the Partner Data. Namely Sold to Party and Ship to
Party.

Enter Sold to Party indicator 'SP'


Ship to Party as 'SH'
Enter the sold to and ship to party number as 7777

Go back and Save the data. This will help you to create another sales
order just by retrieving the values again by clicking on Test Data
button. Or in case you make a mistake then you can just change the
erroneous data.

Once you save the data. Press F8 or click on execute. As you can
see below. Sales Order 7708 is created. Again this number will be
different in your system.
Now you need to check the newly created Sales Order. Type /NVA02
or /NVA03 as the transaction code.

Enter the sales order number.


Press enter. The new sales order is displayed.
Posted by ABAP FRIEND at 4:39 AM 0 comments Links to this post
Labels: ABAP BAPI, BAPI, Bapi Sales Order create, Bapi to create sales order,
BAPI_SALESORDER_CREATEFROMDAT1, SAP BAPI, SAP Interfacing

Tuesday, February 19, 2008


Function Modules Create Text and Read Text
Function Modules Create Text and Read Text
Many a times it is required to Read text from SAP Objects like Sales
Order or Purchase Order from an ABAP program. Similarly it may
also be required to write text in Sales Order or other SAP objects
through ABAP Code.

The following Function Modules can be used to do the needful.

1) Create_Text
2) Read-Text

To read text from sales order Header Text we first need to create
some text. Open an existing Sales order using transaction VA02 as
shown in the figure below.
In the header text type some text for example 'This is Header Text'
and double click in the text area.

Once this is done the text gets saved and the following screen
appears. Here you can type some more text.

Go back to the previous screen


See the change in the Icon as shown in the figure below. It now has
some lines.
Now we need to run execute the function module to read the text that
we have just typed. But before that we need to find the following

1) Text Object to read


2) Text ID to read.

Hence click on the Icon shown below.


Then the following screen appears. From here we can pick up the
Text Object (VBBK) and Text ID (0001). For header text.

This can also be achieved using transaction SE75. As shown below.


Select Text Objects and IDs as shown below and click on display.

We now need to search for Sales. Click on the search tool as shown
below.

Type Sales as shown below.


Select Sales Header. From the figure we can see the object as
VBBK. Then click on Text IDs.

Select 0001 for header note.


We now have the following information with us.

1) Text Object ------- 'VBBK'


2) Text ID -----------'0001'
3) Sales order number ----'0000005473'
4) Language 'EN'

The above info should be obtained as shown in the above screen


shots. Now run transaction SE37 and execute the function module
'READ_TEXT'

Enter the above mention data. Please note that this data will vary
from system to system.
Name is the Sales Order Number.

Run the function module. As shown below the table has one record.
Click on that entry.
The text is displayed as shown below.

The test data that has been entered can be saved and by clicking on
the save button.

Give appropriate name.


Once saved it can be retrieved from the Test Data Directory.

Similarly Text can also be written in Sales Order/Purchase Order or


any other SAP object using the function module 'CREATE DATA'.
We will insert text in the 'COMPLETION NOTE'. The following figure
shows the Object name and Object ID.

Enter the data in the function module parameters as shown below.


And run the function module.
Open the sale order. Goto---Header Text. See the text in
COMPLETION NOTE.

Similarly text can be read or written in the Item text. The above
mentioned steps can be followed to get the Object and ID.

Note: For Item text the 'NAME' parameter in the function module
needs to be filled with

Sales Order number + item number.


Posted by ABAP FRIEND at 8:09 AM 0 comments Links to this post
Labels: ABAP CREATE_TEXT, ABAP Function Modules, ABAP READ_TEXT,
FUNCTION Module CREATE_TEXT, Function Module READ_TEXT, SAP
CREATE_TEXT, SAP Function Modules, SAP Read_Text

Thursday, January 24, 2008


Displaying Data Using SE11/SE12/SE16/SE16N
Logon to SAP

Enter Transaction Code SE11.

Note that transaction SE11 can be used to Display/Change/Create


database tables. Other transactions for ABAP dictionary are as
follows

SE12 Display
Database Tables
View
Data Types
Domain
Search Help
Lock Objects

SE11 Display/Change/Create
Database Tables
View
Data Types
Domain
Search Help
Lock Objects

SE16 and SE16N Data Browser


Enter the Table name in this case VBAK

Click on Display.

Click on COntents as shown below or use shortcut


CTRL+SHIFT+F10

Enter the desired data. In this case the sales order number.
The data is displayed as shown below.

Posted by ABAP FRIEND at 3:05 AM 1 comments Links to this post


Labels: ABAP Data Browser, ABAP Dictionary, ABAP Tables, ABAPLOVERS, Data
Browser, Displaying data in SAP, Let us abap, SAP Data Browser, SE11, SE12, SE16,
SE16N
Newer Posts Older Posts Home

ABAP TIPS

PREVIOUS NEXT RANDOM

Always specify your conditions in the Where-clause instead of checking them yourself with check
statements. The database system can then use an index (if possible) and the network load is
considerably less.

Since your web browser does not support JavaScript, here is a non-JavaScript version of
the image slideshow:

Always specify your conditions in the Where-clause instead of checking them yourself with
check statements. The database system can then use an index (if possible) and the
network load is considerably less.

For all frequently used Select statements, try to use an index. You always use an index if
you specify (a generic part of) the index fields concatenated with logical Ands in the Select
statement's Where clause. Note that complex Where clauses are poison for the statement
optimizer in any database system.

If there exists at least one row of a database table or view with a certain condition, use the
Select Single statement instead of a Select-Endselect-loop. Select Single requires one
communication with the database system, whereas Select-Endselect needs two.

It is always faster to use the Into Table version of a Select statement than to use Append
statements.

To read data from several logically connected tables use a join instead of nested Select
statements. Network load is considerably less.

If you want to find the maximum, minimum, sum and average value or the count of a
database column, use a select list with aggregate functions instead of computing the
aggregates yourself. Network load is considerably less.

If you process your data only once, use a Select-Endselect-loop instead of collecting data
in an internal table with Select Into Table. Internal table handling takes up much more
space.

Use a select list or a view instead of Select * , if you are only interested in specific columns
of the table. Network load is considerably less.

For all frequently used, read-only tables, try to use SAP buffering. Network load is
considerably less.

Whenever possible, use array operations instead of single-row operations to modify your
database tables. Frequent communication between the application program and database
system produces considerable overhead.

Whenever possible, use column updates instead of single-row updates to update your
database tables. Network load is considerably less.

Instead of using nested Select loops or FOR ALL ENTRIES it is often possible to use
subqueries. Network load is considerably less.

Use the special operators CO, CA, CS, instead of programming the operations yourself. If
ABAP/4 statements are executed per character on long strings, CPU consumption can rise
substantially.
Some function modules for string manipulation have become obsolete and should be
replaced by ABAP/4 statements or functions: STRING_CONCATENATE... ->
CONCATENATE, STRING_SPLIT... -> SPLIT, STRING_LENGTH -> strlen(), STRING_CENTER
-> WRITE...TO...CENTERED, STRING_MOVE_RIGHT -> WRITE...TO...RIGHT-JUSTIFIED

Use the CONCATENATE statement instead of programming a string concatenation of your


own.

If you want to delete the leading spaces in a string, use the ABAP/4 statement SHIFT...LEFT
DELETING LEADING... .Other constructions (with CN and SHIFT...BY SY-FDPOS PLACES,
with CONDENSE if possible, with CN and ASSIGN CLA+SY-FDPOS(LEN) ...) are not as fast.
In any case, avoid using SHIFT inside a WHILE-loop!

Use the SPLIT statement instead of programming a string split yourself.

Use the strlen( ) function to restrict the DO loop to the relevant part of the field, e.g. when
determinating a check-sum.

Use "CLEAR f WITH val" whenever you want to initialize a field with a value different from
the field's type-specific initial value.

Try to keep the table ordered and use binary search or used a table of type SORTED
TABLE. If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes
only O( log2( n ) ).

A dynamic key access is slower than a static one, since the key specification must be
evaluated at runtime. However, for large tables the costs are dominated by number of
comparison needed to locate the entry.

If you need to access an internal table with different keys repeatedly, keep your own
secondary indices.With a secondary index, you can replace a linear search with a binary
search plus an index access.

LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the
specified condition internally. As with any logical expressions, the performance is better if
the operands of a comparison share a common type. The performance can be further
enhanced if LOOP ... WHERE is combined with FROM i1 and/or TO i2, if possible.

Always use Pretty Printer and Extended Program Check before releasing the code. Do not leave
unused code in the program. Comment the code thoroughly. Align the comments and the Code.
Follow the SAP Standards and SAP Best Practices guidelines. Its a good practice to take a dump
of the code on your local drive.

Sap Scripts and SmartForms ABAP Debugger Break Points Pop Up a Calender
Bar Codes ABAP Debugger WatchPoints Module to Read a File
Ole Automation Part1 Standard Reports and Sap Drill Down Reports Concept Module to Reverse A String
Ole Automation Part 2 Scripts Creating a HOT SPOT Run an Executable Program
Processing Blocks in ABAP Important Standard Reports Interactive Programs and Hide with Parameters
Simple ABAP Report in SAP Technique Program for POP up Screen
ALV Grid - Changing Colors Abap Tricks and Tips String Concatenate Printing Selection
ALV Report Example Bapi Sales Order Get Week of the Year Parameters for a Report
Creating Variants For ABAP BAPI Purchase Order SAP ABAP to Add Days to a Uploading and DownLoading
Reports Creating Function Modules in Date a Report
Recording BDC using SAP Add Months to a Date SAP ABAP Version
Transaction Creating Tables in SAP Get Month in the Year Management
Sales Document Flow in Finding User Exits in SAP Display Clock SAP ABAP Short Cuts
ABAP Function Module Create Text ABAP Code For Progress List of Important System
User Exits in SAP SD and Read Text BAR Variables
SAP ABAP Naming Important Transaction Codes ABAP Function Module For ABAP MACROS
Standards in SAP Caluclator ABAP Calling a File Selector
SAP SD Tables ABAP Function Module for ABAP Function Module For Some Important Function
SAP ABAP Data Dictionary Submitting a Program Calender Modules
Tables ABAP Game Tic Tac Toe Displaying Messages in ABAP String Operations
ABAP Internal Table To Excel ABAP ABAP Function Module to
Sheet Function Module Pop Up To Check Validity of Date
MM Important Transaction ABAP Function Module to Confirm Transfer Internal Table
Codes in SAP create Directory Conversion Routines in SAP Contents to a File
Passing g Data From One Different Types of Menus in SAP ABAP Authorization SAP ABAP Program Types
ABAP Program to Another SAP SAP ABAP Module Pool BAPI to Read Customer Data
ABAP Compute Add Collect Function Modules in SAP to Tutorial Checking Validity of Date
and Append check Loged in Users SAP ABAP RFC Download to Application
SAP ABAP Determining ABAP Function Module for Finding Path to SAP Server
Attributes of Data Adding Days to Dates Transaction in Menu ABAP Debugger Breakpoint
SAP ABAP Editor Icons Call a Transaction From a SAP Purchasing Documents and Watchpoint
BAPI for Displaying Material Remote System SAP and ABAP Shortcuts BAPI to get Company Code
Data SAP MM simple Procurement Logical Databases Details
BAPI to get customer bank Cycle Advantages of Logical Creating Material Using BAPI
details BAPI Material EDIT Databases part 2
EDI Outbound Process Finding Decimal Places in Copy to Clipboard Generating a Valid Password
SAP EDI Process Overview Currency BAPI Create Material Logical Databases Structure
Function Module for Vendor Getting negative sign before Finding and Running Making Fields OBligatory in
Bank details a number in ABAP Programs in ABAP Selection Screen
SAP IDOC Program Editor Lock Unlock Program Syntax Check and ABAP Views
Creating a Valid Password in Restricting Select Options Extended Syntax Check Getting a Company Code for
SAP List of BAPIs in the system Select Options upper lower a Plant
SAP BADIs Introduction SAP Function Module case Importing contents of
SAP ABAP MACROS Scramble a String BAPI Sales Order Simulate Clipboard in SAP
POP UP function Module to LSMW Get PLANT and Description Getting a Plant for a Material
Confirm and Save Data POP up table contents on the for a Material Plant Material and Storage
Select Options screen MRP List Function Module Location
BAPI for availability check SAP R3 Bookmarking Production Planning and SAP Production Planning
String to Numerical Websites Controlling Standard Reports
SAP Goods Movement Stock Requirements List Applications in SAP R3 NetWeaver Components
Process Function Module Tool Based Reports Supported Databases and
Getting a List of Plants for a Retail Transaction Codes Important Transaction Codes Operating Systems
Material in SAP
SAP R3 Clients Concept SAP Stock per Bin
ABAP Adobe Forms
Authorization Object Tables
SAP Industry Specific
Solutions

Its TRUE that SAP is expanding its solutions to


allow for integration to other NON-SAP systems. And
JAVA is being used to accomplish this. This does not in
any way mean that ABAP will be replaced by JAVA.
Millions of lines of ABAP codes has been written
which exists in the forms of Reports Interfaces and
Enhancements. This codes runs the biggest companies
of the world. SAP is continuously in the
effort of improving ABAP.

Subscribe to FREE Post


Enter Email

Subscribe

Delivered by FeedBurner

Blog Archive
2008 (205)
o August (2)
Aug 14 (1)
SAP ABAP Important KeywordsThe following list
disp...
Aug 13 (1)
SAP ABAP Function Module to Wrap Long TextThe
foll...
o July (16)
Jul 29 (3)
SAP Retail Transaction Codes: Subsequent
Settlemen...
SAP Retail Transaction Codes: Fresh Items
Procurem...
Important Transaction Codes in SAP Retail: Non-rep...
Jul 28 (3)
SAP Retail Transactions Procurement of
Replenishab...
SAP Retail Transactions Assortment Management
SAP Retail Transaction Codes Pricing
Jul 24 (1)
SAP IS-Retail Transaction Codes Merchandise
Jul 16 (1)
Netweaver Components AUTOID Infrastructure RFID
Jul 15 (1)
SAP Supported Databases Operating Systems
Jul 10 (1)
SAP and Adobe Forms
Jul 09 (1)
SAP Authorization Objects Tables
Jul 08 (1)
SAP Userand Authorization SystemRelated Tables
Jul 07 (1)
SAP Industry Specific Solutions SAP Business Solut...
Jul 02 (1)
SAP Stock Per Bin
Jul 01 (2)
SAP Plant Storage Location Data
SAP Plant Details Company code and Controlling
Are...
o June (50)
Jun 30 (3)
SAP PLant for a Material
SAP Company Code for a Plant
SAP Plant Material and Storage Location
Jun 27 (1)
SAP POP UP TABLE CONTENTS ON THE SCREEN
Jun 26 (2)
SAP Get Plant Description for a Material
SAP Plants for a given Material
Jun 25 (1)
SAP ABAP Finding and Running Programs
Jun 24 (2)
SAP Function Module String Numerical
SAP Function Module String Scramble
Jun 23 (3)
SAP ABAP Negative Sign Before a Number
SAP Function Module Import Clipboard
SAP ABAP Copy to ClipBoard Function Module
Jun 22 (1)
SAP Tool Based Reports
Jun 20 (2)
SAP Goods Movement
SAP Production Planning and Controlling Standard
R...
Jun 19 (2)
SAP MRP List Function Module
SAP Stocks/Requirements List Function Module
Jun 18 (2)
SAP Availability Check BAPI/Function Module
Creating a Valid Password in SAP
Jun 17 (2)
SAP R/3 Bookmarking Websites
SAP R/3 Clients Concept
Jun 16 (1)
Standard Reports in SAP Production Planning
Jun 15 (1)
SAP ABAP Generate Password Function Module
Jun 14 (1)
SAP BAPI Sales Order Simulate
Jun 12 (1)
SAP BAPI List of BAPIS in the System
Jun 11 (1)
SAP LSMW Legacy System Migration Workbench
Jun 10 (2)
SAP R/3 Applications
Standard Reports in SAP Production Planning
Jun 08 (1)
SAP ABAP Macros
Jun 06 (1)
BAPI to get company code details
Jun 05 (5)
SAP ABAP Program EDITOR LOCK/UNLOCK
Using Logical Databases in SAP ABAP
Jun 04 (5)
Jun 03 (5)
Jun 02 (5)
o May (50)
May 31 (3)
May 30 (1)
May 29 (3)
May 28 (2)
May 27 (2)
May 26 (3)
May 23 (1)
May 21 (2)
May 20 (2)
May 16 (2)
May 14 (2)
May 13 (3)
May 12 (2)
May 11 (2)
May 10 (3)
May 08 (3)
May 07 (3)
May 06 (3)
May 05 (2)
May 04 (1)
May 03 (1)
May 02 (1)
May 01 (3)
o April (21)
Apr 30 (2)
Apr 29 (1)
Apr 28 (2)
Apr 27 (1)
Apr 25 (1)
Apr 24 (1)
Apr 23 (2)
Apr 22 (1)
Apr 21 (1)
Apr 17 (1)
Apr 14 (2)
Apr 10 (1)
Apr 09 (2)
Apr 04 (1)
Apr 03 (1)
Apr 01 (1)
o March (32)
Mar 31 (1)
Mar 28 (1)
Mar 27 (1)
Mar 26 (1)
Mar 25 (2)
Mar 24 (1)
Mar 23 (1)
Mar 22 (3)
Mar 21 (1)
Mar 19 (2)
Mar 17 (3)
Mar 14 (1)
Mar 13 (2)
Mar 12 (1)
Mar 07 (2)
Mar 06 (4)
Mar 05 (4)
Mar 04 (1)
o February (28)
Feb 29 (1)
Feb 28 (2)
Feb 27 (2)
Feb 26 (2)
Feb 25 (1)
Feb 22 (1)
Feb 21 (1)
Feb 20 (1)
Feb 19 (1)
Feb 18 (2)
Feb 16 (1)
Feb 15 (3)

Feb 14 (1)

Feb 13 (1)

Feb 10 (1)

Feb 07 (1)

Feb 06 (1)

Feb 05 (1)

Feb 03 (1)

Feb 02 (3)

o January (6)
Jan 31 (1)
Jan 24 (1)
Jan 23 (1)
Jan 22 (1)
Jan 12 (1)
Jan 05 (1)

BAPI RFC Function Modules A Simple ABAP Report MODULE POOL ABAP Naming Standards BDC SAP SCRIPTS BAR
CODE STANDAR REPORTS USER EXITS List of Important Variables ABAP Tricks and Tips Important Transaction Codes
in ABAP Creating Tables in SAP Sales Document Flow SAP SD Related Tables Finding User Exits in SAP Processing
Blocks in ABAP Function Modules Create Text And Save Text OLE Automation OLE For EXCEL Simple ABAP ALV Report
Creating Variants For ABAP Programs SAP ABAP Authorizations Conversion Routines in SAP

Privacy Policy
This site is owned and operated by G Rajesh. All product names are trademarks of their respective companies. This site is in no
way affiliated with SAP AG. Use information on this site at your own risk. The articles are copyrighted to G Rajesh and can
only be reproduced given the author's permission. You can contact me on [email protected]. Your privacy on
the Internet is of the utmost importance to us.We want to make your online experience satisfying and safe. Because we gather
certain types of information about our users, we feel you should fully understand our policy and the terms and conditions
surrounding the capture and use of that information. This privacy statement discloses what information we gather and how we use
it.

Information we gathers through aggregated tracking information derived mainly by tallying page views throughout our sites. This
information allows us to better tailor our content to readers needs and to help our advertisers and sponsors better understand the
demographics of our audience. Under no circumstances we divulge any information about an individual user to a third party.

Cookie Tracking: We may place a text file called a cookie in the browser files of your computer. The cookie itself does not
contain Personal Information although it will enable us to relate your use of this site to information that you have specifically and
knowingly provided. But the only personal information a cookie can contain is information you supply yourself. A cookie cant read
data off your hard disk or read cookie files created by other sites. We may use cookies to track user traffic patterns (as described
above).
We allow third-party advertising companies (like Google Adsense) to serve ads when you visit our Web site. If you would
like more information about this practice and to know your choices about not having this information used by these
companies, Visit This.http://www.google.com/privacy_ads.html

You might also like