cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

object receipt arrives null on some CCO POS

former_member333938
Participant
0 Likes
487

Hello all,

when I try to get the (object receipt) on the screen, on some PCs the object arrives fine, but on others it arrives null with the following error:

'"Cannot invoke "com.sap.scco.ap.pos.entity.ReceiptEntity" because "receipt" is null"

This is my java code:

CDBSession cdbSession = CDBSessionFactory.instance.createSession();

ReceiptPosService receiptManager = ServiceFactory.INSTANCE.getOrCreateServiceInstance(ReceiptPosService.class, cdbSession);

ReceiptEntity receipt = receiptManager.findOrCreate(UserRegistry.INSTANCE.getCurrentUser(), null, true); 

Does anyone know why this happens?

Accepted Solutions (1)

Accepted Solutions (1)

JoergAldinger
Active Contributor
0 Likes

Hello josehrmatos ,

This can happen if your method executes while no receipt is currently in progress.

Please set the noAutoCreate parameter of the findOrCreate method to false, so that CCO creates a new receipt in that case:

ReceiptEntity receipt = receiptManager.findOrCreate(UserRegistry.INSTANCE.getCurrentUser(), null, false); 

Hope this helps,

Joerg.

Answers (0)