Google Search - Blog...........

ABAP - BAPI_ENTRYSHEET_CREATE With Multi-Accounting.

This is a tutorial for using the BAPI "BAPI_ENTRYSHEET_CREATE"
Functionalilty
This BAPI creates an Entry Sheet (Transaction ML81N). You have to fill four important Import Parameters:
• ENTRYSHEETHEADER
• ENTRYSHEETSERVICES
• ENTRYSHEETACCOUNTASSIGNMENT
• ENTRYSHEETSRVACCASSVALUES
The account assignments are passed on in the table
'EntrySheetAccountAssignment'.

Messages are returned in the table 'Return'.
All value and price fields are to be passed on in the currency of
the purchase order.
Details of Import Parameter
ENTRYSHEETHEADER
thats the entry sheet header. you have to fill following fields
FIELDNAME MEANING

PO_ITEM
number of an position of the purchase order
PERSON_INT
username for exampe: sy-uname

BEGDATE
date of entry sheet creation

ENDDATE
enddate of data collection

PCKG_NO
number of first position

SHORT_TEXT
short text of entry sheet

PO_NUMBER
number of purchase order

DOC_DATE
date of document creation

POST_DATE
date of document booking

ACCASSCAT type of accounting
F for orders


ENTRYSHEETSERVICES
This table contains the services and service specification outlines of
the entry sheet.
A line is flagged as an outline level with the field OUTL_IND.
Service lines are assigned to the outline levels via the fields PCKG_NO
(of the service line) and SUBPCKG_NO (of the outline level).
ATTENTION! the first line must be group / outline position !
Group / Outline position
FIELDNAME MEANING

PCKG_NO consecutive number for grouping service positions
you have to set this field to value 1 for the first row

LINE_NO number of service position. the dummy row has the same line number as you first service position

OUTL_IND mark this for the first dummy line.

SUBPCKG_NO
thats group number for the service positions

SHORT_TEXT enter short description

Here's an example for the first dummy row:
DATA: ls_es_services TYPE bapiesllc.
*..prepare entrysheetservices
*...insert virtual outline row
ls_es_services-pckg_no = '1'.
ls_es_services-line_no = '1'.
*...mark this as outline
ls_es_services-outl_ind = 'X'.
ls_es_services-subpckg_no = '2'.
ls_es_services-short_text = gl_short_text.
APPEND ls_es_services TO lt_es_services.
service positions

FIELDNAME MEANING

PCKG_NO
number of the subpckg_no of service line

LINE_NO consecutive postion number beginning at number 1

SERVICE_NO
number of service

QUANTITY
quantity of service

PRICE_UNIT price unit for example 1

DISTRIB set to 1 if you want to use muti accounting feature

ENTRYSHEETACCOUNTASSIGNMENT
This table contains the account assignments of the entry sheet.
FIELDNAME MEANING

PCKG_NO
number of the subpckg_no of a group position

SERIAL_NO consecutive number of account

GL_ACCOUNT
G/L account number

ORDER
order number

DATA: lt_es_account TYPE STANDARD TABLE OF bapiesknc.
DATA: ls_es_account TYPE bapiesknc.
*...set account number
ls_es_account-gl_account = .
*...set order number
ls_es_account-order = .
*...set package number of service position
ls_es_account-pckg_no = '2'.
*...set consecutive number
ls_es_account-serial_no = l_counter.
APPEND ls_es_account TO lt_es_account.
ENTRYSHEETSRVACCASSVALUES
This table contains the values of the account assignments at service
level and a reference to the overall account assignment of the entry
sheet (table 'EntrySheetAccountAssignment', field 'SERIAL_NO').
FIELDNAME MEANING

PCKG_NO
number of the subpckg_no of a group position

LINE_NO line number of service postion (refers to ENTRYSHEETSERVICES-LINE_NO)

SERNO_LINE
consecutive number

PERCENTAGE
value in percent

SERIAL_NO
This number refers to account assignment (ENTRYSHEETACCOUNTASSIGNMENT-SERIAL_NO)

QUANTITY
value in quantity

DATA: ls_es_account_values TYPE bapiesklc.
ls_es_account_values-line_no = ls_es_services-line_no.
ls_es_account_values-serial_no = ls_es_account-serial_no.
Please use the Field PERCENTAGE or QUANTITY. Not both fields at the same service line (LINE_NO)
Finaly - the bapi call
CALL FUNCTION 'BAPI_ENTRYSHEET_CREATE'
EXPORTING
entrysheetheader = ls_es_header
testrun = ' '
IMPORTING
entrysheet = l_sheet_number
TABLES
entrysheetaccountassignment = lt_es_account
entrysheetservices = lt_es_services
entrysheetsrvaccassvalues = lt_es_account_values
return = lt_bapi_return
* ENTRYSHEETSERVICESTEXTS =
* ENTRYSHEETHEADERTEXT =

1 comment: