04-09-2009 10:42 AM
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
04-09-2009 10:58 AM
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
04-09-2009 10:53 AM
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
04-09-2009 10:56 AM
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
04-09-2009 10:58 AM
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
04-09-2009 11:06 AM
Actually everything works in debug mode. I guess your answer is most possible. But it seems impossible to watch the WP in debuger.
04-09-2009 1:16 PM
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
04-09-2009 2:16 PM
Thanks for your reminding, I just forgot to copy this line of coding. The program works, but the WRITE statements do not work.