Pick/Pack Report print via webservices issue

I am running into an issue where the I can't print a pick report and packing report based on the delivery number that I specify. It seems like it is not reading the delivery number that I specify and just the STOFCY value

I created a subprogram, and then I wrote the following 4GL logic. 

Subprog ZSDHPICKPAK(SDHNUM, STOFCY, RESULTS)

Value Char SDHNUM
Value Char STOFCY

Variable Char RESULTS()

If STOFCY ='110'
Local Char TBPAR(15)(1..50),TBVAL(30)(1..50)

TBPAR(1) = "sitedeb" : TBVAL(1) = STOFCY
TBPAR(2) = "sitefin" : TBVAL(2) = STOFCY
TBPAR(3) = "Livraisondeb" : TBVAL(3) = SDHNUM
TBPAR(4) = "Livraisonfin" : TBVAL(4) = SDHNUM
TBPAR(5) = "codimp" : TBVAL(5) = "2"
# more parameters if needed..
# replace the report name and printer name
Call ETAT("BONLIV2","PRINTER","",0,"",TBPAR,TBVAL) From AIMP3
Call ETAT("BONPRELIV","PRINTER","",0,"",TBPAR,TBVAL) From AIMP3


Else


Local Char TBPAR(15)(1..50),TBVAL(30)(1..50)

TBPAR(1) = "sitedeb" : TBVAL(1) = STOFCY
TBPAR(2) = "sitefin" : TBVAL(2) = STOFCY
TBPAR(3) = "Livraisondeb" : TBVAL(3) = SDHNUM
TBPAR(4) = "Livraisonfin" : TBVAL(4) = SDHNUM
TBPAR(5) = "codimp" : TBVAL(5) = "2"

# more parameters if needed..
# replace the report name and printer name
Call ETAT("BONLIV2","PRINTER","",0,"",TBPAR,TBVAL) From AIMP3
Call ETAT("BONPRELIV","PRINTER","",0,"",TBPAR,TBVAL) From AIMP3
Endif

RESULTS = 'Success'

End

What ends up happening is that it is only reading the STOFCY and prints every non validated delivery with the same STOFCY value.

Anybody have any ideas on what is going? I tried running this by a 4GL script manually in sage, and it works! Seems like an issue when I try to do it via web services.