Baanboard.com

Go Back   Baanboard.com > Blogs > Maria Jose's blog

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

 
AFS Carga ordenes de reaprovisionamiento
By Maria Jose at 30 May 2013 - 15:12

Hola :

 Alguien me puede ayudar?

Necesito crear automaticamente ordenes de reaprovisionamiento que me llegan en una tabla.

El problema que tengo es que cuando ejecuto por debugger paso a paso el programa funciona perfectamente, me crea la cabecera y las varias lineas que corresponden a la cabecera, sin embargo, cuando lo compilo normal y lo ejecuto, crea la cabecera bien y la primera linea y ya no continua.

 Os adjunto el programa.

¿Sabeis que me puede pasar.

 

Muchas gracias de antemano

 

fegtu2000m0000  0  VRC B40O c2 expl

|* Actualizar Interfase Necesidades SAT OV12-BaaN

|* Mª Jose Galfarsoro Martinez   

|* 2012-12-10

|******************************************************************************

|* Main table fegtu200 Interfase Necesidades SAT OV12-BaaN, Form Type 4

|******************************************************************************

 

|****************************** declaration section ***************************

declaration:

#pragma used dll ottstpapihand

#pragma used dll ottstpstandard

 

table tfegtu200 | Interfase Necesidades SAT OV12-BaaN

table  ttdrpl100

table  ttdrpl105

table  ttcmcs047

table ttiedm100

table ttiedm101 | Revisiones de artículos de ingenieria

table ttiitm001

 

extern domain tcmcs.str1     stat.f fixed

extern domain tcmcs.str1     stat.t fixed

extern domain tcdate         date.f

extern domain tcdate         date.t

extern domain tcamnt         id.f

extern domain tcamnt         id.t

extern  domain   tcdate         hoy

extern  domain  tcpdno  pdno

string   error(256)

extern   domain  tcmcs.str6  grno

long do.update, ret

long dll_id

long func_id

long dll_return

long func_return

domain  tcmcs.str20    sub.proces

domain  tcmcs.str4     send

 

|****************************** form section **********************************

 

form.1:

init.form:

get.screen.defaults()

 

|****************************** choice section ********************************

 

choice.cont.process:

on.choice:

 

dll_id = LOAD_DLL("ottstpapihand",1)

func_id = GET_FUNCTION(dll_id,"stpapi.put.field")

read.main.table()

 

 

|****************************** field section *********************************

 

field.stat.f:

when.field.changes:

stat.t = stat.f

 

field.date.f:

when.field.changes:

date.t = date.f

 

field.id.f:

when.field.changes:

id.t = id.f

 

 

|****************************** function section ******************************

 

functions:

 

function read.main.table()

{

long count

domain  tcmcs.str6 scount

hoy = 0

count = 10

domain tccwar rwar

domain  tccwar dwar

domain  tccwar  twar

domain tcmcs.str6  odat

domain  tcmcs.str3 cotp

domain  tcmcs.str6   pdno

domain  tcdate    fechahoy

domain  tcmcs.str3  cntr

cntr = "   "

domain  tcmcs.str15   cantidad

domain  tcmcs.str6  fecha

domain   tcmcs.str6  revi

domain  tcmcs.str6   primeraorden

cotp = "R02"

rwar = "611"

dwar = "511"

twar = "   "

fechahoy = date.num()

odat = STR$(date.num())

db.retry.point()

select fegtu200.*, tiitm001.*

from fegtu200 for update, tiitm001

where   fegtu200._index2 inrange {:stat.f, :date.f, :id.f}

                            and {:stat.t, :date.t, :id.t}

and  fegtu200.stat = "P"   

and fegtu200.item refers to tiitm001                          

order by fegtu200.date, fegtu200.item

selectdo

if fegtu200.date < date.num() then

fegtu200.date = date.num()

fecha = STR$(fegtu200.date)  

endif

if hoy <> fegtu200.date then

if hoy <> 0 then 

 

stpapi.end.session( "tdrpl0110m100") endif

hoy = fegtu200.date 

count = 0

scount = STR$(count)

 

grno = "5"

if fegtu200.date < date.num() then

fegtu200.date = date.num()

endif

fecha = STR$(fegtu200.date)  

 

stpapi.put.field( "tdrpl0110m100", "tdrpl105.orno", grno)

stpapi.put.field( "tdrpl0110m100", "tdrpl105.cotp", cotp )

stpapi.put.field( "tdrpl0110m100", "tdrpl105.rwar", rwar)

stpapi.put.field( "tdrpl0110m100", "tdrpl105.dwar", dwar)

stpapi.put.field( "tdrpl0110m100", "tdrpl105.twar", twar)

stpapi.put.field( "tdrpl0110m100", "tdrpl105.odat", odat )

stpapi.put.field( "tdrpl0110m100", "tdrpl105.pddt", fecha )

stpapi.put.field( "tdrpl0110m100", "tdrpl105.prdt", fecha)

|## Inserto el registro en la sesion

stpapi.insert( "tdrpl0110m100", do.update, error )

if error <> "" then 

error = error & " cabecera  " & STR$(tdrpl105.orno) 

message ("No se puede crear  %s",error)

stpapi.end.session( "tdrpl0110m100")

endif

stpapi.save("tdrpl0110m100",error)

if error <> "" then 

error = error & " cabecera " & STR$(tdrpl105.orno)

message ("No se puede crear  %s",error)

stpapi.end.session( "tdrpl0110m100")

endif

| stpapi.end.session( "tdrpl0110m100")

| stpapi.application.option( "tdrpl0110m100", 1,0, error )

 

select tdrpl105.*

from tdrpl105

where tdrpl105.odat = :fechahoy

and tdrpl105.pddt = :fegtu200.date

order by tdrpl105.odat desc

as set with 1 rows

selectdo

pdno = STR$(tdrpl105.orno)

selectempty

message("No encuentra cabecera para crear las lineas")

end()

endselect

| Creamos las lineas

 

 

 

stpapi.handle.subproc("tdrpl0110m100", "tdrpl0111s100", "add")

stpapi.continue.process("tdrpl0110m100", error)  

stpapi.put.field( "tdrpl0111s100", "tdrpl100.orno", pdno)

stpapi.get.field( "tdrpl0111s100", "tdrpl100.orno", pdno)

| stpapi.put.field( "tdrpl0111s100", "tdrpl100.pono", scount )

stpapi.get.field( "tdrpl0111s100", "tdrpl100.pono", scount )

stpapi.put.field( "tdrpl0111s100", "tdrpl100.item", fegtu200.item)

stpapi.put.field( "tdrpl0111s100", "tdrpl100.cntr", "   ")

cantidad = STR$(fegtu200.quty)

stpapi.put.field( "tdrpl0111s100", "tdrpl100.oqua", cantidad)

stpapi.put.field( "tdrpl0111s100", "tdrpl100.cuni", tiitm001.cuni)

stpapi.put.field( "tdrpl0111s100", "tdrpl100.odat", odat )

stpapi.put.field( "tdrpl0111s100", "tdrpl100.pddt", fecha )

stpapi.put.field( "tdrpl0111s100", "tdrpl100.prdt", fecha)

if tiitm001.eitm = tcyesno.yes then

Select tiedm101.*, tiedm100.* from tiedm101, tiedm100

where tiedm101._index1 inrange {"", :tiitm001.item}

and {"zzzzzz", :tiitm001.item}

and tiedm100._index1 = {tiedm101.eitm}

and tiedm100.rele=tiedm.rele.yes

and (tiedm100.indt=0 or

tiedm100.indt<=date.num())

and (tiedm100.exdt=0 or

tiedm100.exdt>=date.num())

order by tiedm101.item desc, tiedm101.revi asc

as set with 1 rows

selectdo

revi = tiedm101.revi

selectempty

revi = "       "

endselect

else

revi = "        "

endif

stpapi.put.field( "tdrpl0111s100", "tdrpl100.revi", revi)

|## Inserto el registro en la sesion

stpapi.insert( "tdrpl0111s100", do.update, error )

if error <> "" then 

error = error & " cabecera  " & STR$(tdrpl100.orno) 

message ("No se puede crear  %s",error)

stpapi.end.session( "tdrpl0111s100")

endif

stpapi.save("tdrpl0111s100",error)

if error <> "" then 

error = error & " cabecera " & STR$(tdrpl100.orno)

message ("No se puede crear  %s",error)

stpapi.end.session( "tdrpl0111s100")

endif

stpapi.end.session( "tdrpl0111s100")

else

count = 10 + 10

scount = STR$(count)

stpapi.handle.subproc("tdrpl0110m100", "tdrpl0111s100", "add")

stpapi.continue.process("tdrpl0110m100", error)  

 

 

stpapi.put.field( "tdrpl0111s100", "tdrpl100.orno", pdno)

| stpapi.put.field( "tdrpl0111s100", "tdrpl100.pono", scount) 

stpapi.get.field( "tdrpl0111s100", "tdrpl100.orno", pdno)

stpapi.get.field( "tdrpl0111s100", "tdrpl100.pono", scount )

stpapi.put.field( "tdrpl0111s100", "tdrpl100.item", fegtu200.item)

stpapi.put.field( "tdrpl0111s100", "tdrpl100.cntr", "   ")

cantidad = STR$(fegtu200.quty)

stpapi.put.field( "tdrpl0111s100", "tdrpl100.cuni", tiitm001.cuni)

stpapi.put.field( "tdrpl0111s100", "tdrpl100.oqua", cantidad)

stpapi.put.field( "tdrpl0111s100", "tdrpl100.odat", odat )

stpapi.put.field( "tdrpl0111s100", "tdrpl100.pddt", fecha )

stpapi.put.field( "tdrpl0111s100", "tdrpl100.prdt", fecha)

if tiitm001.eitm = tcyesno.yes then

Select tiedm101.*, tiedm100.* from tiedm101, tiedm100

where tiedm101._index1 inrange {"", :tiitm001.item}

and {"zzzzzz", :tiitm001.item}

and tiedm100._index1 = {tiedm101.eitm}

and tiedm100.rele=tiedm.rele.yes

and (tiedm100.indt=0 or

tiedm100.indt<=date.num())

and (tiedm100.exdt=0 or

tiedm100.exdt>=date.num())

order by tiedm101.item desc, tiedm101.revi asc

as set with 1 rows

selectdo

revi = tiedm101.revi

selectempty

revi = "      "

endselect

else

revi = "       "

endif

stpapi.put.field( "tdrpl0111s100", "tdrpl100.revi", revi)

|## Inserto el registro en la sesion

stpapi.insert( "tdrpl0111s100", do.update, error )

if error <> "" then 

error = error & " cabecera  " & STR$(tdrpl100.orno) 

message ("No se puede crear  %s",error)

stpapi.end.session( "tdrpl0111s100")

endif

stpapi.save("tdrpl0111s100",error)

if error <> "" then 

error = error & " cabecera " & STR$(tdrpl100.orno)

message ("No se puede crear  %s",error)

stpapi.end.session( "tdrpl0111s100")

endif

stpapi.end.session( "tdrpl0111s100")

endif

 

fegtu200.stat = "T" 

fegtu200.fecp = date.num()

db.update(tfegtu200, db.retry)

commit.transaction()

endselect

stpapi.end.session( "tdrpl0111s100")

stpapi.end.session( "tdrpl0110m100")

commit.transaction()

}

 

 

 


0
No votes yet

by RedBatz on June 6, 2013 - 5:52pm
RedBatz's picture
Hi,

post in the AFS forum, if you still face this issue.


All times are GMT +2. The time now is 01:31.


©2001-2017 - Baanboard.com - Baanforums.com