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

WRITE statement invalid in aRFC calling program 'PERFORMING ON END OF TASK'

Former Member
0 Likes
967

Hi Experts,

I find the WRITE statement in aRFC calling program doesn't work. Please check the coding here:

DATA:

flag(1),

lt_spfli TYPE spfli_tab,

ls_spfli TYPE spfli,

lv_sys TYPE sy-sysid,

CALL FUNCTION 'ZREAD_SPFLI_INTO_TABLE'

DESTINATION 'DEST50'

STARTING NEW TASK 'T1'

PERFORMING rec ON END OF TASK

EXPORTING

id = 'LH '

EXCEPTIONS

communication_failure = 1

system_failure = 2.

WAIT UNTIL NOT flag IS INITIAL.

FORM rec USING t.

IF t EQ 'T1'.

RECEIVE RESULTS FROM FUNCTION 'ZREAD_SPFLI_INTO_TABLE'

IMPORTING

itab = lt_spfli

sys = lv_sys

EXCEPTIONS

communication_failure = 1

system_failure = 2

OTHERS = 3.

CASE sy-subrc.

WRITE: / 'Connected to system: ', lv_sys.

LOOP AT lt_spfli INTO ls_spfli.

WRITE: / ls_spfli-carrid, ls_spfli-connid, ls_spfli-cityfrom, ls_spfli-cityto.

ENDLOOP.

flag = 'X'.

WHEN 1 OR 2.

WRITE: / 'Error'.

WHEN 3.

WRITE: / 'Not found'.

ENDCASE.

ENDIF.

ENDFORM. "rec

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
926

Hi,

The addition "end of task" will execute the RFC in the update WP i.e after COMMIT statement.

The write staement will not be effective in such case as updates run indepandent of GUI.

Hope it helps,

-Raj

6 REPLIES 6
Read only

ThomasZloch
Active Contributor
0 Likes
926

Your code is not "reachable" between CASE and WHEN, so move it before the CASE statement or inside a WHEN block, or insert "WHEN 0." immediately after CASE statement, whatever makes sense.

Thomas

Read only

Former Member
0 Likes
926

1. Check endless wait of WAIT UNTIL NOT flag IS INITIAL.

2. Ensure that your session is enough

3. I recommend you to debug it yourself since multi session programming is ambiguous for others to investigate

Read only

Former Member
0 Likes
927

Hi,

The addition "end of task" will execute the RFC in the update WP i.e after COMMIT statement.

The write staement will not be effective in such case as updates run indepandent of GUI.

Hope it helps,

-Raj

Read only

0 Likes
926

Actually everything works in debug mode. I guess your answer is most possible. But it seems impossible to watch the WP in debuger.

Read only

0 Likes
926

Quote from ABAP online help for "CASE":

> You cannot use a statement between the statement CASE and the first statement WHEN.

Please see my first reply.

Thomas

Read only

0 Likes
926

Thanks for your reminding, I just forgot to copy this line of coding. The program works, but the WRITE statements do not work.