Create Buffer

trantor

New Member
I have this in one procedure:

DEF VAR vh_TblBuf AS HANDLE NO-UNDO.
CREATE BUFFER vh_TblBuf FOR TABLE "temp_table_name".

The temp_table_name is TEMP TABLE!

And receave error here:
Could not create buffer object for table temp_table_name. (7334)

If I move this code in the main block of the program - it's working.
If the temp_table_name in not temp table - it's working!

Is it possible to create a buffer for temp table in some procedure or triger?
 
Don't exactly understand what you are saying ..... but the following works.


DEFINE TEMP-TABLE temp_table_name
FIELD Field1 AS CHARACTER.

DEFINE VARIABLE hTempTable AS HANDLE NO-UNDO.

CREATE BUFFER hTempTable FOR TABLE "temp_table_name".
 
Yes, that is working, but this is not working:

DEFINE TEMP-TABLE temp_table_name
FIELD Field1 AS CHARACTER.

DEFINE VARIABLE hTempTable AS HANDLE NO-UNDO.

PROCEDURE p_CreateBuffer :
CREATE BUFFER hTempTable FOR TABLE "temp_table_name".
END PROCEDURE.


RUN p_CreateBuffer.

The problem is when the creation of the buffer is inside the procedure...
 
I would assume that you are trying to get a temp-table created in the main block of code into your procedure for use inside the procedure. Observe the code below which creates a temp table with one record. It then passes the temp table to the procedure where the record is displayed and another record added. Then it returns to the main block after the run statement and displays the two records that are currently in the temp-table. Hope this helps.

Code:
/************************************/
/*passing a temp-table to a procedure example*/
/***********************************/
def temp-table tt-test					 
field test as char.						 
 
create tt-test.							 
assign tt-test.test = "crunchy1".		 
 
display "1st time around" with frame c1.	
for each tt-test:						 
	display tt-test.test with frame c1.	 
end.										
 
run p-usetable (buffer tt-test).			
 
display "2nd time around".				 
for each tt-test:						 
	display tt-test.						
end.										
 
procedure p-usetable:							
	def parameter buffer b-test for tt-test.	 
 
	/*do something with passed temp-table*/	 
	find first b-test no-lock no-error.		 
	display "Inside Procedure" with frame ci.	
	display b-test.test with frame ci.		 
 
	create b-test.							 
	assign b-test.test = "crunchy2".			 
 
	return.									 
end procedure.
 
Back
Top