852 Product Activity Data elements missing?

Oct 8, 2013 at 5:58 PM
Edited Oct 8, 2013 at 9:20 PM
I have found this project to be an extremely useful tool for facilitating EDI in my company. The 850 and 856 document types have been knocked out. Now I'm on to creating an outbound 852 Product Activity Data document for testing.

The two loops I seem to be having trouble getting to be seen as valid are the ZA loop and CTP segment. I am including these using the AddLoop() and AddSegment() methods after creating the initial LIN loop. Are these types defined in this project? I am pretty familiar with syntax and usage, as I have developed my solutions for 850 and 856 document types using the X12 Parser.

Please let me know when time permits. Thanks again and great work on all of this!
Oct 8, 2013 at 7:10 PM
Edited Oct 8, 2013 at 9:20 PM
Specifically, here's a code snippet where the _852trans object represents the 852 transaction I'm building. My code makes it as far as the LIN loop. When I add the ZA loop, the first element throws a runtime exception that the object reference is not set to an instance of an object. When I commented out the ZA loop then the CTP segment that follows it throws the same runtime exception when it hits the first segment in that particular loop.
            // Define the stock item type being reported on.
            seg = _852trans.AddLoop("LIN");                                                    
            seg.SetElement(2, "UP");                                                           
            seg.SetElement(3, "123456");                                                       

            // Define the activity reporting type and product specifics.
            seg = _852trans.AddLoop("ZA");                                                      
            seg.SetElement(1, "QA");                                                            
            seg.SetElement(2, "1");                                                             
            seg.SetElement(3, "EA");                                                            
            seg.SetElement(4, "007");                                                           
            seg.SetElement(5, currentDate.ToString("yyyyMMdd"));                                
            seg.SetElement(6, "ST");                                                            
            seg.SetElement(7, "001");                                                           
            // Define the pricing information.
            seg = _852trans.AddSegment("CTP");
            seg.SetElement(1, "RS");                                                            
            seg.SetElement(2, "WHL");                                                           
            seg.SetElement(3, "100.00");                                                        
Oct 12, 2013 at 1:21 PM
You are attempting to add ZA at the transaction level. You need to add it as a child loop of the LIN loop.

See spec here: https://www.disa.org/apps/workbook/X12_October_2012/ts/852.htm
Oct 14, 2013 at 2:14 PM
Thanks so much! This was the first instance of my having to create a nested EDI loop and I neglected to create the parent/child loop mechanism. Now it's working fine. Appreciate your help and am so pleased with this project!