on 03-31-2015 8:02 AM
I have a problem using BAPI_ENTRYSHEET_CREATE using a purchase order (outline agreement) items for creating a service entry sheet. I use BAPI_PO_GETDETAIL for copying the PO structures into the BAPI_ENTRYSHEET_CREATE structures but I keep getting the error "SE 214 Error during update".
I tried to create the service entry sheet through tx. ML81N and it works fine. Here's my code:
**************************************************************
DATA: WS_PO TYPE BAPIEKKO-PO_NUMBER.
WS_PO = '4500298742'.
tables:essr.
DATA: BAPI_ESSR LIKE BAPIESSRC OCCURS 1
WITH HEADER LINE.
DATA: BAPI_ESKN LIKE BAPIESKNC OCCURS 1
WITH HEADER LINE.
DATA: BAPI_ESLL LIKE BAPIESLLC OCCURS 1
WITH HEADER LINE.
DATA: BAPI_ESKL LIKE BAPIESKLC OCCURS 1
WITH HEADER LINE.
DATA: BEGIN OF BAPI_RETURN OCCURS 1.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF BAPI_RETURN.
DATA: BEGIN OF wa_po_header OCCURS 1.
INCLUDE STRUCTURE bapiekkol.
DATA: END OF wa_po_header.
data: po_items TYPE bapiekpo OCCURS 0 WITH HEADER LINE,
po_services TYPE bapiesll OCCURS 0 WITH HEADER LINE. "
data: g_entrysheet_no TYPE bapiessr-sheet_no.
DATA: BEGIN OF bapi_return_po OCCURS 1.
INCLUDE STRUCTURE BAPIRET2. "bapireturn.
DATA: END OF bapi_return_po.
DATA: BAPI_SRV_RETURN LIKE BAPIRETURN1 OCCURS 1 WITH HEADER LINE.
DATA: SERIAL_NO LIKE BAPIESKNC-SERIAL_NO,
LINE_NO LIKE BAPIESLLC-LINE_NO.
CONSTANTS: c_x TYPE c VALUE 'X'.
*
START-OF-SELECTION.
CALL FUNCTION 'BAPI_PO_GETDETAIL'
EXPORTING
PURCHASEORDER = WS_PO
ITEMS = 'X'
SERVICES = 'X'
IMPORTING
PO_HEADER = WA_PO_HEADER
TABLES
PO_ITEMS = PO_ITEMS
PO_ITEM_SERVICES = PO_SERVICES
RETURN = BAPI_RETURN_PO.
LOOP AT BAPI_RETURN_PO WHERE TYPE = 'E'.
MESSAGE ID BAPI_RETURN_PO-ID(2)
TYPE BAPI_RETURN_PO-TYPE
NUMBER BAPI_RETURN_PO-NUMBER
WITH BAPI_RETURN_PO-MESSAGE_V1
BAPI_RETURN_PO-MESSAGE_V2
BAPI_RETURN_PO-MESSAGE_V3
BAPI_RETURN_PO-MESSAGE_V4.
LEAVE.
ENDLOOP.
select single * from essr where ebeln = WS_PO.
LOOP AT PO_ITEMS.
BAPI_ESSR-PO_NUMBER = PO_ITEMS-PO_NUMBER.
BAPI_ESSR-PO_ITEM = PO_ITEMS-PO_ITEM.
BAPI_ESSR-SHORT_TEXT = 'Auomatic update'."ESSR-TXZ01.
BAPI_ESSR-ACCEPTANCE = C_X.
BAPI_ESSR-DOC_DATE = sy-datum.
BAPI_ESSR-POST_DATE = sy-datum.
IF PO_ITEMS-ACCTASSCAT = 'U'.
BAPI_ESSR-ACCASSCAT = 'K'.
ELSE.
BAPI_ESSR-ACCASSCAT = PO_ITEMS-ACCTASSCAT.
ENDIF.
BAPI_ESSR-PCKG_NO = PO_ITEMS-PCKG_NO.
APPEND BAPI_ESSR.
ENDLOOP.
LINE_NO = 1.
LOOP AT PO_SERVICES.
CLEAR BAPI_ESLL.
BAPI_ESLL-PCKG_NO = PO_SERVICES-PCKG_NO.
BAPI_ESLL-LINE_NO = LINE_NO.
BAPI_ESLL-EXT_LINE = PO_SERVICES-EXT_LINE.
BAPI_ESLL-OUTL_IND = PO_SERVICES-OUTL_IND.
BAPI_ESLL-SUBPCKG_NO = PO_SERVICES-SUBPCKG_NO.
BAPI_ESLL-SERVICE = PO_SERVICES-SERVICE.
BAPI_ESLL-BASE_UOM = PO_SERVICES-BASE_UOM.
BAPI_ESLL-UOM_ISO = PO_SERVICES-UOM_ISO.
BAPI_ESLL-PRICE_UNIT = PO_SERVICES-PRICE_UNIT.
BAPI_ESLL-FROM_LINE = PO_SERVICES-FROM_LINE.
BAPI_ESLL-TO_LINE = PO_SERVICES-TO_LINE.
BAPI_ESLL-SHORT_TEXT = PO_SERVICES-SHORT_TEXT.
APPEND BAPI_ESLL.
ENDLOOP.
LOOP AT BAPI_ESLL.
IF BAPI_ESLL-LINE_NO = '2'.
BAPI_ESLL-QUANTITY = '12'.
BAPI_ESLL-GR_PRICE = ( 10 * -1 ).
MODIFY BAPI_ESLL INDEX SY-TABIX TRANSPORTING QUANTITY GR_PRICE.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_ENTRYSHEET_CREATE'
EXPORTING
ENTRYSHEETHEADER = BAPI_ESSR
TESTRUN = ' '
IMPORTING
ENTRYSHEET = G_ENTRYSHEET_NO
TABLES
ENTRYSHEETACCOUNTASSIGNMENT = BAPI_ESKN
ENTRYSHEETSERVICES = BAPI_ESLL
ENTRYSHEETSRVACCASSVALUES = BAPI_ESKL
RETURN = BAPI_RETURN.
************************************************************************************
it's a my urgent requirement.
Thanks In Advance.
Regards,
Manohar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manohar,
please set a break-point after fm "MS_SAVE_SERVICE_ENTRY" has been processed and you've got SY-SUBRC 4. At this moment you will get the original error message in the fields sy-msgid, sy-msgno, sy-msgty and sy-msgv1, ... , sy-msgv4. This is a feature of the global exception error_message.
Regards,
Klaus
Hi Manohar,
as you wrote before, SY-SUBRC has the value "4". But then you have to look at the system fields
What's the content of these fields in debugger after processing fm "MS_SAVE_SERVICE_ENTRY"? They will tell us the original error message.
Regards,
Klaus
Hi,
that looks, that something in your BAPI data has a wrong or missing content. please check form ACCEPTANCE in include LMLSRF0W.
There are several places where you can find a PERFORM ERROR.. Please check, of one of the fields may be the reason for your issue. But you can also debug this switching system debugging on.
Regards,
Klaus
Hi,
For me below code works. Please check:
gt_poitem , gt_poservices are from BAPI_PO_GETDETAIL
read table gt_poitem into gw_poitem with key po_item = LV_ebelp.
if sy-subrc eq 0.
read table gt_poservices into gw_poservices with key pckg_no = gw_poitem-pckg_no.
if sy-subrc eq 0.
l_subpckg_no = gw_poservices-subpckg_no.
clear: gw_poservices.
* DELETE gt_poservices WHERE pckg_no NE l_subpckg_no.
loop at gt_poservices into gw_poservices
where pckg_no = l_subpckg_no.
move-corresponding gw_poservices to gw_services.
gw_services-subpckg_no = l_subpckg_no.
gw_services-quantity = LV_-po_quan.
append gw_services to gt_services.
clear: gw_poservices.
endloop.
endif.
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
please post all entries of BAPI return table RETURN (hardcopy in debug mode).
Regards,
Klaus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.