You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Re:how to write data into CSV file using SQR

2 replies [Last post]
Guest's picture
Guest

HI guys..
AS i am new to peoplesoft ....i was asked to write data into a CSV file using SQR...i just created a CSV file but unable to write into the CSV file...can any one please help me regarding this...

Thanks ALL for ur HELP

kum's picture
kum (not verified)
Re:how to write code in autogenarated number

hi guys,

can we send code in autogenarated number

Regards
Ravi

raj.psoft's picture
User offline. Last seen 3 weeks 6 days ago. Offline
Joined: 03/25/2010
Posts: 26
Re:how to write code in autogenarated number

SQR:

!********************************************************************************************
!* Procedure: GET-MAX-VOUCHER-ID *
!* Descr : This procedure gets the next VOUCHER ID. *
!* Output : #VOUCHER_ID *
!********************************************************************************************

BEGIN-PROCEDURE GET-MAX-VOUCHER-ID
add 1 to #level
#IFDEF DebugF
print 'Procedure: GET-MAX-VOUCHER-ID' (+1,#level)
#ENDIF

BEGIN-SELECT
A.VCHR_NUM_LAST_USED

Move &A.VCHR_NUM_LAST_USED to #VOUCHER
Add 1 to #VOUCHER
Move #VOUCHER to $VOUCHER
show '$VOUCHER: ' $VOUCHER
Let #offset = instr($VOUCHER, '.', 1)
show '#offset: ' #offset
Let #len = #offset - 1
show '$VOUCHER: ' $VOUCHER
Let $VOUCHERID = Substr($VOUCHER,1,#len)
show '$VOUCHERID: ' $VOUCHERID
Let #V_Ln = Length($VOUCHERID)
show '#V_Ln: ' #V_Ln
Let $VOUCHERID = lpad($VOUCHERID,8,'0')
Move $VOUCHERID to $VOUCHER_ID

FROM PS_BUS_UNIT_TBL_AP A
WHERE A.BUSINESS_UNIT = $BUSINESS_UNIT
END-SELECT

show 'Transaction Loader VOUCHER ID generated by this process = ' noline
show $VOUCHER_ID

show 'TOTAL NUMBER OF ROWS : ' #SQL-COUNT
show 'END-PROCEDURE GET-MAX-VOUCHER-ID'

subtract 1 from #level
END-PROCEDURE GET-MAX-VOUCHER-ID

!********************************************************************************************
!* Procedure: UPDATE-GET-MAX-VOUCHER-ID *
!* Descr: This procedure updates VOUCHER ID with the incremented value. *
!********************************************************************************************
BEGIN-PROCEDURE UPDATE-GET-MAX-VOUCHER-ID

add 1 to #level
#IFDEF DebugF
print 'Procedure: UPDATE-GET-MAX-VOUCHER-ID' (+1,#level)
#ENDIF

Move $VOUCHER_ID to #VOUCHER_ID

BEGIN-SQL
UPDATE PS_BUS_UNIT_TBL_AP
SET VCHR_NUM_LAST_USED = #VOUCHER_ID
WHERE BUSINESS_UNIT = $BUSINESS_UNIT
END-SQL

subtract 1 from #level
END-PROCEDURE UPDATE-GET-MAX-VOUCHER-ID

Raj

Post new comment

CAPTCHA
The question below is to prevent automated spam submissions.
10 + 10 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.