Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error while creating service entry sheet

Former Member
0 Likes
4,030

Hi Experts,

I am trying to create service entry sheets using bapi 'BAPI_ENTRYSHEET_CREATE' for a purchase order with multiple line items. The bapi creates SES for the first line item but gives error 'User xxxxxx already processing purchase order nnnnnnnnnn' for the rest of all. Tried using 'COMMIT AND WAIT' after bapi call but it's not working.

Kindly help me out with the solution.

Regards,

B.Siddhesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,350

Hi,

Try using BAPI_TRANSACTION_COMMIT inplace od commit and wait.

Regards,

Vishal

11 REPLIES 11
Read only

Former Member
0 Likes
2,351

Hi,

Try using BAPI_TRANSACTION_COMMIT inplace od commit and wait.

Regards,

Vishal

Read only

0 Likes
2,350

Hi Friends,

The issue is resolved.

I'm using 'WAIT UP TO n SEC' statement after BAPI_TRANSACTION_COMMIT and it is now creating all the SES properly.

Regards,

B.Siddhesh

Read only

0 Likes
2,350

Hi Siddhesh,

I am glad that your problem has been solved but could you please try this thing also ?

FM 'BAPI_TRANSACTION_COMMIT' also have parameter WAIT.

Could you please check and let all of us know if this also solves your problem ?

Then you dont have to use 'WAIT UP TO n SEC' which causes delay if value of n is high.

Regards,

Vishal

Read only

0 Likes
2,350

Hi Siddhesh,

No need to check it.

I just saw above code by Sabyasachi, 'BAPI_TRANSACTION_COMMIT' with WAIT parameter

does work and solves the problem for multiple BAPI calls in a loop.

Just wanted to clear one thing, passing numeric value to WAIT parameter as shown in above code does not have any impact as function expects SPACE or 'X'.

Default value is SPACE then it use Asynchronous Transaction and if it is not SPACE then Synchronous Transaction is used.

Regards,

Vishal

Read only

0 Likes
2,350

Hi Siddesh,

I also got the same type of requirement. But i am getting the error as "Error during Update". Can you send me your code if u wish ?

Read only

0 Likes
2,350

Hi Siddhesh

I am trying the same BAPI and getting the "Error during update" message, despite using the Wait option of the BAPI_TRANSACTION_COMMIT FM. Could you please write the source of your ABAP SE38 code? This would be of great help.

Thanks in advance.

Read only

Former Member
0 Likes
2,350

hi,

use the bapi_commit function module to commit the work.

byee.

Read only

Former Member
0 Likes
2,350

REPORT test_program.

DATA: wa_header TYPE bapiessrc,

i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,

ws_entrysheet_no TYPE bapiessr-sheet_no,

i_service TYPE bapiesllc OCCURS 0 WITH HEADER LINE,

i_service_acc TYPE bapiesklc OCCURS 0 WITH HEADER LINE,

i_service_text TYPE bapieslltx OCCURS 0 WITH HEADER LINE,

i_account TYPE bapiesknc OCCURS 0 WITH HEADER LINE,

ws_pack_no TYPE packno.

DATA: ws_po TYPE bapiekko-po_number,

po_items TYPE bapiekpo OCCURS 0 WITH HEADER LINE,

po_services TYPE bapiesll OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF wa_po_header OCCURS 1.

INCLUDE STRUCTURE bapiekkol.

DATA: END OF wa_po_header.

DATA: BEGIN OF bapi_return_po OCCURS 1.

INCLUDE STRUCTURE bapireturn.

DATA: END OF bapi_return_po.

DATA: serial_no LIKE bapiesknc-serial_no,

line_no LIKE bapiesllc-line_no.

DATA: bapi_esll LIKE bapiesllc OCCURS 1 WITH HEADER LINE.

ws_po = '4300000051'.

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.

wa_header-po_number = po_items-po_number.

wa_header-po_item = po_items-po_item.

wa_header-short_text = 'Sample'.

wa_header-pckg_no = 1.

serial_no = 0.

line_no = 1.

bapi_esll-pckg_no = 1.

bapi_esll-line_no = line_no.

bapi_esll-outl_level = '0'.

bapi_esll-outl_ind = 'X'.

bapi_esll-subpckg_no = 2.

APPEND bapi_esll.

LOOP AT po_services WHERE NOT short_text IS INITIAL.

line_no = line_no + 1.

CLEAR bapi_esll.

  • MOVE-CORRESPONDING po_services TO bapi_esll.

  • bapi_esll-gr_price = '456'.

bapi_esll-pckg_no = 2.

bapi_esll-line_no = line_no.

bapi_esll-service = po_services-service.

bapi_esll-quantity = po_services-quantity.

bapi_esll-gr_price = po_services-gr_price.

bapi_esll-price_unit = po_services-price_unit.

APPEND bapi_esll.

ENDLOOP.

CALL FUNCTION 'BAPI_ENTRYSHEET_CREATE'

EXPORTING

entrysheetheader = wa_header

  • testrun = 'X'

IMPORTING

entrysheet = ws_entrysheet_no

TABLES

  • ENTRYSHEETACCOUNTASSIGNMENT =

entrysheetservices = bapi_esll

  • entrysheetsrvaccassvalues = i_service_acc

return = i_return

  • entrysheetservicestexts = i_service_text

  • ENTRYSHEETHEADERTEXT =

.

break gbpra8.

LOOP AT i_return.

ENDLOOP.

DATA: ws_wait TYPE bapita-wait.

ws_wait = '3'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = ws_wait.

Read only

0 Likes
2,350

Hello everybody;

when testing the code done by sabyasachi kar i have the following message: "no service items selected"

the entrysheetservices is filled with my item before applying BAPI_ENTRYSHEET_CREATE.

have you an idea how to fix it.

Reagrds.

Read only

Former Member
0 Likes
2,350

Hi Friends,

Thanks for your prompt response.

Tried using FM 'BAPI_TRANSACTION_COMMIT' but still getting same error.

Regards,

Siddhesh

Read only

Former Member
0 Likes
2,350

Hi Siddhesh,

Please use below code before calling the 'BAPI_ENTRYSHEET_CREATE' to unlock the PO.

Hope this is helpful.


**Delete the Lock objects EKKO Header PO.

     CALL FUNCTION 'ENQUEUE_READ'

       EXPORTING

         GNAME  = 'EKKO'

         GARG   = ''

         GUNAME = SY-UNAME

       TABLES

         ENQ    = ENQ

       EXCEPTIONS

         OTHERS = 0.

     IF NOT ENQ IS INITIAL.

       DESCRIBE TABLE ENQ LINES SY-TFILL.

       CHECK SY-TFILL > 0.

       CALL FUNCTION 'ENQUE_DELETE'

         EXPORTING

           SUPPRESS_SYSLOG_ENTRY = 'X'

         IMPORTING

           SUBRC                 = RC

         TABLES

           ENQ                   = ENQ.

     ENDIF.

**Delete the Lock objects EKPO Header PO.

     CALL FUNCTION 'ENQUEUE_READ'

       EXPORTING

         GNAME  = 'EKPO'

         GARG   = ''

         GUNAME = SY-UNAME

       TABLES

         ENQ    = ENQ

       EXCEPTIONS

         OTHERS = 0.

     IF NOT ENQ IS INITIAL.

       DESCRIBE TABLE ENQ LINES SY-TFILL.

       CHECK SY-TFILL > 0.

       CALL FUNCTION 'ENQUE_DELETE'

         EXPORTING

           SUPPRESS_SYSLOG_ENTRY = 'X'

         IMPORTING

           SUBRC                 = RC

         TABLES

           ENQ                   = ENQ.

     ENDIF.


Reward if helpful.


Regards,

Shakeel Ahmed