Step by Step Tutorials in Bapi-SAP ABAP
Step by Step Tutorials in Bapi-SAP ABAP
Search
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
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
0 comments:
Post a Comment
ABAP TIPS
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
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 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
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
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:
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.
BAPI_SALESORDER_SIMULATE
This is very useful in case you want to check the Availability and
Pricing. The parameters obtained are given below.
*-------------------------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
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
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.
In case the called program has a selection screen then the SUBMIT
statement can be used with the various options as shown below.
* 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-------------------------------------------------------
REPORT ZEXERCISE_SUBMIT .
Data: d_value1(10).
d_value1 = 'Test1'.
write: d_value1.
EXERCISE
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.
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.
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.
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
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.
Note: You can use the following BAPIs and Function modules to
create a Sales Order in SAP.
In this case you need to use the transaction VA01 to do the recording.
Order Type
Sold-to Party
Ship-to Party
Purch Ord No
Material
Quantity
Note: you need to do the BDC recording for all the mandatory fields
for creating a Sales Order.
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.
*include bdcrecx.
start-of-selection.
WRITE: / 'CALL_TRANSACTION',
TCODE,
'returncode:'(I05),
L_SUBRC,
'RECORD:',
SY-INDEX.
LOOP AT MESSTAB.
ENDLOOP.
endform.
*----------------------------------------------------------------------
*----------------------------------------------------------------------
*----------------------------------------------------------------------
* Insert field
*----------------------------------------------------------------------
*******************************************************************************
***************************************************
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.
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.
IMPORTANT: Note that the Pass Value filed has been selected.
This filed has to be selected for all RFCs.
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! *
*****************************************************************
INCLUDE LZSALESU01.
***INCLUDE ZSALESCREATEI .
WRITE: / 'CALL_TRANSACTION',
TCODE,
'returncode:'(I05),
L_SUBRC,
'RECORD:',
SY-INDEX.
endform.
*----------------------------------------------------------------------
*----------------------------------------------------------------------
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
*----------------------------------------------------------------------
* Insert field
*----------------------------------------------------------------------
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
*"----------------------------------------------------------------------
Please add the following line once the Call Transaction is completed.
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.
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
* INCLUDE ZSALESORDERO01 . *
* INCLUDE ZSALESORDERI01 . *
* INCLUDE ZSALESORDERF01 . *
*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'ZSALES'.
SET TITLEBAR 'ZSL'.
CASE OK_CODE.
When 'BACK'.
leave to screen 0.
When 'ORDE'.
Perform Create_Salesord.
leave to screen 0.
endcase.
*&---------------------------------------------------------------------*
*& 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.
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
Create MODULE STATUS_9000 by double clicking on it. The following code will be
automatically created.
* INCLUDE ZSALESORDERO01 . *
* INCLUDE ZSALESORDERI01 . *
* INCLUDE ZSALESORDERF01 . *
*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
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.
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
You will be prompted to enter the Function Text and Info Text for the button Enter.
Please enter the following values.
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.
Program ZSALESORDSCREEN
Screen 9000
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.
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
Important
Property Box for Command Button in this case the Function Code is important
Create Order
Name cmdord
Text Create Order
Fct Code ORDE
BAPI_SALESORDER_CREATEFROMDAT1
The following fields will be updated.
Order Type OR
Sales Org 1000
Dsitribution Channel 10
Division 00
Say yes.
Create a program with TOPINCLUDE, give an appropriate name to
the TOPINCLUDE and save the program.
REPORT ZEX_POPUPTOCONFIRM .
*-------------------------Data Declaration-----------------------------*
EXPORTING
TEXT_BUTTON_1 = 'YES'(001)
TEXT_BUTTON_2 = 'NO'(002)
* DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
* 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.
ENDIF.
DownLoad PDF
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'.
Type a message that you would like to display. Please note the
number associated with the message. In this case the message is
'000'.
1. MESSAGE xnnn.
2. MESSAGE ID id TYPE mtype NUMBER n.
3. MESSAGE xnnn(mid).
E (Error)
Error
I (Info)
Information
S (Status)
Status message
W (Warning)
Warning
X (Exit)
Termination with short dump
ID
message class in our case ZEXERCISE1 or ZEXERCISE2
TYPE
message type (A,E,I,S,W,X)
NUMBER
message number
Example
SP--------AG
SH--------RG
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
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.
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.
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.
We now need to search for Sales. Click on the search tool as shown
below.
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.
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
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
Click on Display.
Enter the desired data. In this case the sales order number.
The data is displayed as shown below.
ABAP TIPS
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
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 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
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