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

The bapi about BAPI_ENTRYSHEET_CREATE.

Former Member
0 Likes
800

hi~all.

i want to use this bapi for creating Entry Sheet ,because i have some items without service nomber,so when i run the bapi ,there is a error take place ,the error describing is following:Unplanned service test may not be entered.

what i should do?

&----


*& Report ZTEST_BAPI *

*& *

&----


*& *

*& *

&----


REPORT ztest_bapi.

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_services TYPE bapiesll OCCURS 0 WITH HEADER LINE.

DATA: po_services LIKE esll OCCURS 0 WITH HEADER LINE.

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 = '6200000229'.

DATA:l_packno LIKE ekpo-packno.

CLEAR l_packno .

SELECT SINGLE packno INTO l_packno FROM ekpo WHERE ebeln = ws_po AND ebelp = '00010'.

  • Busca los servicios del item de pedido

CALL FUNCTION 'MS_READ_SERVICES'

EXPORTING

i_hpackno = l_packno

TABLES

t_esll = po_services

EXCEPTIONS

not_found = 1

OTHERS = 2.

wa_header-po_number = ws_po.

wa_header-po_item = '00010'.

wa_header-short_text = 'Sample'.

wa_header-acceptance = 'X'.

wa_header-doc_date = sy-datum.

wa_header-post_date = sy-datum.

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 ktext1 IS INITIAL .

line_no = line_no + 1.

CLEAR bapi_esll.

bapi_esll-pckg_no = 2.

bapi_esll-line_no = line_no.

bapi_esll-outl_ind = ' '.

bapi_esll-subpckg_no = ' '.

IF po_services-srvpos IS NOT INITIAL.

bapi_esll-service = po_services-srvpos.

ENDIF.

bapi_esll-quantity = 1.

bapi_esll-short_text = po_services-ktext1.

APPEND bapi_esll.

ENDLOOP.

CALL FUNCTION 'BAPI_ENTRYSHEET_CREATE'

EXPORTING

entrysheetheader = wa_header

testrun = 'X'

IMPORTING

entrysheet = ws_entrysheet_no

TABLES

entrysheetservices = bapi_esll

entrysheetsrvaccassvalues = i_service_acc

return = i_return.

break liujunmin.

LOOP AT i_return.

ENDLOOP.

DATA: ws_wait TYPE bapita-wait.

ws_wait = '3'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = ws_wait.

2 REPLIES 2
Read only

Former Member
0 Likes
578

i have solved the question,the way is giving the pln_line parameter a value.

Read only

0 Likes
578

Is that code work which is attahced in forum