Application Development 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 contents back after 'Starting new task'...?

vsubbakrishna
Participant
0 Kudos

I am using <b>WS_DELIVERY_UPDATE_2</b> to do batch split on already created delivery.

I am using the below syntax to counter the 'E' message that occurs if the function module fails.

call function 'WS_DELIVERY_UPDATE_2'

<i><b>destination 'NONE'

starting new task 'batch</b>'</i>

exporting

vbkok_wa = wa_vbkok

delivery = p_vbeln

no_messages_update = 'X'

synchron = 'X'

commit = 'X'

nicht_sperren = 'x'

if_database_update = '1'

if_error_messages_send = 'x'

tables

vbpok_tab = t_vbpok[]

IT_HANDLING_UNITS = it_hu[]

et_created_hus = i_hus[].

<b></b>

Now i want to:

1) read the contents of t_vbpok[], i_hus[] back in main program or

2) if the function module had failed i want to read that error message back in my main program.

is it possible to achieve this.

Subba

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You can call one subroutine after end of execution of this function module

In this subroutine, tables and export parameters data will be available.

See below example.

CALL FUNCTION 'Z_GET_DATA'

STARTING NEW TASK task_name

DESTINATION IN GROUP DEFAULT

PERFORMING append_bseg ON END OF TASK

EXPORTING

rname = l_repid

tabnam = tnam

TABLES

t_bkpf_otc = lt_bkpf.

FORM append_bseg USING task_name.

DATA: l_msg(80),

lt_bseg TYPE STANDARD TABLE OF zbseg_otc.

RECEIVE RESULTS FROM FUNCTION 'Z_GET_DATA'

IMPORTING

subrc = g_subrc

TABLES

t_bseg_otc = lt_bseg

EXCEPTIONS

communication_failure = 1 MESSAGE l_msg

system_failure = 2 MESSAGE l_msg.

IF g_subrc IS INITIAL.

LOOP AT lt_bseg INTO wa_bseg.

IF wa_bseg-hkont IN s_hkont1.

APPEND wa_bseg TO t_bseg1.

ENDIF.

IF wa_bseg-hkont IN s_hkont2.

APPEND wa_bseg TO t_bseg2.

ENDIF.

ENDLOOP.

ENDIF.

g_rcvtask = g_rcvtask + 1.

CLEAR : g_subrc.

REFRESH lt_bseg.

ENDFORM.

Cheers,

Sudhakar

5 REPLIES 5

Former Member
0 Kudos

Hi,

You can call one subroutine after end of execution of this function module

In this subroutine, tables and export parameters data will be available.

See below example.

CALL FUNCTION 'Z_GET_DATA'

STARTING NEW TASK task_name

DESTINATION IN GROUP DEFAULT

PERFORMING append_bseg ON END OF TASK

EXPORTING

rname = l_repid

tabnam = tnam

TABLES

t_bkpf_otc = lt_bkpf.

FORM append_bseg USING task_name.

DATA: l_msg(80),

lt_bseg TYPE STANDARD TABLE OF zbseg_otc.

RECEIVE RESULTS FROM FUNCTION 'Z_GET_DATA'

IMPORTING

subrc = g_subrc

TABLES

t_bseg_otc = lt_bseg

EXCEPTIONS

communication_failure = 1 MESSAGE l_msg

system_failure = 2 MESSAGE l_msg.

IF g_subrc IS INITIAL.

LOOP AT lt_bseg INTO wa_bseg.

IF wa_bseg-hkont IN s_hkont1.

APPEND wa_bseg TO t_bseg1.

ENDIF.

IF wa_bseg-hkont IN s_hkont2.

APPEND wa_bseg TO t_bseg2.

ENDIF.

ENDLOOP.

ENDIF.

g_rcvtask = g_rcvtask + 1.

CLEAR : g_subrc.

REFRESH lt_bseg.

ENDFORM.

Cheers,

Sudhakar

vsubbakrishna
Participant
0 Kudos

Hi Sudhakar,

thanks for ur reply..

i am not clear of how to use importing, exporting parameters in performing function module.

how should i import in Receive results.... in my case.

thanks,

Subba

0 Kudos

Hi,

Check if if any error field is filled if it is filled then it means that there is an error. If yes then select your data that you required.

Thanks,

Prashanth

vsubbakrishna
Participant
0 Kudos

Hi all,

CALL FUNCTION 'WS_DELIVERY_UPDATE_2'

<i><b>STARTING NEW TASK 'TEST'

DESTINATION 'NONE'</b></i> PERFORMING <i><b>check_fnmod</b></i> ON END OF TASK

EXPORTING

vbkok_wa = it_vbkok_wa

synchron = 'X'

commit = v_commit

delivery = v_delvry

if_database_update_1 = '1'

if_error_messages_send = 'X'

TABLES

vbpok_tab = it_vbpok_tab[]

it_handling_units_1 = it_rehang[]

ET_CREATED_HUS = it_CREATED_HUS[]

EXCEPTIONS

COMMUNICATION_FAILURE = 1 MESSAGE MSG

SYSTEM_FAILURE = 2 MESSAGE MSG

.

form check_fnmod using taskname.

RECEIVE RESULTS FROM FUNCTION 'WS_DELIVERY_UPDATE_2'

IMPORTING EF_ERROR_ANY = EF_ERROR_ANY

tables

VBPOK_TAB = tt_VBPOK_TAB[]

ET_CREATED_HUS = Tt_CREATED_HUS[]

EXCEPTIONS

COMMUNICATION_FAILURE = 1 MESSAGE MSG

SYSTEM_FAILURE = 2 MESSAGE MSG.

RET_SUBRC = <b>SY-SUBRC</b>. "Setn RET_SUBRC

SET USER-COMMAND 'OKCD'. "Set OK_CODE

endform. " check_fnmod

Even if function module has executed successfully i am getting SY-SUBRC = 2.

thanks,

Subba

vsubbakrishna
Participant
0 Kudos

solved on own.