Escolar Documentos
Profissional Documentos
Cultura Documentos
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 =
.
0 comments:
Post a Comment
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
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
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.
Pop Up a Calender
Module to Read a File
Module to Reverse A String
Run an Executable Program
with Parameters
Program for POP up Screen
Printing Selection
Parameters for a Report
Uploading and DownLoading
a Report
SAP ABAP Version
Management
SAP ABAP Short Cuts
List of Important System
Variables
ABAP MACROS
ABAP Calling a File Selector
Some Important Function
Modules
ABAP String Operations
ABAP Function Module to
Check Validity of Date
Transfer Internal Table
Contents to a File
SAP ABAP Program Types
BAPI to Read Customer Data
Checking Validity of Date
Download to Application
Server
ABAP Debugger Breakpoint
and Watchpoint
BAPI to get Company Code
Details
Creating Material Using BAPI
part 2
Generating a Valid Password
Logical Databases Structure
Making Fields OBligatory in
Selection Screen
ABAP Views
Getting a Company Code for
a Plant
Importing contents of
Select Options
BAPI for availability check
String to Numerical
SAP Goods Movement
Process
Getting a List of Plants for a
Material
SAP R3 Clients Concept
ABAP Adobe Forms
Authorization Object Tables
SAP Industry Specific
Solutions
Scramble a String
LSMW
POP up table contents on the
screen
SAP R3 Bookmarking
Websites
Stock Requirements List
Function Module
Retail Transaction Codes
Delivered by FeedBurner
Blog Archive
2008 (205)
o August (2)
Aug 14 (1)
Clipboard in SAP
Getting a Plant for a Material
Plant Material and Storage
Location
SAP Production Planning
Standard Reports
NetWeaver Components
Supported Databases and
Operating Systems
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...
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)
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)
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)
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)
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)
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 abap.sap.friend@gmail.com. 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
BD22
WVN0
WVN1
Release Worklist
MEI4
VA01
WVA3
WKK1
WMB1
VKP5
WPMA
WVA7
WEV3
MEKE
Conditions By Vendor
V-64
VK13
V/LD
See Also:
SAP Industry Specific Solutions SAP Business Solutions By Industry
SAP IS-Retail Transaction Codes Merchandise
Important Transaction Codes for ABAP
____________________________________________________________________
____
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
'0000007777' to ta_BAPIPARTNR-PARTN_NUMB.
* Append the internal tables-------------------------------------------*
append ta_BAPIPARTNR.
clear ta_BAPIPARTNR.
* Call BAPI to SIMULATE the Order
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
IF SY-SUBRC = 0.
ENDIF.
[VIA SELECTION-SCREEN]
[USING SELECTION-SET var]
EXERCISE
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)
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
Function Builder
SE38
SE80
SHDB
ABAP Editor
Object Navigator
BDC Recorder
Sold-to Party
Ship-to Party
Purch Ord No
Material
Quantity
*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.
*---------------------------------------------------------------------*
Insert field
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.
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 '/'.
*----------------------------------------------------------------------
Insert field
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
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
*&---------------------------------------------------------------------*
*& 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
=
.
" 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
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.
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
Application toolbar
Function keys
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
PREVP NEXT LAST
CANCEL
FIND
FINDNEXT FIRSTPAGE
'ZSALESORD'
'Create Sales Order'
ZSALESORDSCREEN
9000
Label Name
lblordtyp
lblsalesorg
lbldistchnl
lbldiv
lblsoldto
lblshipto
lblpurchord
lblmat
lblqty
TextBox Name
txtordtyp
txtsalesorg
txtdistchnl
txtdiv
txtsoldto
txtshipto
txtpurchord
txtmat
txtqty
Def Length
2
4
2
2
10
10
10
18
13
Name
lblcreateord
We will now look at the property box which is displayed after double clicking on each screen
element.
lblordtyp
Order_Type
txtordtyp
2
cmdord
Create Order
ORDE
OR
1000
10
00
7777
7777
15493
y-351
10
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.
Type a message that you would like to display. Please note the
number associated with the message. In this case the message is
'000'.
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'.
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
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.
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
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.
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
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.
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.
Select Sales Header. From the figure we can see the object as
VBBK. Then click on Text IDs.
Enter the above mention data. Please note that this data will vary
from system to system.
Run the function module. As shown below the table has one record.
Click on that entry.
The test data that has been entered can be saved and by clicking on
Similarly text can be read or written in the Item text. The above
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.
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
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... ->
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.
Pop Up a Calender
Module to Read a File
Module to Reverse A String
Run an Executable Program
with Parameters
Program for POP up Screen
Printing Selection
Parameters for a Report
Uploading and DownLoading
a Report
SAP ABAP Version
Management
SAP ABAP Short Cuts
List of Important System
Variables
ABAP MACROS
ABAP Calling a File Selector
Some Important Function
Modules
ABAP String Operations
ABAP Function Module to
Check Validity of Date
Transfer Internal Table
Contents to a File
SAP ABAP Program Types
BAPI to Read Customer Data
Attributes of Data
SAP ABAP Editor Icons
BAPI for Displaying Material
Data
BAPI to get customer bank
details
EDI Outbound Process
SAP EDI Process Overview
Function Module for Vendor
Bank details
SAP IDOC
Creating a Valid Password in
SAP
SAP BADIs Introduction
SAP ABAP MACROS
POP UP function Module to
Confirm and Save Data
Select Options
BAPI for availability check
String to Numerical
SAP Goods Movement
Process
Getting a List of Plants for a
Material
SAP R3 Clients Concept
ABAP Adobe Forms
Authorization Object Tables
SAP Industry Specific
Solutions
Tutorial
SAP ABAP RFC
Finding Path to SAP
Transaction in Menu
SAP Purchasing Documents
SAP and ABAP Shortcuts
Logical Databases
Advantages of Logical
Databases
Copy to Clipboard
BAPI Create Material
Finding and Running
Programs in ABAP
Program Syntax Check and
Extended Syntax Check
Select Options upper lower
case
BAPI Sales Order Simulate
Get PLANT and Description
for a Material
MRP List Function Module
Production Planning and
Controlling
Applications in SAP R3
Tool Based Reports
Important Transaction Codes
in SAP
SAP Stock per Bin
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...
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...
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)
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)
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)
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)
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)
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 abap.sap.friend@gmail.com. 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