2007 May 03 2:27 PM
Hi Experts,
Sap receives a segment (idoc) with 15 fields (100 char each). When I analize the next segment, I must know whether the record has been saved before or not.
I can´t save the fields as key in a table because they exceed the limit, and someone suggested me to save them in a table with a guid field and the rest of the fields in the records.
The question is: when the next segment comes, I must calculate the Guid from the fields I have in the segment.
Do you know if there is a way to know the value of the Guid field if I only have the fields?
Please help me out in this.
Thanks in Advance,
Regards,
Liliana.
2007 May 03 3:15 PM
Hello Liliana.
You could use the function module MD5_CALCULATE_HASH_FOR_CHAR.
(Maybe also suitable MD5_CALCULATE_HASH_FOR_RAW)
The import parameter data will be your segment and if it is the same the MD5 number will also be the same.
CALL FUNCTION 'MD5_CALCULATE_HASH_FOR_CHAR'
EXPORTING
DATA = segment1
IMPORTING
HASH = hash1
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'MD5...'
= segment2
..
= hash2
If segment1 and segment2 are equal then are also hash 1 and hash2.
Regards,
Tim
2007 May 03 3:15 PM
Hello Liliana.
You could use the function module MD5_CALCULATE_HASH_FOR_CHAR.
(Maybe also suitable MD5_CALCULATE_HASH_FOR_RAW)
The import parameter data will be your segment and if it is the same the MD5 number will also be the same.
CALL FUNCTION 'MD5_CALCULATE_HASH_FOR_CHAR'
EXPORTING
DATA = segment1
IMPORTING
HASH = hash1
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'MD5...'
= segment2
..
= hash2
If segment1 and segment2 are equal then are also hash 1 and hash2.
Regards,
Tim
2007 May 03 3:44 PM
Thanks Timo, this function also has a table, and one of its parameters is the lenght.
I am testing your function...I will let you know soon.
2007 May 03 4:32 PM