Perform Logic required. Here is 1 way.
In Configuration tab choose SO_SalesOrderDetail as the table (not SO_SalesOrderHeader)
In Data tab add all the fields you need from SO_SalesOrderHeader first then from SO_SalesOrderDetail
Something like this:
Then on Configuration tab, click Perform button to add a Before Write event and point it to a text file that lives below \mas90.
Paste this in. We are manipulating the exp$ variable which is the data written to the target file.
In this example, I'm assuming ItemCode is 1st Detail field being exported. Change if different for you.
%CurrentSO$ = SO_SalesOrderDetail01.SalesOrderNo$posItemCode = POS(SO_SalesOrderDetail01.ItemCode$ = exp$)IF posItemCode { IF %LastSO$ = %CurrentSO$ { !We are on same SalesOrderNo !WRITE Detail record only exp$ = "PD" + FieldDelimiter$ + STP(exp$(posItemCode),1,",") } ELSE { !WRITE Header fields plus Enter plus 1st Detail record exp$ = "PH" + FieldDelimiter$ + MID(exp$,1,posItemCode - 2) + \
$0D$ + $0A$ + \
"PD" + FieldDelimiter$ + STP(exp$(posItemCode),1,",")
%LastSO$ = %CurrentSO$
}} EXIT------------------------------
Alnoor Cassim
Accounting Systems, Inc. (ASI)
Email:
alnoor@asifocus.comOrange County, CA
------------------------------