2008 Jun 18 8:45 PM
Hi,
in some generic classes we display internal tables in a grid. We want to activate the save&maintain layouts feature by passing the DISVARIANT structure, Here wen have to give Report and handle. As we display some more tables using the same method, we must set a unique handle so that saved ALV layouts do not get merged /confused. As we do not have a table name at this point, my idea is to create a hash key based on the fields in the field catalog (field catalog is only distinguishable object here).
I need an algorithm to create the 4-character handle as a hash value based on the (concatenated) field names in field catalog.
Or a better idea to create unique handles in the generic ALV calls in one program.
Please: Serious answers only.
Regards,
Clemens
2008 Jun 18 9:10 PM
Have you tried with fm ENQUEUECOMPUTEHASH
( I think for this fm you need to concatenate field catalog and pass into this fm) and give INPUT_LEN as length of concatenated field catalog and HASH_LEN as 4
a®s
Edited by: a®s on Jun 18, 2008 4:19 PM
2008 Jun 18 9:10 PM
Have you tried with fm ENQUEUECOMPUTEHASH
( I think for this fm you need to concatenate field catalog and pass into this fm) and give INPUT_LEN as length of concatenated field catalog and HASH_LEN as 4
a®s
Edited by: a®s on Jun 18, 2008 4:19 PM
2008 Jun 19 7:04 AM
Thank you a®s,
unfortunately we are still on 470/620. No such FM ENQUEUECOMPUTEHASH in our system.
If the code is not too big, could you please post it?
Regards,
Clemens
2008 Jun 19 2:27 PM
Here it is
function enqueuecomputehash.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(INPUT) TYPE STRING
*" VALUE(INPUT_LEN) TYPE I
*" VALUE(HASH_LEN) TYPE I
*" EXPORTING
*" REFERENCE(HASH) TYPE STRING
*" REFERENCE(TIME_USEC) TYPE I
*" EXCEPTIONS
*" INVALID_ARGUMENT
*"----------------------------------------------------------------------
field-symbols <text>.
field-symbols <hash>.
data: tmp_input type text8192.
data: tmp_hash type text8192.
if input_len < 1 or hash_len < 1.
raise invalid_argument.
endif.
assign tmp_input(input_len) to <text>.
assign tmp_hash(hash_len) to <hash>.
data: t1 type i,
t2 type i.
<text> = input.
get run time field t1.
call 'C_ENQ_WILDCARD' id 'TEXT' field <text>
id 'TEXTHASH' field <hash>.
get run time field t2.
hash = <hash>.
time_usec = t2 - t1.
endfunction.