orest26
17th November 2021, 00:57
I need help for calculate and printing all lines Hendling Unit text from each line Sales order. now my script print only last line from last line sales order. But i need that print line by line - Place report - is After.Field
Script bellow:
function extern void ext.text.henunit.calculate(long i.elem.number)
{
domain tcmcs.s512m txt_buff13(7)

long k,no.of.line
extern domain tcmcs.s512m linetext1
extern domain tcsern linelength
string package(12) fixed,unit(5) fixed,description(50) fixed,h.length(8) fixed,h.width(8) fixed,h.height(10) fixed,h.volume(10) fixed,h.gross(13) fixed,description1(50)
| double length,width,height,volume,gross
| long counter,count.line
| counter = 0
| count.line = 0
select cisli310.orno, cisli310.item,
cisli310.bocp
from cisli310
where cisli310._index1 = { :r.ih.fin.comp,
:r.ih.trns.typ,
:r.ih.doc.nr,
:r.invoice.line}

selectdo
| select count(cisli310.line):count.line
| from cisli310
| where cisli310._index1 = { :r.ih.fin.comp,
| :r.ih.trns.typ,
| :r.ih.doc.nr,
| :r.invoice.line}
| and cisli310._compnr = :cisli310.bocp
| selectdo
| selectempty
| count.line = 3
| endselect
| counter = 0
|


select whwmd530.huid, whwmd530.text
from whwmd530
where whwmd530.huid = :cisli310.item(1;9)

and whwmd530._compnr = :cisli310.bocp


selectdo
| counter = counter + 1
no.of.line = text.to.buf("whwmd530.text",language$,7,txt_buff13)

for k=1 to no.of.line
linetext1 = txt_buff13(1,k)
linelength = len(strip$(linetext1))
string.scan(linetext1, "%s|%s|%s|%s|%s|%s|%s|%s",package,unit,h.length,h.width,h.height,h.volume,h.gross,description1)
if linelength > 0 then
ext.package.h(1,k) = shiftl$(package)
ext.unit.h(1,k) = shiftl$(unit)
ext.h.length(1,k) = shiftl$(h.length)
ext.width.h(1,k) = shiftl$(h.width)
ext.height.h(1,k) = shiftl$(h.height)
ext.volume.h(1,k) = shiftl$(h.volume)
ext.gross.h(1,k) = shiftl$(shiftr$(h.gross))
ext.description1(1,k) = shiftl$(description1)
| if count.line <= counter then
| break
| endif
|ext.text.henunit(1,k) = ext.package.h(1,k) & " " & ext.unit.h(1,k) & " " & ext.h.length(1,k) & " " & ext.width.h(1,k) & " " & ext.height.h(1,k) & " " & ext.volume.h(1,k) & " " & ext.volume.h(1,k) & " " & ext.description1(1,k)
endif
endfor
selectempty

endselect


I would be grateful for any help or shedding light on this issue.

srkndnsn
17th November 2021, 09:11
Hello,

For which field section are you using this function? If for the handling unit then it should be in before.field section.

And when you share code, please delete your comments lines. Your code will be more readable.

Best,
Serkan

orest26
17th November 2021, 10:53
Hello,

For which field section are you using this function? If for the handling unit then it should be in before.field section.

And when you share code, please delete your comments lines. Your code will be more readable.

Best,
Serkan
Hellow Serkan, thanks for your reply, will try

orest26
17th November 2021, 13:32
Hello,

For which field section are you using this function? If for the handling unit then it should be in before.field section.

And when you share code, please delete your comments lines. Your code will be more readable.

Best,
Serkan
Hi Serkan
the solution was very simple - there was one extra value in the script when selecting by index - I selected one line only - therefore - by selecting all the lines I was successful