Author |
Message
|
sebastian |
Posted: Wed Apr 28, 2004 8:39 am Post subject: How to distinguish repeating field in CWF |
|
|
 Centurion
Joined: 12 Nov 2003 Posts: 110 Location: Philadelphia
|
I am trying to input an SAP IDOC message using CWF MRM that is in text format with possible repeating segments and output this to xml.
I have done some tests with a message set to convert simple input to matching output xml but am having trouble finding the method that the MRM uses to determine there is a repeating segment. There must be some type of value checked by the CWF parser to check if the next segment is a repeat or a new segment type. Is this the identifier field itself that is listed when you highlight the compound type? Then would this same value need to be placed in the beginning of each repeating segment?
Any feedback is appreciated,
Sebastian _________________ sebastian signature |
|
Back to top |
|
 |
Missam |
Posted: Wed Apr 28, 2004 11:33 am Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
You can use the Search Button with the string CWF and repeat.you will see a bunch of useful results |
|
Back to top |
|
 |
sebastian |
Posted: Thu Apr 29, 2004 4:19 am Post subject: |
|
|
 Centurion
Joined: 12 Nov 2003 Posts: 110 Location: Philadelphia
|
I have looked through the help but do not see anything about identifying a repeating element by a string value. It makes sense that you should be able to do this.
I have string data coming in that is not delimited. The segments (elements) have a set order but some of them may repeat a number of times. Since each segment is 1030 bytes, you can tell if it repeats if after 1030b you see the same segment name at the beginning of the next segment.
I thought that this should be an option in the CWF definition, but now I am beginning to wonder if this logic has to be coded into ESQL after the MRM is defined.
Has anyone had to code something like this?
Sebastian _________________ sebastian signature |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 29, 2004 4:31 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
sebastian wrote: |
identifying a repeating element by a string value. It makes sense that you should be able to do this. |
You can identify a repeating element by a string. But you have to use a "tag delimited structure". That is, TDS, not CWF.
sebastian wrote: |
I have string data coming in that is not delimited. The segments (elements) have a set order but some of them may repeat a number of times. Since each segment is 1030 bytes, you can tell if it repeats if after 1030b you see the same segment name at the beginning of the next segment. |
You can model fixed length repeats in TDS.
sebastian wrote: |
I thought that this should be an option in the CWF definition, but now I am beginning to wonder if this logic has to be coded into ESQL after the MRM is defined. |
Again, TDS, not CWF. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sebastian |
Posted: Thu Apr 29, 2004 5:29 am Post subject: |
|
|
 Centurion
Joined: 12 Nov 2003 Posts: 110 Location: Philadelphia
|
If I am understanding this correctly, you are saying that I can define the input message set with TDS and then the delimiters will be applied in the message set definition itself?
Once this is done, would you then judge the repeating segments in ESQL within a compute node? Would this judged value at the beginning of each segment be the 'TAG' in element properties in the CWF tab?
Any feedback is greatly appreciated,
Sebastian _________________ sebastian signature |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 29, 2004 5:59 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What I'm saying is that most of the people I have seen that have tried to model IDocs have used TDS to do it.
With TDS, you can assign a tag to an element of a complex type, and the model will use that tag to determine how to parse the pieces of the complex type. I repeat, the MODEL will determine how to parse the pieces, and will use the tag to determine that you have a repeat of a previous section or the start of a new section.
There has been other discussion here about modelling IDocs and SAP files in general. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sebastian |
Posted: Thu Apr 29, 2004 11:08 am Post subject: |
|
|
 Centurion
Joined: 12 Nov 2003 Posts: 110 Location: Philadelphia
|
I created a test message set, message flow and input data. The data looks as follows:
SEB_MSG_STARTSEB_EL_1AASEB_EL_2BB
I defined the message set with CWF, TDS and XML physical format layers. I defined the input node with the TDS MRM. My message is failing with the error:
( PRWAPMQADM01DBK.seb_ex_group ) No tag length while Extracting Fixed Length Tag in TDF message.
The TDF message definition does not provide a required Tag Length attribute for an element type, either at project level or at type level.
Make sure that in the TDF message definition, all required Tag Length properties are set.
In the element properties for each element, I have defined:
Tag - SEB_EL_1
Length - 10
Justification - not applicable
Padding character - SPACE
Interpret element value - None
Encoding Null - NULLLogicalValue
Encoding null value - (no entry)
The member properties of Repeating element delimiter and Length value of are both greyed out with no value.
Did I get into a situation where I needed to add a value and now can not go bak and do this? I am not clear where the missing tag length is that the error message refers to.
Any feedback is appreciated,
Seb _________________ sebastian signature |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 29, 2004 11:11 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I believe the Tag Length field is defined on the type, not the element of the type.
Set it to the length of the string that will be your tag. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sebastian |
Posted: Fri Apr 30, 2004 5:37 am Post subject: |
|
|
 Centurion
Joined: 12 Nov 2003 Posts: 110 Location: Philadelphia
|
I set the tag length. I am now getting the error message of:
( PRWAPMQADM01DBK.seb_ex_group ) No Length associated with fixed length data
The TDF parser could not extract data from the bitstream because a Fixed Length element was expected, but no Length or LengthRef was defined in the dictionary.
Define a Length or LengthRef property for all Elements in the message for which a Length is required.
I see lengths defined for each segment so I'm a bit confused.
tag - SEB_EL_1 length = 08
tag - SEB_EL_2 length = 08
any suggestions?
Seb _________________ sebastian signature |
|
Back to top |
|
 |
kimbert |
Posted: Fri Apr 30, 2004 5:54 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
TDS is quite hard to get started with, so here are some pointers. I don't guarantee that this is correct, because I have not tried it out.
I assume this is your input message:
Quote: |
SEB_MSG_STARTSEB_EL_1AASEB_EL_2BB |
so,
SEB_MSG_START is a tag for the entire structure. You can define it as a tag in the TDS settings of the message, or if you prefer you can define it as a Group Indicator for the compound type on which your message is based. Its up to you.
SEB_EL_1 is a tag ( tag length 8 ) for the data 'AA'
SEB_EL_2 is a tag ( tag length 8 ) for the data 'BB'
Your tag length of 8 tells the parser how to extract the tag from the bitstream. You also need to tell the parser how long the data is.
The TDS length property for elements SEB_EL_1 and SEB_EL_2 should be set to 2. |
|
Back to top |
|
 |
sebastian |
Posted: Fri Apr 30, 2004 6:33 am Post subject: |
|
|
 Centurion
Joined: 12 Nov 2003 Posts: 110 Location: Philadelphia
|
Thanks for the pointers. I am having difficulty understanding where to specify the lengths though.
In my message set, I defined a compound type of SEB_MSG that contains two elements of SEB_EL_1 and SEB_EL_2. If I check everything out and highlight SEB_MSG under types and look at the TDS tab, I have a group indicator of SEB_MSG_START and a length of 13 for each character in SEB_MSG_START.
When I highlight SEB_EL_1 and look in the TDS tag, in element properties, I have a tag of SEB_EL_1 and a length of 8 for each character in SEB_EL_1. Are these the lengths you say should be set to 2? If so, how will the parser know how long my element tags are?
I appreciate feedback,
Seb
 _________________ sebastian signature |
|
Back to top |
|
 |
kimbert |
Posted: Fri Apr 30, 2004 7:24 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Now that I'm confident that I understand your scenario, I'll go a bit deeper. Excuse me if I describe properties wrongly- I'm working on 5.0 now, and I no longer have access to the 2.1 tooling.
The Data Element Separation property on compound type SEB_MSG should be set to 'Tagged Fixed Length'. The Tag Length should be set to 8.
Quote: |
a length of 8 for each character in SEB_EL_1. Are these the lengths you say should be set to 2? If so, how will the parser know how long my element tags are? |
On the child elements, the tags should be set as described previously, and the TDS lengths of the elements should be set to 2. The length of each tag within compound type SEB_MSG is given by its Tag Length property. I think you've incorrectly set this to 13 (but see below)
Quote: |
and a length of 13 for each character in SEB_MSG_START. |
Where have you put this length? You cannot set a length for a Group Indicator, so I presume you have incorrectly set the Tag Length to 13 instead of 8.
One more suggestion: on second thoughts, its probably simpler to set SEB_MSG_START as the tag on the message, rather than as the Group Indicator. That will avoid the confusion. |
|
Back to top |
|
 |
sebastian |
Posted: Fri Apr 30, 2004 8:58 am Post subject: |
|
|
 Centurion
Joined: 12 Nov 2003 Posts: 110 Location: Philadelphia
|
Well, I am definitely making some progress....at least now I am transforming the input string into xml but it is not what I expected. I can see that the root tag and first element looks fine but somehow the parser is not recognizing the second element. In fact, it looks like the first element just keeps parsing out the second element tag and data.
My compute node is just doing a simple
SET OutputRoot = InputRoot;
SET OutputRoot.Properties.MessageFormat='XML';
- <MRM xmlns="www.mrmnames.net/DS73Q0G09O001">
- <SEB_MSG>
<SEB_EL_1>AA</SEB_EL_1>
<SEB_EL_1>SE</SEB_EL_1>
<SEB_EL_1>B_</SEB_EL_1>
<SEB_EL_1>EL</SEB_EL_1>
<SEB_EL_1>_2</SEB_EL_1>
<SEB_EL_1>BB</SEB_EL_1>
</SEB_MSG>
</MRM>
What configuration setting needs to be made so that the first element pulls in just data two bytes after the tag and the second tag gets recognized.
Any feedback is appreciated,
Seb _________________ sebastian signature |
|
Back to top |
|
 |
kimbert |
Posted: Tue May 04, 2004 4:09 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I think I know what's wrong.
You presently have a choice of repeating fixed-length elements.
What you need is a repeating choice of tagged elements.
It looks as if you have set SEB_EL_1 to be a repeating element (in which case, you've probably done the same with SEB_EL_2). You should set SEB_MSG to be a repeating element, and make SEB_EL_1 and SEB_EL_2 non-repeating (minOccurs = maxOccurs = 1).
You can probably see what's happening now: the TDS parser has been told that SEB_EL_1 repeats without limit, so it keeps on consuming 2-characters chunks of bitstream until the bitstream runs out.
That's my theory, anyway. |
|
Back to top |
|
 |
sebastian |
Posted: Tue May 04, 2004 11:23 am Post subject: |
|
|
 Centurion
Joined: 12 Nov 2003 Posts: 110 Location: Philadelphia
|
I am going to try to create a new simple message model.
TDS message modeling
I am trying to create a simple TDS message model in an effort to learn more about the tool and eventually create models for input text SAP IDOCs.
My input:
MSG_CONTREPEAT_SEGAABB
My desired output:
<?xml version=”1.0” encoding=”iso-8859-1”?>
<MRM>
<MSG_CONT>
<subsection1>
<EL_1>AA</EL_1>
<EL_2>BB</EL_2>
</subsection1>
</MSG_CONT>
</MRM>
For my message set, in the types folder I have 2 compound types defined. One called MSG_CONTAINER and another called REPEAT_SEG. REPEAT_SEG has a group indicator of ‘REPEAT_SEG’, a tag length of 4, DES of Tagged Fixed Length and two child elements called EL_1 And EL_2. Each child has a tag of EL_1 and EL_2, a length of 2 and do not repeat.
The MSG_CONTAINER has group indicator or 'MSG_CONT', an element called ‘subsection1’ that has a type reference of REPEAT_SEG. MSG_CONTAINER is defined as tagged fixed length with a tag length of 10.
My message flow is very simple:
SET OutputRoot = InputRoot;
SET OutputRoot.Properties.MessageFormat='XML';
That is it!
I keep getting the error of :
( PRWAPMQADM01DBK.dan_ex_group ) TDF Parser or Writer internal error
An unexpected internal error occurred during parsing or writing of a TDF message
Record the full details provided with this message and contact your IBM support center.
The other error messages are even less descriptive.
I would appreciate any suggestions,
Sebastian _________________ sebastian signature |
|
Back to top |
|
 |
|