한글 문서를 FILTER 하는 프로그램 (USER DEFINED FILTER),INTERMEDIA

제품 : ORACLE SERVER
작성날짜 : 2000-04-20
index될 한글 문서를 깨끗이 정리해주는 프로그램 (user defined filter)
intermedia catriger사용시 (혹은 context option사용시), index생성 도중
오류가 생기는 원인은 여러가지가 있을 수 있다.
그 중 대표적인 것이 indexing할 형태소들을 포함하는 문서에 특수 문자등이
포함되어 있거나 하나의 형태소가 64 bytes이상인 경우이다.
이러한 경우 그 형태소를 표준 한글 형태소만을 fileter하여 indexing하면 된다.
여기에서는 이렇게 한글 문서를 filter하는 user defined filter의 source와
사용법을 정리하였다.
1.사용방법
(1) 2번 프로그램 soruce에 포함된 fixhan.c, fixmain.c fixhan.h를 각각
file로 만들어 둔다.
(2) 아래와 같이 compile한다.
cc -c fixhan.c
cc -c fixmain.c
(3) 다음과 같이 실행 화일을 만든다.
cc -o fixmain fixhan.o fixmain.o
(4) (3)에서 생성된 fixmain을 $ORACLE_HOME/ctx/bin 밑에 위치시킨다.
(5) user filter를 설정하시면 됩니다.
sql>execute ctx_ddl.create_preference('length_f', 'USER_FILTER');
sql>execute ctx_ddl.set_attribute('length_f', 'command', 'fixmain');
sql>create index tokenlength_test_idx on tokenlength_test(text)
indextype is ctxsys.context
parameters( 'filter length_f' ) ;
2.프로그램 source
(1) fixmain.c
/* Copyright (c) Oracle Korea 1998. All Rights Reserved. */
* NAME
* fixmain.c
* DESCRIPTION
* MODIFIED (MM/DD/YY)
* jdlee 08/05/98 - Creation
#include <stdio.h>
#include "fixhan.h"
/*----------------------------- main -------------------------------*/
int main(argc, argv)
int argc;
char *argv[];
FILE fIn, fOut;
unsigned char v_tkval;
int v_status;
char v_buf[FIX_OUTBUFSIZ];
if( argc < 3 )
     return -1;
fIn = fopen(argv[1], "rb");
if( fIn == NULL )
return -1;
fOut = fopen(argv[2], "wb");
if( fOut == NULL )
return -1;
v_status = STS;
while( !feof(fIn) )
v_tkval = (unsigned char) ( fgetc(fIn) & 0xFF );
v_status = fixhan(v_tkval, v_status, v_buf);
if ( v_buf[0] != 0 )
fprintf(fOut, v_buf);
fclose(fIn);
fclose(fOut);
printf("done.\n");
return 0;
(2) fixhan.c
/* Copyright (c) Oracle Korea 1998. All Rights Reserved. */
* NAME
* fixhan.c
* DESCRIPTION
* PUBLIC FUNCTION(S)
*     fixhan
* PRIVATE FUNCTION(S)
* isValidKSC
* NOTES
* MODIFIED (MM/DD/YY)
* jdlee 08/05/98 - Creation
#include <stdio.h>
#include "fixhan.h"
/* if token length is more than 32, token is splitted. */
#define SPLIT_WORD 1
static int isValidKSC (/*_ unsigned char preChar, unsigned char v_tkval _*/);
/*----------------------------- TKmap -------------------------------*/
* NAME
* TKmap -
* DESCRIPTION
* IGN 0 - ignore
* TKW 1 - whitespace ( ' ', '\n', '\t' )
* TKG 2 - grphic symbol, not indexed
* TKE 3 - english, indexed ( number, alphabet, &,-. )
* TKH 4 - hangeul one byte ( >= 0xa1 )
* IGN: 00 - 08
* TKW: 09, 0A
* IGN: 0B, 0C
* TKW: 0D
* IGN: 0E - 1F
* TKW: 20
* TKG: 21 - 2F ( except &,-. : 26,2C,2D,2E -> TKE )
* TKE: 30 - 39
* TKG: 3A - 40
* TKE: 41 - 5A
* TKG: 5B - 60
* TKE: 61 - 7A
* TKG: 7B - 7E
* IGN: 7F - A0
* TKH: A1 - FE
* IGN: FF
* ARGUMENTS
* RETURNS
* NOTES
static int TKmap[256] =
IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, TKW, TKW, IGN, IGN, TKW, IGN, IGN,
IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN,
TKW, TKG, TKG, TKG, TKG, TKG, TKE, TKG, TKG, TKG, TKG, TKG, TKE, TKE, TKE, TKG,
TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, IGN, TKG, TKG, TKG, TKG, TKG,
TKG, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE,
TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKG, TKG, TKG, TKG, TKG,
TKG, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE,
TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKE, TKG, TKG, TKG, TKG, IGN,
IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN,
IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN, IGN,
IGN, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH,
TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH,
TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH,
TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH,
TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH,
TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, TKH, IGN
static int STmap[STATENUM][TOKENNUM] = {
/* IGN TKW TKG TKE TKH */
{ STE, STE, STE, STE, STF }, /* STS */
{ STE, STE, STE, STE, STF }, /* STE */
{ STE, STE, STE, STE, STE } /* STF */
/*----------------------------- isValidKSC ------------------------*/
* NAME
* isValidKSC -
* DESCRIPTION
* K_INDEX - hangeul,hanja index word
* K_GRAPH - graphic character
* K_IGNORE - ignore character
* [A1,AF] x [A1,FE] : K_GRAPH
* [B0,C8] x [A1,FE] : K_INDEX
* [C9] x [A1,FE] : K_IGNORE
* [CA,FD] x [A1,FE] : K_INDEX
* [FE] x [A1,FE] : K_IGNORE
* ARGUMENTS
* RETURNS
* NOTES
static int isValidKSC(preChar, v_tkval)
unsigned char preChar;
unsigned char v_tkval;
int rc;
if ( ( ( preChar >= 0xb0 && preChar <= 0xc8 )
|| ( preChar >= 0xca && preChar <= 0xfd ) )
&& ( v_tkval >= 0xa1 && v_tkval <= 0xfe ) )
rc = K_INDEX;
else if ( ( preChar >= 0xa1 && preChar <= 0xaf )
&& ( v_tkval >= 0xa1 && v_tkval <= 0xfe ) )
rc = K_GRAPH;
else
rc = K_IGNORE;
return rc;
/*----------------------------- fixhan -------------------------------*/
* NAME
* fixhan -
* DESCRIPTION
* v_count_of_index_char - count of index word after white space
* in case of v_buf being TKW, TKG, K_GRAPH, set to 0
* in case of v_buf being TKE, added 1
* in case of v_buf being K_INDEX, added 2
* ARGUMENTS
* v_tkval (IN) - token value
* v_status (IN) - current status
* v_buf (OUT) - output buffer byte length 4 ( 1 + 3 )
* it should return one of TKW, TKG, TKE, K_GRAPH and K_INDEX,
* and can be added one space
* RETURNS
* next status
* NOTES
int fixhan(v_tkval, v_status, v_buf)
unsigned char v_tkval;
int v_status;
char v_buf[FIX_OUTBUFSIZ];
static unsigned char preChar;
static int v_count_of_index_char;
int i;
int rc;
int v_tk;
int v_nxtstat;
v_tk = TKmap[v_tkval];
i = 0;
#ifdef SPLIT_WORD
if ( v_count_of_index_char >= MAX_TOKENLENGTH )
v_buf[i++] = ' ';
v_count_of_index_char = 0;
#endif /* SPLIT_WORD */
switch( v_status )
case STS:
v_count_of_index_char = 0;
case STE:
if ( v_tk == IGN )
v_buf[i++] = ' ';
v_count_of_index_char = 0;
else if ( v_tk == TKW )
v_buf[i++] = v_tkval;
v_count_of_index_char = 0;
else if ( v_tk == TKG )
v_buf[i++] = v_tkval;
v_count_of_index_char = 0;
else if ( v_tk == TKE )
v_buf[i++] = v_tkval;
v_count_of_index_char += 1;
else if ( v_tk == TKH )
v_buf[i] = 0;
else /* this routine should not be processed. */
v_buf[0] = 0;
break;
case STF:
if ( v_tk == IGN || v_tk == TKW || v_tk == TKG || v_tk == TKE )
v_buf[i++] = ' ';
v_count_of_index_char = 0;
else if ( v_tk == TKH )
rc = isValidKSC(preChar, v_tkval);
if ( rc == K_INDEX )
v_buf[i++] = preChar;
v_buf[i++] = v_tkval;
v_count_of_index_char += 2;
else if ( rc == K_GRAPH )
v_buf[i++] = preChar;
v_buf[i++] = v_tkval;
v_count_of_index_char = 0;
else if ( rc == K_IGNORE )
v_buf[i++] = ' ';
v_count_of_index_char = 0;
else /* this routine should not be processed. */
v_buf[i++] = ' ';
v_count_of_index_char = 0;
else /* this routine should not be processed. */
v_buf[i++] = ' ';
v_count_of_index_char = 0;
break;
default: /* this routine should not be processed. */
v_buf[0] = 0;
break;
v_buf[i] = 0;
preChar = v_tkval;
v_nxtstat = STmap[v_status][v_tk];
return v_nxtstat;
(3) fixhan.h
/* Copyright (c) Oracle Korea 1998. All Rights Reserved. */
* NAME
* fixhan.h
* DESCRIPTION
* PUBLIC FUNCTION(S)
*     fixhan
* PRIVATE FUNCTION(S)
* NOTES
* MODIFIED (MM/DD/YY)
* jdlee 08/05/98 - Creation
* IGN: 00 - 08
* TKW: 09, 0A
* IGN: 0B, 0C
* TKW: 0D
* IGN: 0E - 1F
* TKW: 20
* TKG: 21 - 2F ( except &,-. : 26,2C,2D,2E -> TKE )
* TKE: 30 - 39
* TKG: 3A - 40
* TKE: 41 - 5A
* TKG: 5B - 60
* TKE: 61 - 7A
* TKG: 7B - 7E
* IGN: 7F - A0
* TKH: A1 - FE
* IGN: FF
#define TOKENNUM 5
#define IGN 0 /* ignore */
#define TKW 1 /* whitespace ( ' ', '\n', '\t' ) */
#define TKG 2 /* grphic symbol, not indexed */
#define TKE 3 /* english, indexed */
#define TKH 4 /* hangeul one byte ( >= 0xa1 ) */
#define STATENUM 3
#define STS 0 /* start */
#define STE 1 /* english */
#define STF 2 /* hangeul first byte */
/* KSC5601 [A1,FE] x [A1,FE] */
#define K_INDEX 0 /* hangeul,hanja index word */
#define K_GRAPH 1 /* graphic character */
#define K_IGNORE 2 /* ignore character */
/*----------------------------- fixhan -------------------------------*/
* NAME
* fixhan -
* DESCRIPTION
* ARGUMENTS
* v_tkval (IN) - token value
* v_status (IN) - current status
* v_buf (OUT) - output buffer byte length 4
* it should return one of TKW, TKG, TKE, K_GRAPH and K_INDEX.
* RETURNS
* next status
* NOTES
#define FIX_OUTBUFSIZ 4
#define MAX_TOKENLENGTH 32
int fixhan(/*_ unsigned char v_tkval, int v_status, char v_buf[FIX_OUTBUFSIZ] _*/);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Hi Ralf,
please define first your own preferences like this:
exec CTX_DDL.drop_preference('MY_LEXER');
exec CTX_DDL.create_preference('MY_LEXER','BASIC_LEXER');
exec CTX_DDL.set_attribute('MY_LEXER','ALTERNATE_SPELLING',
'GERMAN');
exec CTX_DDL.set_attribute('MY_LEXER','BASE_LETTER','YES');
exec CTX_DDL.set_attribute('MY_LEXER','MIXED_CASE', 'NO');
exec CTX_DDL.set_attribute('MY_LEXER','INDEX_THEMES','NO');
exec CTX_DDL.set_attribute('MY_LEXER','INDEX_TEXT', 'YES');
exec CTX_DDL.set_attribute('MY_LEXER','COMPOSITE', 'GERMAN');
exec ctx_ddl.Drop_Preference ('MY_FILTER');
exec ctx_ddl.Create_Preference ('MY_FILTER','NULL_FILTER');
exec ctx_ddl.drop_section_group ('MY_SECTION');
exec ctx_ddl.create_section_group
('MY_SECTION','NULL_SECTION_GROUP');
and then create your index with this preferences. You only need
an INSO filter if you want to index pdf,word,...
create index test.alldocs_ctx on test.alldocs(data)
     indextype is ctxsys.context
     parameters ('DATASTORE CTXSYS.MyUserDS FILTER
CTXSYS.INSO_FILTER LEXER BASIC_LEXER');create index test.alldocs_ctx on test.alldocs(data)
     indextype is ctxsys.context
     parameters ('
DATASTORE CTXSYS.MyUserDS
lexer MY_LEXER
filter MY_FILTER
section group MY_SECTION');
Then see in the token table what tokens are in the index:
select token_text from dr$alldocs_ctx$i;
If you got also an ORA-3113 see in alert.log if there is a trace
referenced with this error and have a look in this file to find a
better error message.
Good luck.
Thomas

Similar Messages

  • User-defined function in FILTER clause

    hi,
    can i create the user-defined functions and use them in the FILTER clause in the sem_match function? there are some built-in functions for the FILTER clasue. however, only one function (DATATYPE(literal)) support for date/time in the built-in functions. i want to implement some user-defined funcitons in the FILTER clause which can check time intervals in ontology. there are some functions about valid time in the WorkSpace Manager such as WM_OVERLAPS, WM_CONTAINS,WM_MEETS, etc. so, can i write some functions using the these valid time functions in WM and use them in the FILTER clause? thanks a lot in advance.
    hong

    Hi Hong,
    You don't need user-defined functions to do time interval comparisons. You can directly compare xsd:dateTime values with the built-in comparison operators: <, >, =, !=, <=, >=
    For example, the query pattern below could find events that happened during event1 if we have data such as:
    :event1 :startTime "2013-01-01T03:15:00Z"^^xsd:dateTime .
    :event1 :endTime "2013-02-01T02:15:00Z"^^xsd:dateTime .
    :event2 :startTime "2013-01-11T14:15:00Z"^^xsd:dateTime .
    :event2 :startTime "2013-01-14T12:15:00Z"^^xsd:dateTime .
    SELECT ?e2
    WHERE
    { :event1 :startTime ?e1_st; :endTime ?e1_et .
    ?e2 :startTime ?e2_st; endTime ?e2_et .
    FILTER (?e1_st < ?e2_st && ?e2_et < ?e1_et) }
    In general, it is trivial to convert interval relations such as meets and overlaps to conditions on start and end times.
    Hope this helps.
    - Matt

  • Could not load user defined filter. - Weblogic 8.1 sp2

    Hi,
    I got an error in the server output when starting a server with filter. The jar file is located in the WEB-INF/lib but it seems that it could not be loaded. The same application runs fine in Weblogic 7 sp2. Any idea?
    $ cat web.xml
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
    " "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <!-- Register the GZIPfilter -->
    <filter>
    <filter-name>Compress</filter-name>
    <filter-class>com.jspbook.GZIPFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>Compress</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>Compress</filter-name>
    <url-pattern>*.html</url-pattern>
    </filter-mapping>
    <Jul 16, 2004 4:53:10 PM EDT> <Error> <HTTP> <BEA-101165> <Could not load user defined filter: com.jspbook.GZIPFilter.
    <java.lang.ClassNotFoundException: com.jspbook.GZIPFilter
    <     at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:198)
    <     at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:62)
    <     at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    <     at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    <     at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:223)
    <     at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:41)
    <     at weblogic.servlet.internal.WebAppServletContext.loadClass(WebAppServletContext.java:5574)
    <     at weblogic.servlet.internal.WebAppServletContext.registerFilter(WebAppServletContext.java:2901)
    <     at weblogic.servlet.internal.WebAppServletContext.initFilters(WebAppServletContext.java:2878)
    <     at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3176)
    <     at weblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java:688)
    <     at weblogic.servlet.internal.WebService.preloadResources(WebService.java:483)
    <     at weblogic.servlet.internal.ServletInitService.resume(ServletInitService.java:30)
    <     at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
    <     at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:964)
    <     at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:359)
    <     at weblogic.Server.main(Server.java:32)
    <>

    This is probably some jsf library issue.
    Which technology are you using? (ADF is not supported on WLS 12c)
    If you have jsf-api.jar or jsf-impl.jar in your deployment, try to remove them.
    Dario

  • [All Platforms][Your Music] Make it possible to tag and filter "My Music" with user-defined tags

    It would be very nice and convenient to be able to tag and filter "My Music" (playlists, songs, albums and artists) with user-defined tags. I'm sure quite a few users would like to classify their music by genre. Myself, I would like to tag my albums, assigning them to different virtual collections.

    Updated: 2015-07-23Hello and thanks for the feedback!
    A similar idea has also been suggested here:
    https://community.spotify.com/t5/Live-Ideas/Your-Music-Grouping-or-Sorting-by-Tags/idi-p/744947
    Add your kudos and comments there please! ;)

  • User Defined field in UDT - how to create select from existing data

    Hi
    I want to create User Defined Table for purpose of storing records of sales visits made to customers.
    I want to record detail for example: Date of Visit; Sales Employee; Activity number ref (which has attached PDF visit report); Related Opps)
    I am not sure exact detail as I have never created User Defined Table before so I am not sure how best to achieve my requirement.
    But I want one of the fields to be Business Partner code.
    My question is How should I set the BP field so that available options are existing Business Partner codes?
    I would like to set field so that if I enter for example:
    "CAQ"... and I click Tab key then SAP will bring list of BP Codes which begin with CAQ (eg. CAQU001; CAQF001 etc) for my selection.
    Is this possible?
    Regards,
    Karen

    hi.
    u can create a user defined table enter your values..by creating columns like..
    Customercode, customer name, vitst time, attachnment.
    but
    "CAQ"... and I click Tab key then SAP will bring list of BP Codes which begin with CAQ (eg. CAQU001; CAQF001 etc) for my selection.
    above one u can not do it..
    all the cutomer codes will come if u use coding........are u can filter as per ur requirement
    else
    if u say i  am not using the coding..
    u can get all the  business master codes... but u have to use fms  u have to put it..otherwise u can not do it...

  • Multi mapping question using user defined function

    Hi,
    I have a message with multiple occuring nodes (i.e. one message with multiple orders (header + detail)) that I need to map to a idoc. I need to filter out of the source based on order type (in header) from creating an idoc.. How do I do it using user defined function + message mappping ?
    mad

    All - Thanks much.. Here is my requirement that is no solved by regular mapping
    <Root>
    <Recordset>
      <Ordheader>
        <ord>
        <ord_type>
      </Ordheader>
       <Ord_line>
         <ord>
         <Linnum>
       </Ord_line>
      </Recordset>
    <Recordset>
      <Ordheader>
        <ord>
        <ord_type>
      </Ordheader>
       <Ord_line>
         <ord>
         <Linnum>
       </Ord_line>
    </Recordset>
    <Root>
    As you see above, each recordset has order transaction. One Root message can contain multiple of these. So, when I map to the IDOC, I want to filter out any ord_type <> XX.
    If I use regular graphical map, it only looks at first recordset and accepts all or rejects all.
    I need to use UDF. In the UDF, what comes in as input ? Resultset is output -correct ? Now how do I usse graphical mapping with UDF to generate the correct target info

  • User-Defined Message Search - PI 7.1 - EHP1 - SP06 - Not working

    Hi Friends,
    Recently, we have imported SP06 in our PI system (PI 7.1 EHP1). The SXMB_MONI has now new tab "User-Defined Selection Criteria".
    To implement user-defined search, I have created filer, extractor, namespace prefix for one outbound interface through transaction SXMS_LMS_CONF. (As it is explained in SAP EHP1 features PDF and the link "http://help.sap.com/saphelp_nwpi711/helpdata/en/48/c85598f63335bfe10000000a42189d/frameset.htm".
    Also we have created logical port through transaction SOAMANAGER. (followed the steps as mentioned in PDF)
    After filters, extractor, namespace prefix created and activated, I have checked the extractor through Test Extractor, it is working fine. (All are green, given below is the output)
    Type
    Message text
    Processing message 4DDFE95BAEC67152E10000009958A8AB
    Analyzing payload of message version 000
    No filter found
    Analyzing payload of message version 004
    Filter found for interface name PROACT.PROACT01
    Name MATERIAL_ID value RPM312AZ/11522R1 extracted
    Analyzing payload of message version 005
    No filter found
    Analyzing payload of message version 008
    No filter found
    Now, when I do search the same through SXMB_MONI, by giving inputs in the new tab "User-Defined Selection Criteria", Option button "Search for all" , selected the filter name "MATERIAL_ID" in the input field:Name and put material name in the  in the input field:value. (same material I put), it shows the message "No message is available for selection".
    Friends, could you kindly clarify why I am unable to search through SXMB_MONI? Am I missed any of the steps?
    Kindly reply.
    Kind regards,
    Jegathees P.

    Were you able to resolve the issue ?
    If not, You need to execute program SXMS_EXTRACT_MESSAGES to build index for the user defined search from the old messages.
    The job bulids index from the already processed messages.
    Choose the relevant Method when creating the extractor
    Method
    You can choose between two methods:
    Extract During Message Processing
    Select this method if you want the attributes to be extracted from the selected messages while these messages are processed.
    Extract with External Job
    Select this method if you want to extract attributes from messages that were already processed, or if you want to change the extraction of attributes from messages, from which attributes were already extracted.
    For this method you need to set up and use the job SXMS_EXTRACT_MESSAGES.
    thanks
    VJ

  • What the best way to create User defined table with ADDON purpose

    Hi folks, how are you ?
    I´m beginner in development to business one, and I m studying to develop ISV addons.
    But, during my exercises and analisys, I learned that have two ways to create tables and fields in business one. One way is throght by wizard in business one using Tools Menu > Configuration Tools > User Defined Tables >
    Obs: I ´m using Business One Patch Level 9.
    Other way, is create the tables and fields using DI API
    But, my question is. When I develop one addon, or one UDO form that uses one set of user defined tables or used defined fields that where created by the first way (by wizard in B1), how I deploy this in other business one installation ? The package process will ensure the creation of this tables in another enviroment or I must implement the creation of user defined tables using DI API so that this code is called during the installation?
    If in cases of addon develop I must use DI API to create user defined tables, How can I use my classes with this responsibility in package process ?
    Thanks my friends.

    Hi Renan,
    You just need to put your logic in to the startup of your application, after you've established your connection to the UI API and DI API. All this will be triggered in the constructor of your main class.
    namespace MyNamespace
    public class MyAddon
      bool runAddon = true;
      bool initialised = false;
      const string ADDON_NAME = "My Addon";
      public static void Main()
            MyAddon addOn = new MyAddon();
            if(runAddon)
                  System.Windows.Forms.Application.Run();
            else
             Application.Exit();
      public MyAddon()
            // Connect to SBO session for UI
            if(!SetApplication()) runAddon = false;
      private bool SetApplication()
            // Code goes in here to establish UI API and DI API connections
            // See SDK samples for examples
            // You should also define and filter the UI API events your addon will trap at this stage and create any menus
            // Call your routine to check if the required UDFs/UDTs exist on this company
            initialised = CheckInitialisation();
            if (!initialised)
               //  AddOn not yet intialised on this company so prompt the user to run the intialisation process
              int iResponse = app.MessageBox("The " + ADDON_NAME + " addon will now create all required fields and tables."
                                             + System.Environment.NewLine + System.Environment.NewLine
                                             + "WARNING: It is strongly recommended that all other users are logged out of this company "
                                             + "before running this process. Are you sure you wish to continue?", 2, "Yes", "No", "");
              if (iResponse == 1) initialised = InitialiseAddOn(); // Call your routine to create the objects
            return true;
    Kind Regards,
    Owen

  • BUG in DB XML? (when dealing with modules, user-defined functions)

    Hi,
    this post can be related to Different results for the semantically the same queries but here examples are even simpler.
    I have the module with one user-defined function:
    module namespace tnt = "http://tntbase.mathweb.org/ns";
    declare function tnt:filter-path($docs as document-node()*, $path as xs:string) as document-node()*{
      $docs[dbxml:metadata('tnt:path') = $path]
    };Then I have a query:
    import module namespace tnt = 'http://tntbase.mathweb.org/ns'  at 'file:/path/to/module/user-func.xq';
    (: this variable is IMPORTANT in the query:)
    declare variable $len := 3;
    (: here goes the same function as in the module, but with different name :)
    declare function tnt:filter-path2($docs as document-node()*, $path as xs:string) as document-node()*{
      $docs[dbxml:metadata('tnt:path') = $path]
    (:the query itself :)
    tnt:filter-path(collection("xml_content.dbxml"), substring("a:/doc.xml", $len)) If I execute the query I get *0* results, if I use function tnt:filter-path2 (instead of module's tnt:filter-path) then I get the expected *1* result.
    Also I experimented a bit with a query and got the following observations (independent from each other):
    1) If I substitute $len by value *3* or *3.0*, then I get right results in both cases, i.e. if the query itself looks:
    tnt:filter-path(collection("xml_content.dbxml"), substring("a:/doc.xml", 3)) 2) If I change the module's function so that it uses value comparison instead of general comparison, then I get the right results in both cases as well:
    module namespace tnt = "http://tntbase.mathweb.org/ns";
    declare function tnt:filter-path($docs as document-node()*, $path as xs:string) as document-node()*{
      $docs[dbxml:metadata('tnt:path') eq $path]
    };Please, help me out! I'm pretty sure it's a problem of DB XML and I'm struggling with it for a long time in this or that shape.
    Thanks a lot in advance,
    Vyacheslav

    I upgraded from 2.5.13 to 2.5.16 and the bug disappeared. The reason why I didn't do it before was that I hadn't seen any relevant for me fixes in the release notes of 2.5.16 comparing to 2.4.13 (Actually I already have had two patches for two relevant issues in the 2.5.13 version)
    Sorry for the false alarm.
    Vyacheslav

  • Problem with the user-defined message search in PI 7.3.1

    Hi, all
    I having been trying out the new user-defined message search in PI 7.3.1(with TREX). I am stuck on creating the search critera section and could not move forward. Here is how I define the filter:
    Here is a sample payload:
      <?xml version="1.0" encoding="utf-8" ?>
      <ns:JOB_MT xmlns:ns="urn:peoplesoft:batch:job_r:message">
        <MsgData>
          <JOB>
             <ACTION_FLAG>NewPerson</ACTION_FLAG>
             <EMPLID>XXXXX</EMPLID>
             <REG_NO />
             <LAST_NAME>XXXX</LAST_NAME>
             <FIRST_NAME>XXXX</FIRST_NAME>
          </JOB>
        </MsgData>
      </ns:JOB_MT>
    I have tried the xpatch search criteria as the following:
    /ns:JOB_MT/MsgData/JOB/EMPLID
    /ns:JOB_MT xmlns:ns="urn:peoplesoft:batch:job_r:message"/MsgData/JOB/EMPLID
    Both failed to return the emplid field when I clicked on the "test search criteria" against a PI message. Can you advise what I did wrong?
    Thanks,
    Jonathan.

    Hi.
    Did you put the prefix?
    Regards

  • Issue in user defined payload search.

    Hi Experts,
    I tried to configure the payload search in SAP PI 7.1 EHP1 ; I followed the guides given in the links given below. After following every step, I am able to view till the last step but I am not able to get any output.
    After I define filter, extractors and prefixes; the filter becomes active. Now if I try to search with the message id I am able to find the values which I required are extracted (as expected). But when I try the same in SXI_MONITOR there is no result. I end up in getting no message available for selection window. I tried every variation which was prescribed in this websites which helped me fine tune my filter but still the error is very much present.
    Could you help me in solving this and throw light on why the test extractor is working but user-defined selection criteria is not working.
    I am using this in lower environment only.
    Links referred:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/803b22cf-ad75-2f10-0790-da055f2e8c0e?overridelayout=true
    http://help.sap.com/saphelp_nwpi711/helpdata/en/48/c85598f63335bfe10000000a42189d/content.htm
    http://scn.sap.com/people/niki.scaglione2/blog/2010/02/22/payload-searching-without-trex
    regards,
    Bharath

    hi barath,
    Extract during message processing will work for the messages that went through PI after this configuration has been done and it will not work for older messages.
    Extract with External batch job will apply this filter for older messages as well. Bit for achieving this you have to run batch job for program “SXMS_EXTRACT_MESSAGES”.
    We need to run the job for program “SXMS_EXTRACT_MESSAGES”. In SE38 we need to give this program name execute the program and give the date and time.
    after we need to check the messages in SXMB_MONI.
    Regards,
    Rajendar K

  • Indexing Failed - User-Defined message search

    Hi
    I am trying to set-up a user-defined message search in our PI 7.3 system. After having created a filter and defined a search criteria, SAP says to "create an index of the messages that match the active filters and search criteria"  [Link|http://help.sap.com/saphelp_nw73/helpdata/en/48/b2e0186b156ff4e10000000a42189b/content.htm]
    Every time I try to run indexing it fails. I don't know why as there is no help-button available and I haven't found anyone experiencing the same issue. Anyone else experienced the same issue?
    Also - using XPath - do I have to consider any particular namespace prefix etc for PI messsages? I have tested my XPath on payload XML in XMLSpy, but the search functionality seem to expect a different format on the XPath syntax...
    Thank you!
    regards Ole

    Hello,
    I have set this up for an interface now. I am not sure how important the index job is because
    the indexing job worked in the dev system, never stopped in QA and failed in prod. Anyway the message search works in all three systems.
    The following blog made me understand the namespace prefix:
    http://scn.sap.com/people/abinash.nanda/blog/2011/08/17/pi-73--adapter-user-defined-message-search
    Regards,
    Per Rune

  • Error in SXMS_LMS_CONF-User Defined Message Search

    Hi Experts,
    I  am trying to implement the user defined message search feature in PI 7.1 EHP1.
    I have done the require configuration as mentioned in the help document
    http://help.sap.com/saphelp_nwpi711/helpdata/en/48/c85598f63335bfe10000000a42189d/frameset.htm
    and also i checked all the screenshots mentioned in the EHP1 new features  article
    FEATURED EVENTS
    I am getting the error in  test extractor SXMS_LMS_CONF and the error text is
    "Error reading message CENTRAL F99654D7FD61463C345CA35621680000"
    I have checked in NWAPI by running the test , it shows "No messages available for selected filter criteria"
    Any pointer to additional/missing config required  will be of great help.
    Regards,
    Srinivas

    Hi All,
    I doubt if i have mentioned the port number and client correctly in the Logical port configuration step in soamanager.
    In the screenshot in the guide i can see.
    Port number : 50000
    ESR  Target client : 800. (page 34)of guide mentioned above
    and the Url access for nwapi  shows  http://<host>:50080/nwapi (page 21)
    for my system
    http://<host>:50700/nwapi ,
    PI client is 001.
    System ID is 07
    I am confused what to mention for ESR clinet and Port.
    Regards
    Srinivas

  • User defined message search criteria on ECC

    Hi Experts,
    I have configured UDMS-user defined message search under ECC (for message search in MONI) using T-code: SXMS_LMS_CONF and while defining extractors, I have selected both check boxes.
    1. Extract during message processing
    2. Extract with external Job
    As per my knowledge, 1st option indexes all messages which are processed after we activate filters.
    2nd option is used to index previous messages which are processed before defining filter.
    For me 2nd option is working fine (I can search old messages which are indexed using a program:  SXMS_EXTRACT_MESSAGES).
    But 1st option is not working. I have created filters yesterday and activated also, but couldn't able to trace today messages using user defined search.
    Please help in this regard.
    SP.

    Hi.
    From SAP Note.  1600078
    Solution
    Most problems occur because you use the communication components or partners as the filter criteria in the filter even though you want the system to index only certain interfaces. In this situation, you must always set the components or partners to "*".
    If you specify components or partners, you must consider how indexing of messages runs technically. If indexing is called at runtime, the system executes it at the start of the Integration Engine and at the end of the Integration Engine; this means that the value that the components or partners have at this point is definitive. For example, if you have defined a receiving component, this is not set at the start of the Integration Engine (except in special cases) and this is why the filter does not select the message. It also has no effect at the end because the message contains the receiving interface after the mapping. If you call the test function of transaction SXMS_LMS_CONF, the filter is used on each individual persistent version of the message (the same process as when indexing via a job). If the message is made persistent directly before the mapping, the sender interface exists there and the receiving component or partner is set. Therefore, the filter described above would be active here. As a result, this function is better defined to check the XPath than the filter criteria.
    Check if you put  * in the receiver component.
    Regards
    Lucho.

  • User defined message search in PI 7.1 EHP1

    Helly,
    I heard about the new feature in EHP1: "Search asynchronous messages by business-relevant information criteria contained in the message payload (SalesOrder Number, customerID, etc)."
    Has anybody tried it yet? Is that realy as simple as it sounds? Can I just search for any free-text information in the SXMB moni? What steps are necessary to use this feature?
    Thanks,
    Christoph

    Hi Christoph,
    User defined message search enables you to search for messages using the XML payload attributes or using the adapter specific message attributes.
    Implementation:1) Execute the transaction SXMS_LMS_CONF.
                               2) Define the filter to select the message you want to search. Filter is selected on Service Interaface level(bot outbound and inbound side).
                               3) On that filter define a extractor.Extractor uses an XPath expression to search for attributes in the payload of a message or you can also selcet select dynamic header for adapter-specific message attributes
                               4) And at last define the namespace prefix (optional step). 
    Thanks
    Amit

Maybe you are looking for