Thursday, March 16, 2017

Difference between CALL TRANSACTION , LEAVE TO TRANSACTION , SUBMIT [AND RETURN] in SAP ABAP

CALL TRANSACTION  : If Call Transaction statement is used, the calling program will stay active and the control comes back to calling program after the execution of called transaction.

Call Transaction statement retains the calling program and it's data .After exiting the called transaction ,processing is resumed in the calling program after the call.

Example:
SET PARAMETER ID: 'PLN' FIELD gwa_plancreated-plnnr,
'MAT' FIELD gwa_plancreated-matnr,
'WRK' FIELD gwa_plancreated-werks,
'PAL' FIELD gwa_plancreated-plnal.
CALL TRANSACTION 'QP03' AND SKIP FIRST SCREEN.


LEAVE TO TRANSACTION : The control leaves the calling program permanently and moves to the called transaction.Upon exiting the called transaction, processing is not resumed in the calling program

Example : 

Report ztest1.
CALL TRANSACTION  'MM01'.
WRITE 'Hi'.
Output : Hi
 This output can be seen by you if you press back/exit/cancel button in MM01 transaction.

Report ztest2.
LEAVE TO TRANSACTION  'MM01'.
WRITE 'HELLO'.

Nothing will be printed on output screen as the program quits the calling program and if you press back/exit/cancel button in MM01 transaction , control comes back to the point from where you started the execution.

SUBMIT  : This statement accesses an executable program (report) and control won't come back to the calling program output screen after execution of the called program .

SUBMIT AND RETURN : Using this statement the control comes back to the output screen of calling program after the execution of called program.

Example : 
Report ztest.
WRITE / 'Test'.

Report zsubmit.
WRITE / 'Hi'. 
SUBMIT ztest.


Output : 
Test

Press back button
Control comes back to the point where execution of calling program started without displaying the output screen of calling program.

Report zreturn.
WRITE / 'Hi'.
SUBMIT ztest.


Output : 
Test

Press back button
Control comes back to output screen of calling program.
Output :
Hi

No comments:

Post a Comment

SAP giới thiệu mã hỗ trợ AI trong ngôn ngữ ABAP riêng của mình

SAP đã ra mắt một loạt tính năng mã hỗ trợ AI trong môi trường phát triển ứng dụng dựa trên đám mây của mình, đồng thời tham gia vào danh sá...