cancel
Showing results for 
Search instead for 
Did you mean: 

New to PI, text processing

Former Member
0 Kudos

Hi all,<br>

<br>

I'm not sure how clear this question is going to be....and please forgive the formatting, the message editor isn't very helpful.<br>

<br>

I'm mapping an idoc text segment into a flat file. sounds simple enough, well there are some caveats to it.<br>

<br>

I'm working with idoc WHSORD.DELVRY03, segment E1TXTH8 and it's sub-element E1TXTP8<br>

<br>

The comment line in E1TXTP8 is 132 characters. In the flat file format I'm given, I have 25 characters to work with at a time. <br>

<br>

Any time I need more that 25 characters I have to add a new line to the flat file, increment the necessary counters, and place the next group of 25 characters out there....rinse repeat...until all the E1TXTP8-TDLINEs are processed.<br>

<br>

so my idoc may have the segment below:<br>

<br>

>E1TXTH8<br>

TDOBJECT | VBBK<br>

TDOBNAME | 123456<br>

TDID | 0012<br>

TDSPRAS | E<br>

LANGUA_ISO| EN<br>

> E1TXTP8<br>

TDFORMAT | *<br>

TDLINE |The quick red fox jumped over the lazy brown dog.<br>

> E1TXTP8<br>

TDFORMAT | *<br>

TDLINE |The quick red fox jumped over the lazy brown dog.<br>

> E1TXTP8<br>

TDFORMAT | *<br>

TDLINE |The quick red fox jumped over the lazy brown dog.<br>

> E1TXTP8<br>

TDFORMAT | *<br>

TDLINE |The quick red fox jumped over the lazy brown dog.<br>

<br>

<br>

The ideal result:<br>

<br>

> File<br>

> Header (this is fine)<br>

<br>

> HComments<br>

counter | 1<br>

COMMENT | The quick red fox jumped <br>

HComments<br>

counter | 2<br>

COMMENT | over the lazy brown dog. T<br>

HComments<br>

counter | 3<br>

COMMENT | he quick red fox jumped o <br>

HComments<br>

counter | 4<br>

COMMENT | ver the lazy brown dog. Th<br>

HComments<br>

counter | 5<br>

COMMENT | e quick red fox jumped ov<br>

HComments<br>

counter | 6<br>

COMMENT | er the lazy brown dog. The<br>

HComments<br>

counter | 7<br>

COMMENT | quick red fox jumped ove<br>

HComments<br>

counter | 8<br>

COMMENT | r the lazy brown dog.<br>

<br>

> Details (this is fine)<br>

<br>

<br>

Right now I can get the HComment to show up when needed. but only once, and the text is non-existent. <br>

<br>

Other related info, I'm new to PI, I can do the basic stuff pretty well, drag-drop mapping and such. <br>

<br>

Java coding is not something I have really ever done, been strictly ABAP till recently.<br>

<br>

I'm fairly pressed for time, as the usual requirement, but any ideas or help would be greatly appreciated<br>

<br>

Thanks,<br>

<br>

Sean

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Best option i feel here is to have a UDF and pass the values of TDLINE and entire array of E1TXTP8 or the field which tells how many fields in the target it should be....

in the udf need to write the logic..as per your requirement...

i am just guiding the solution...but not providing the exact solution.

Happy Learnings in PI..

Regards

Rajesh

Former Member
0 Kudos

Thanks, a UDF was the direction I was kind of thinking. <br>

<br>

I guess it's a good a time as any to start learning Java.<br>

<br>

Sean

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

maybe this can help you,


  // value your node
       //cant size that you want to split
       
       int cant=String.valueOf(cant);
       int valueLenght=value.length();
       int pos;    
        String temp;
        while(valueLenght>cant)
        {  pos=0;
           temp=a.substring(0,cant);            
           value=value.substring(cant, valueLenght);          
           valueLenght=valueLenght-cant;                             
        }
       return value;

Edited by: lpbuff on Jan 28, 2010 5:53 PM