It is a Python macro. Contrary to Basic, Python is a programming language for adults. Your requirement indicates that you have a massive problem with the organization of your data. Splitting equally structured data across sheets has always been a very popular mistake.
In stupid Basic, the following may work (did not test)
Function getABC_Sheets()
Dim a()
sheet_names = ThisComponent.Sheets.ElementNames
for each s in sheet_names
if left(s, 3)="ABC" then bas_PushArray(a(), s)
next
getABC_Sheets = a()
End Function
Sub bas_PushArray(xArray(),vNextElement)
REM helper function to help Basic fill up an array
Dim iUB%,iLB%
iLB = lBound(xArray())
iUB = uBound(xArray())
If iLB > iUB then
iUB = iLB
redim xArray(iLB To iUB)
else
iUB = iUB +1
redim preserve xArray(iLB To iUB)
endif
xArray(iUB) = vNextElement
End Sub