cancel
Showing results for 
Search instead for 
Did you mean: 

behavior_illegal_statement in ABAP RAP

AbhishekSharma
Active Contributor
0 Kudos
7,123

Hello,

I am trying to use RAP un-Managed scenario. I have created custom FM and inside which I am calling standard FM like below.

CALL FUNCTION '/SCWM/TO_CREATE'
EXPORTING
iv_lgnum = 'ABCD'
iv_update_task = abap_false
iv_commit_work = abap_false
it_create = lt_create
IMPORTING
et_ltap_vb = lt_ltap_vb
et_bapiret = lt_return
ev_severity = ev_severity.
IF ev_severity CA wmegc_severity_eax.
EV_SEVERITY = 'E'.
* ROLLBACK WORK.
ELSE.
EV_SEVERITY = 'S'.
* COMMIT WORK AND WAIT.
* /scwm/cl_tm=>cleanup( ).
ENDIF. SPAN { font-family: "Courier New"; font-size: 16pt; color: #000000; background: #FFFFFF; }.L0S31 { font-style: italic; color: #808080; }.L0S33 { color: #4DA619; }.L0S52 { color: #0000FF; }.L0S55 { color: #800080; }

I am passing

iv_update_task = abap_false

iv_commit_work = abap_false

But its still failing on below statement

My question is how we can use standard Function Module which has Update Task and Commit work inside of standard FM ?

ramjee.korada

@pavankumarjagadeesh89

pavankumarjagadeesh89

Thanks-

Abhishek

View Entire Topic
sagarprusty1988
Explorer

RAP framework doesn't allow external COMMIT WORK. So you are getting the runtime error.

You are also writing the LOG using the FM which also use the COMMIT WORK.

For this kind of requirement where you need to use standard API. Create a wrapper RFC FM with the runtime data and call on background task so that another LUW will be started. ( This should be done in the save method ) in the implementation.

You can do whatever you want in that function module.

You can go for enabling the notification service which can be linked to the application log you are updating.

This will be a asynchronous solution. So once transaction is completed, the notification should be populated.

Notification service Link.

Thanks

Sagar Prusty