Skip to Content
0
Dec 19, 2011 at 03:42 PM

Sapscript to check if a field contains something.

225 Views

Hello,

I have a Excel/SAPscript macro that closes WBS elements in CJ20N. This macro will fail upon trying to close a WBS that is already closed, because the close alternative is faded and unavailable in the menus. Therefore I want the macro to check the WBS element system status field if it contains the "CLSD" status before setting the status.

I have tried this which does not work, the .Contains("CLSD")-part, I have also tried .Text.Contains("CLSD"), .Text = "CLSD", and no one of those are working. If it finds CLSD in this field in the code, it should move on to "Redanstangdhoppaover" in my code (this skips the actual setting of the status).

If session.findById("wnd[0]/usr/subDETAIL_AREA:SAPLCNPB_M:1010/subVIEW_AREA:SAPLCJWB:3999/tabsTABCJWB/tabpGRND/ssubSUBSCR1:SAPLCJWB:1210/subSTATUS:SAPLCJWB:0700/txtCNJ_STAT-STTXT_INT").Contains("CLSD") Then GoTo Redanstangdhoppaover

What else is there left to try?

Thanks, Mattias