eric.dizon
20th May 2014, 23:54
I have an AFS session that reads a temporary Sales Order Header and Detail table and tries to insert an actual SO to tdsls400 & tdsls401.

I would just like to know on how to copy a string field and try to create an equivalent tdsls401.txtb for it? Any snippets that might help me in this scenario?

eric.dizon
21st May 2014, 00:16
What function to use and how can insert the text field number in the tdsls401.txtb entry ?

andreas.toepper
21st May 2014, 16:50
I'm using text.write(..) to create new texts in the script. Basically you need to write your text in a temp. file. Text.write will read this file and store the text in the database.
First parameter of text.write is the text-field. It will be assigned with the new textnumber.

mark_h
22nd May 2014, 00:06
Here is a sample like andreas talks about


function add.header.text()
{
string temp.file1(500), hdr.txt(300)
string kw1(17),kw2(17),kw3(17),kw4(17)
long write.return, input.file

select tdpur040.*
from tdpur040 for update
where tdpur040._index1 = {:new.po}
as set with 1 rows
selectdo
endselect
temp.file1 = creat.tmp.file$(bse.tmp.dir$())
temp.file1 = strip$(temp.file1)
input.file = seq.open(temp.file1,"w")
some.rc = seq.puts("", input.file)
hdr.txt = "This is a FFP order. Refer to individual purchase order lines for DPAS rating, "
some.rc = seq.puts(hdr.txt, input.file)
hdr.txt = "if applicable. The terms and conditions of master purchase order " & strip$(str$(tdudi340.morn))
some.rc = seq.puts(hdr.txt, input.file)
hdr.txt = "are incorporated herein by reference."
some.rc = seq.puts(hdr.txt, input.file)
some.rc = seq.puts("", input.file)
some.rc = seq.close(input.file)
write.return = text.write("tdpur040.txta", "2", kw1, kw2, kw3, kw4, "purchase", "", temp.file1)
db.update(ttdpur040,db.retry)
some.rc = seq.unlink(temp.file1)
}

eric.dizon
22nd May 2014, 00:16
Thanks Andreas and mark those ideas and snippet help me achieved what I needed to do.