Thursday, May 29, 2008

SAP EDI OutBound Process

SAP EDI OutBound Process

The EDI Out Bound Process comprises of the following.

  • Selection Program
  • Message Control
  • The Port Definition
  • The RFC Destination
  • The Partner Profile
The important SAP IDOC (EDI) Transactions are as follows.

WEDI is the main transaction for IDOCs. This has a sub-menu that lists all other transactions.

I will list the transactions related to the above mentioned topics.

1) Message Control:

The transaction NACE will list all the applications that use Message Control. For example

V1 Sales
V2 Shipping

from the NACE transaction you can view the following for the various applications

Condition Records
Procedures
OutPut Types
Access Sequence

Message control is responsible to process various outputs fro example EDI, FAX, Printing and Mail.

2) Port Definition:

Transaction WE21

Port definition is used to determine the following

  • Path and name of the IDOC file at the operating system level
  • EDI subsystem subprogram
  • RFC Destination
3) RFC Destination:

Transaction SM59

RFC destination is basically the Remote Function Call Destination. RFC destination is used to define access to the EDI subsystem.

Basically it is used to define the following types of connections
                                    
  • R/2 connections                     
  • R/3 connections                     
  • Internal connections                
  • Logical destinations                
  • TCP/IP connections                  
  • Connections via ABAP/4 driver    

4) Partner Profile 

Transaction WE20

Basically partner profiles are used to define the following


  • IDOC Type
  • Partner Number
  • Port
  • Message Type
  • Process Code
  • Mode of communication with Sub-System
  • Person to be notified

For establishing EDI process with the business Partners (ex Vendors, Customers) A partner Profile is created for each partner.

                                    
                                    

SAP BAPI To Get Customer Bank Details

SAP BAPI To Get Customer Bank Details

In case you wish to extract the Bank Data for a particular customer, you can use the following BAPI. This BAPI extracts the Customer's Address, General Data, Company Code Data and the Bank Details.

SAP ABAP to get customer Bank Details   
BAPI_CUSTOMER_GETDETAIL2

For reference please find below the transaction codes to Create/Change/Display a customer

XD01 Create Customer Complete
XD02 Change Customer Complete
XD03 Display Customer Complete

VD01 Create Customer Sales and Distribution
VD02 Change Customer Sales and Distribution
VD03 Display Customer Sales and Distribution


Also Find below the tables related to the BAPI BAPI_CUSTOMER_GETDETAIL2

KNBK-Customer Master (Bank Details)
ADRC- Addresses (central address admin.)
KNA1-General Data in Customer Master
KNB1-Customer Master (Company Code)

The following code extracts the above mentioned details from the SAP R/3 System

REPORT ZEX_CUSTOMERBANK .


Parameters: p_kunnr like BAPICUSTOMER_ID-CUSTOMER,
            p_bukrs like BAPICUSTOMER_ID-COMP_CODE.

Data: ty_knbk type knbk,
      ty_custadd type BAPICUSTOMER_04,
      ty_custgendet type BAPICUSTOMER_KNA1,
      ty_custcompdet type BAPICUSTOMER_05,
      d_ret         like BAPIRET1.

Data: wa_custadd like ty_custadd,
      wa_custgendet like ty_custgendet,
      wa_custcompdet like ty_custcompdet.


Data: int_knbk like ty_knbk occurs 0.


CALL FUNCTION 'BAPI_CUSTOMER_GETDETAIL2'
  EXPORTING
    CUSTOMERNO                  = p_kunnr
   COMPANYCODE                  = p_bukrs
 IMPORTING
   CUSTOMERADDRESS              = wa_custadd
   CUSTOMERGENERALDETAIL        = wa_custgendet
   CUSTOMERCOMPANYDETAIL        = wa_custcompdet
   RETURN                       = d_ret
 TABLES
   CUSTOMERBANKDETAIL           = int_knbk      .


   if sy-subrc = 0.

   Endif.

SAP ABAP BAPI to Read Customer Data

SAP ABAP BAPI to Read Customer Data

In case you wish to read the customer data you can use the following BAPI, it retrieves the Customer Master (Company Code) Data and the General Data in Customer Master.

SAP ABAP BAPI to Read Customer Master Data
CUSTOMER_READ

You need to pass the Customer Number and the Company Code. See the example given below.


REPORT ZEX_CUSTOMERREAD .

Parameters: p_bukrs like KNB1-BUKRS,
            p_kunnr like KNA1-KUNNR.


Data: ty_kna1 type kna1,
      ty_knb1 type knb1.

Data: int_kna1 like ty_kna1,
      int_knb1 like ty_knb1.

CALL FUNCTION 'CUSTOMER_READ'
  EXPORTING
    I_BUKRS         = p_bukrs
    I_KUNNR         = p_kunnr
 IMPORTING
   E_KNA1          = int_Kna1
   E_KNB1          = int_knb1
 EXCEPTIONS
   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.