2026 Mar 12 8:44 AM - edited 2026 Mar 12 8:59 AM
Dear all,
I need a simple example how to create 2 task lists with service packages via fm 'EAM_TASKLIST_CREATE' inside a loop.
Request clarification before answering.
Hello @ABS21
Use this skeleton inside loop. Important: call EAM_TASKLIST_POST + BAPI_TRANSACTION_COMMIT for each task list to avoid buffer/service package mixing. EAM_TASKLIST_CREATE creates data in buffer; posting/commit writes it to DB
DATA: lt_return TYPE bapiret2_t.
DO 2 TIMES.
CLEAR: ls_header,
lt_operations,
lt_spacks_outlines,
lt_spacks_lines,
lt_return.
"Header
ls_header-plnty = 'A'. "General task list
ls_header-werks = '1000'.
ls_header-ktext = |Task list { sy-index }|.
"Operation
APPEND VALUE #( vornr = '0010'
steus = 'PM03'
arbpl = 'MECH'
werks = '1000'
ltxa1 = 'Service operation' ) TO lt_operations.
"Service package outline
APPEND VALUE #( vornr = '0010'
packno = sy-index ) TO lt_spacks_outlines.
"Service line
APPEND VALUE #( packno = sy-index
extrow = '0000000010'
srvpos = 'SERVICE_CODE'
menge = '1'
meins = 'AU' ) TO lt_spacks_lines.
CALL FUNCTION 'EAM_TASKLIST_CREATE'
EXPORTING
is_header = ls_header
iv_date = sy-datum
IMPORTING
ev_plnnr = lv_plnnr
ev_plnal = lv_plnal
TABLES
it_operations = lt_operations
it_spacks_outlines = lt_spacks_outlines
it_spacks_lines = lt_spacks_lines
et_return = lt_return.
READ TABLE lt_return WITH KEY type = 'E' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
CALL FUNCTION 'EAM_TASKLIST_POST'
TABLES
et_return = lt_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true.
ENDDO.
Thanks,
Sravan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.