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. It’s a good practice to take a dump of the code on your local drive.
Ole Automation Part1 Ole Automation Part 2 Processing Blocks in ABAP Simple ABAP Report ALV Grid - Changing Colors ALV Report Example Creating Variants For ABAP Reports Recording BDC using Transaction Sales Document Flow in ABAP User Exits in SAP SD SAP ABAP Naming Standards SAP SD Tables SAP ABAP Data Dictionary Tables MM Important Transaction Codes in SAP Passing g Data From One ABAP Program to Another ABAP Compute Add Collect and Append SAP ABAP Determining 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
Sap Scripts and SmartForms Bar Codes Standard Reports and Sap Scripts Important Standard Reports in SAP Abap Tricks and Tips Bapi Sales Order BAPI Purchase Order Creating Function Modules in SAP Creating Tables in SAP Finding User Exits in SAP Function Module Create Text and Read Text Important Transaction Codes in SAP ABAP Function Module for Submitting a Program ABAP Game Tic Tac Toe ABAP Internal Table To Excel Sheet ABAP Function Module to create Directory Different Types of Menus in SAP Function Modules in SAP to check Loged in Users ABAP Function Module for Adding Days to Dates Call a Transaction From a Remote System SAP MM simple Procurement Cycle BAPI Material EDIT Finding Decimal Places in Currency Getting negative sign before a number in ABAP Program Editor Lock Unlock Restricting Select Options List of BAPIs in the system SAP Function Module
ABAP Debugger Break Points ABAP Debugger WatchPoints Drill Down Reports Concept Creating a HOT SPOT Interactive Programs and Hide Technique String Concatenate Get Week of the Year SAP ABAP to Add Days to a Date Add Months to a Date Get Month in the Year Display Clock ABAP Code For Progress BAR ABAP Function Module For Caluclator ABAP Function Module For Calender Displaying Messages in ABAP Function Module Pop Up To Confirm Conversion Routines in SAP SAP ABAP Authorization SAP ABAP Module Pool 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
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
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)
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
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
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 User−and Authorization System−Related 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) ► 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)
o
o
► 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)
o
o
► Feb 02 (3) ► January (6) ► Jan 31 (1) ► Jan 24 (1) ► Jan 23 (1) ► Jan 22 (1) ► Jan 12 (1) ► Jan 05 (1)
o
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 can’t 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 from the current program 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 SE80 SHDB
ABAP Editor Object Navigator 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' 'Düsseldorf'. 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 XVBEPAUFNR. 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 * 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. It’s a good practice to take a dump of the code on your local drive.
Ole Automation Part1 Ole Automation Part 2 Processing Blocks in ABAP Simple ABAP Report ALV Grid - Changing Colors ALV Report Example Creating Variants For ABAP Reports Recording BDC using Transaction Sales Document Flow in ABAP User Exits in SAP SD SAP ABAP Naming Standards SAP SD Tables SAP ABAP Data Dictionary Tables MM Important Transaction Codes in SAP Passing g Data From One ABAP Program to Another ABAP Compute Add Collect and Append SAP ABAP Determining
Sap Scripts and SmartForms Bar Codes Standard Reports and Sap Scripts Important Standard Reports in SAP Abap Tricks and Tips Bapi Sales Order BAPI Purchase Order Creating Function Modules in SAP Creating Tables in SAP Finding User Exits in SAP Function Module Create Text and Read Text Important Transaction Codes in SAP ABAP Function Module for Submitting a Program ABAP Game Tic Tac Toe ABAP Internal Table To Excel Sheet ABAP Function Module to create Directory Different Types of Menus in SAP
ABAP Debugger Break Points ABAP Debugger WatchPoints Drill Down Reports Concept Creating a HOT SPOT Interactive Programs and Hide Technique String Concatenate Get Week of the Year SAP ABAP to Add Days to a Date Add Months to a Date Get Month in the Year Display Clock ABAP Code For Progress BAR ABAP Function Module For Caluclator ABAP Function Module For Calender Displaying Messages in ABAP Function Module Pop Up To Confirm Conversion Routines in SAP SAP ABAP Authorization SAP ABAP Module Pool
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
Function Modules in SAP to check Loged in Users ABAP Function Module for Adding Days to Dates Call a Transaction From a Remote System SAP MM simple Procurement Cycle BAPI Material EDIT Finding Decimal Places in Currency Getting negative sign before a number in ABAP Program Editor Lock Unlock Restricting Select Options List of BAPIs in the system SAP Function Module Scramble a String LSMW POP up table contents on the screen SAP R3 Bookmarking Websites Stock Requirements List Function Module Retail Transaction Codes
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
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
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 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
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 User−and Authorization System−Related Tables ► Jul 07 (1) SAP Industry Specific Solutions SAP Business Solut... ► Jul 02 (1) SAP Stock Per Bin
o
► 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
o
► 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)
o
o
► 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)
o
o
► 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)
o
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 can’t 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