If exporting out of SO_SalesOrderHeader one way is to click Perform and set it up like in the screenshot. The FlagSOHdr_UDF.pl text file could look like this:
IF NOT(oSO) { oSO = NEW(""SO_SalesOrder_bus"", coSession) }
retVal = oSO'SetKey(Var$)
IF retVal = 1 {
retVal = oSO'SetValue(""UDF_Exported$"", ""Y"") !Replace UDF name & value with yours
retWrite = oSO'Write()
}
EXIT