EDIFACT looping problem

Hi

I have to map a flatfile to an EDIFACT message. My problem is the correct mapping of the RFF-DTM loop.

Example

Flatfile structure

Headerrecord

.

.

deliverynumber

deliverydate

ordernumber

orderdate

.

.

this information should be mapped into the structure

RFFLoop1

RFF

C605

C50601 (Here should be a constant DQ/ON)

C50602 (Delivery NUmber/ordernumber)

C50603 (empty)

C50604 (empty)

DTM_2

C507_2

C50701 (Here should be a constant 171)

C50702 (DeliveryDate/OderDate)

C50703 (Constant 102)

I tried it with the looping functoid and the value mapping functoids for the constants. The problem is that the data in the output is always the constants of the second loop.

(RFF+ON+12345' DTM+171:20070914:102' RFF+ON+99999' DTM+171:20070910:102'

Any idea how I can tell the mapper that the DQ is connected to the deliverynumber and the ON is connected to the Ordernumber? The same problem wiht the constants exists in the DTM Segment

Thanks in Advance

Klaus

[1451 byte] By [KWeber] at [2008-1-10]
# 1

To better understand your scenario, do you want the following?

When you have DQ, you want Delivery Number in C50602 and DeliveryDate in C50702? Similar for ON?

Also how are you inserting the DQ/ON in the C50601 field?

Thanks

Mohsin

MohsinKalam–MSFT at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 2

Hi Moshin

Yes you are right.

The DQ/ON do not exist in the sourcefile. Therefore I insert this values by using a value mapping functoid.

regards

Klaus

KWeber at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 3

Hi,

Mapping to and from EDI messages is not fun at the best of times. A couple of tips that might make life easyer:

1) Look at using the table driven looping functoid for creating the EDI structures. It takes a while to figure out exaclty how it wirks and how you configure it, but it's a timesaver when you use it in the correct scenario.

2) Look at using custom XSLT, either in a scripting functoid, or replacing the map with custom XSLT. In some scenarios it makes more sense to have the map use an external XSLT file, rather than fighting with the functoids. VS 2005 has great XSLT intellisense and debugging.

Regards,

Alan

AlanSmithMVP at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 4
I must disagree with Alan's answer, mapping EDI is no different than any other format and can be just as much "fun" :-) However, you must know how to work with various loopng structures.

This problem is very common and can be solved using the Looping functoid or the Table looping functoid. In this case either will work just as well. As you tried using Looping functoids, here's a quick walk through...

  • connect both DeliveryNumber and the OrderNumber to the to a single Looping functoid that outputs to the RFF segment node.
  • connect the DeliverNumber to a logical existance functoid
  • connect the OrderNumber to a logical existance functoid
  • connect these 2 logicals to a logical OR functoid that outputs the the RFF segment node
  • Now use Value mapping functoids connected to DeliveryNumber, DeliveryDate, plus the appropriate constants.
  • Repeat for the OrderNumber and OrderDate

If you still have prolbems, let me know and I'll send you an example via email.
Richard
Richard at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 5

Hi Richard

Your walk through solved my problem. Sometimes one needs only a certain hint and everything is clear. Nevertheless now I got stuck in a similar problem (but even more complex) in the following NAD-RFF loop.

Now I have three NAD Loops with two RFF loops for the first two NAD and no RFF for the last NAD. My source file has again only the relevant information for the NAD's and RFF's but no information for the qualifier (i.e. Seller, buyer, VAT number etc.)

I get the 3 NAD loops, but the corresponding RFF's are never on the right place. What i'm missing is to tell the mapper which RFF belongs to which NAD

Example

Source: Target:

Headerrecord UNB...

.

.

.

ID_Seller NAD+SU...

internal_ID_Of Seller RFF+API:4321

VAT_NumberSeller RFF+VA:11111

ID_Buyer NAD+BY.....

internal_ID_Buyer RFF+API:1234

VAT_NUmberBuyer RFF+VA:2222

ID_DeliveryParty NAD+DP

I always get this structure:

NAD+SU...

RFF+API:4321

RFF+VA:11111

RFF+API:1234

RFF+VA:2222

NAD+BY...

NAD+DP...

I tried a lot, but again the last hint is missingSmile

Do you have a complete EDIFACT Mapping, where I can see how a real pro solves the looping problems?

Thanks again for your walk through

Klaus

KWeber at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 6

Hi Klaus,

A complete EDIFACT mapping would not really help as the cause of the "problem" is the difference is structure between the source and the target. Therefore unless I had an example with a similar structure it would not be very useful. As you need to go from a flat to a nested looping structure, the solution becomes even more complex. I would therefore suggest making the a change to the structure to make the mapping much easier. Simply add a 2nd RFF segment after the existing RFF. Ensure this is OPTIONAL and at the SAME LEVEL.

That removes the nested looping complexity and the problem can easily be solved with standard functoids. In this case I would recommend using the table looping functoid with 6 columns

col1 col2 col3 col4 col5 col6

"SU" Seller_ID "API" Seller_internal "VAT" Seller_VAT

"BY" Buyer_ID "API" Buyer_internal "VAT" Buyer_VAT

"DP" Delivery_ID "DP" "DP" "DP" "DP"

Note: the contents of col 3 to 6 for DP can be anything as they will be ignored.

Then use the table extractor to map the cols to the appropriate elements. To avoid creating the RFF segments for the Delivery Party, add an logical Equal to the output of col1 and check if it is "DP". then add a logical Not so we return true if it's not 'DP'. Connect this the the 2 RFF nodes so they only get created when the condition is True (ie not = DP).

have fun

Richard

Richard at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 7

Hi Richard

I think that is the right way to solve this issue. However it is not as simple to add a 2nd RFF segment as you described in your last answer. When I just copy and paste I get always an error (RFF wiht this name already exists). I cannot rename the 2nd RFF because the first RFF changes its name as well.

Can you help me again?

(I have no fun at the momentSmile )
KWeber at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 8

Strange - I answered this yesterday but I don't see my post ? so just in case...

Copying a node record to the same level will indeed cause a problem. So just copy the RFF structure and paste it to a different level. This will allow you to rename the new RFF node and then simply drag/drop it into the required position.

Richard

Richard at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 9

Hi Richard

Your recipe for copying a node does not work. Even If I copy the RFF node to a different level an rename it, the original RFF node will be renamed either. What I am doing wrong? Any idea?

Thanks for your assistance

KLaus

KWeber at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 10

I'm not sure what you're doing wrong but here the steps I took (using an EFACT_D97A_ORDERS).

  • Select the RFFLoop1, and copy
  • Expand the NADLoop1
  • Select the NAD record and paste
  • Expand the NAD record
  • Rename the RFFLoop1 to RFFLoop1-1
  • Drag & Drop the RFFLoop1-1 between the RFFLoop1 and the NADLoop1

Richard

Richard at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 11

Hi Richard

I did exactly the same as you did. But when I rename the loop/record/field or even an attribute, the original will be renamed as well. I tried it also with an EFACT_D97A_ORDERS.

If you have any ideas how to solve this problem, please let me know. Otherwise I will post this problem in a new thread

Thanks again

Klaus

KWeber at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...
# 12

I have no idea what's causing this. I did notice that VS is busy for some time after the initial paste. Did you wait until the hour glass goes away before trying to rename ? Is so then I would indeed recommend posting a new thread

Richard

Richard at 2007-10-3 > top of Msdn Tech,BizTalk Server,BizTalk EDI and AS2...