Archive

Archive for the ‘API’ Category

SAP FI – Deductible and Non-deductible Tax

February 6th, 2012 No comments

Non-deductible taxes are taxes that are not allowable when calculating a taxable income. They are taxes that have been paid in the process of generating income or purchasing items, but they are not subtracted from the final taxable income. For example,

VAT 14% non-deductible 50%

100 EUR invoice (account 5080) 
7 EUR VAT goes to the VAT account 
7 EUR VAT goes back to the Expense account (5080)
Total invoice 107.00
Total VAT 7.00

How to configuration this scenario in SAP?

In Tax code A2, Enter 7% in condition type MWAS and 7% in condition type MWVZ.

Read more…

SAP BAPI – BAPI_MATERIAL_SAVEDATA

November 21st, 2011 No comments

SAP BAPI – BAPI_MATERIAL_SAVEDATA is the standard API to create/update the material master data. When creating material master data, you must transfer the material number, the material type, and the industry sector to the method. You must also enter a material description and its language. When changing material master data, you need enter only the material number. For detailed information on how to use this API, please refer to the function module documentation.

SAP BAPI – BAPI_SALESORDER_CREATEFROMDAT2

August 4th, 2011 No comments

BAPI – BAPI_SALESORDER_CREATEFROMDAT2 is designed to create sales order from external system. It belongs to object type BUS2032.

Note

If you fill the target_qty field in the item table but the sales order created with the quantity ‘0’. – You need to fill the schedule line table and maintain the req_quantity field as well. Below code snip can be used to create sales order.

Read more…

ABAP – Upload File To FTP Server

May 25th, 2011 No comments

Sometimes,we need to use SAP Client as a FTP client to upload files to ftp server. SAP ECC has providen funtions for ftp communication. Funtion Group SFTP contains a lot of function module can help us to implement this.

You can get a lot of tools from function group SFTP.

Below is the basic function module necessary when uploading file to FTP server. Connect to FTP Server.

CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = 'username'
password = pwd
host = '192.168.2.245'
rfc_destination = 'SAPFTPA' ";SM59
IMPORTING
handle = hdl.


Transfer file from r3 to ftp server bindata contains the data,blob_length is the length of the file.

CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle= hdl
fname= v_fname
blob_length = blob_length
TABLES
blob = bindata."; CHARACTER_MODE = 'X'

Read more…

How to find document for BAPI or Function Modules

February 28th, 2011 No comments

One of my blog reader asked me to send him some documentations on BAPI and function modules. No central API documentation repository seems the pain for all the Abapers. Below is my personal understanding on this question. If you have any other viewpoints, please kindly share them with everyone.

Read more…

BAPI in SAP Project System

December 28th, 2010 No comments

There are several SAP business objects related to Project System module. These business object provides the standard API to create, change, delete the Project Definition, WBS element, Network.

Business Object Description
ProjectDefinition The business object Project definition is the framework laid down for all objects created within a project.
ProjectDefinitionPI Extended Project Definition in Plug-In
WBSPI Extended WBS in Plug-In
Network The business object Network is an instruction on how to carry out activities in a specific way, in a specific order and in a specific time period.
NetworkPI Extended Network in Plug-In

For example, BAPI BAPI_BUS2054_CREATE_MULTI can be used to create a WBS element. Below is the explanation of this function module.

Read more…

ALSM_EXCEL_TO_INTERNAL_TABLE

April 29th, 2010 1 comment

Many customers need a function that allows them to transfer values from an Excel table to the SAP system. Up to now there has been no formally released interface for this.

For the Asset Accounting legacy data transfer, a module was written to transfer the Excel data using the clipboard of the Windows system by OLE (Object Linking and Embedding. This module is called ALSM_EXCEL_TO_INTERNAL_TABLE. The module was only designed for the requirements of the Asset Accounting legacy data transfer. This leads to some restrictions, including the following:

Read more…

BAPI_GOODSMVT_CREATE for goods movements

April 17th, 2010 2 comments

SAP Note 520813 – FAQ: BAPIs for goods movements contains frequently asked questions/answers regarding ‘BAPIs for goods movements’. I just picked out some questions for your reference. For detail information, please visit SAP service marketplace.

Question:
Which function modules must be called after the BAPI is called to complete the posting once the material document has been created successfully? What should I do if there is an error?

Answer:
The BAPI returns a return table for the error handling, that is, if the posting is incorrect, this table contains an entry describing the cause of the error. The ‘caller’ is responsible for evaluating this table and for triggering the update that is dependent on this.

If the posting is correct (return table is initial), a ‘Commit Work’ must be carried out in order to complete the posting. To do this, call BAPI_TRANSACTION_COMMIT.

The Commit or rollback always applies to the current LUW (Logical Unit of Work). Therefore, you must make sure that it is carried out at the correct point in the source code. More information about this is available in the documentation for BAPI_TRANSACTION_COMMIT or …_ROLLBACK.

A detailed description is available in Note 457499.

Read more…

CS_BOM_EXPL_MAT_V2

April 10th, 2010 No comments

Application Area – ERP-PP

Description

Function module CS_BOM_EXPL_MAT_V2 is used for BOM explosion for a given material. It belongs to function group CSS4 – BOM explosions. This function module can explose multi-level BOM with a given validation date.

You need to specify necessary input parameters to call this function module, such as CAPID – App ID, DATUV – Validation date, MEHRS – Multi-level, MTNRV – Material number, STLAL – alternate, STLAN – BOM usage.

Some useful tables are also listed here.

TABLES: MARA,                               "Master Data
        MAKT,                               "Matl Desc.
        MARC,                               "Plant Data for Matl.
        MAST,                               "Bom to material link
        STKO,                               "Bom Header
        STPO.                               "Bom Item

Read more…

CRM_ORDER_MAINTAIN

April 9th, 2010 No comments

Application Area – CRM,Solution Manager

Description

Function module CRM_ORDER_MAINTAIN is one of the most important function modules in SAP CRM and SAP Solution Manager business transactions processing. Other useful function modules are CRM_ORDER_READ and CRM_ORDER_SAVE.

The function module will call some underlying function modules to save the changes to database. The most important task of calling this function module is to maintain the input fields internal table. You can maintain every information belongs to the business transaction.

The input field structure contains several components. Field ref_guid represents the GUID of the changed structure. Ref_kind has several possible values. A for Administration Header, B for Administration Item, C for Header Extension, D for Item Extension. You also need to populate FIELD_NAMES internal tables to decide which fields in the destination structure needs to be changed.

Read more…