Hello Sunkara,
For what you've described it's pointing the problem to the currentSession token, because since you're executing that by the java action simulating an user action, your current session is still empty because it's the system executing it so even if you execute the java action with success, in your microflow you still won't get the currentSession filled.
Defining a workaround could be difficult but please note what kind of permissions and connections do you have, and if for SAP you can connect to it from the system, probably could be better for you to split the logic from user actions and system actions and adapt what you need for the system one.
Hope it helps,
Rui Cunha