cancel
Showing results for 
Search instead for 
Did you mean: 

XML Master Detail

06-09-2015 5:23 PM
1603 views 17 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hi

I'm trying to export an external datawindows in master detail XML.

THE CODE:

for i = 1 to dw_stampa1.rowcount()

ll_riga = ds_xml.insertrow(0)

ds_xml.setitem(ll_riga, 'tkdistpa', 'Distinta XML:  ' + string( id_DaDistinta, '0' ) )
ds_xml.setitem(ll_riga, 'dtdist', datetime(ldt_pfdpre) )
ds_xml.setitem(ll_riga, 'nrdettagli', string(dw_stampa1.rowcount()) )
ds_xml.setitem(ll_riga, 'totdistinta', dw_stampa1.getitemnumber(1, 'tot_imp') )
ds_xml.setitem(ll_riga, 'azienda', left(RAGIONESOCIALE, 70))
ds_xml.setitem(ll_riga, 'dtvalu', dw_stampa1.getitemdatetime(i, 'dtvalu') )
ds_xml.setitem(ll_riga, 'Ibanaz', 'cod iban az' )
ds_xml.setitem(ll_riga, 'abiaz', ls_abi)
ds_xml.setitem(ll_riga, 'importo', dw_stampa1.getitemnumber(i, 'import') )
ds_xml.setitem(ll_riga, 'desfornitore', left(dw_stampa1.getitemstring(i, 'ragcog'), 35) )
ds_xml.setitem(ll_riga, 'Ibanfr', 'cod iban fr' )

ds_xml.setitem(ll_riga, 'desc',  'Fattura: ' +  trim(dw_stampa1.getitemstring(i, 'nrdocext')) +  ' del ' +  string(dw_stampa1.getitemdatetime(i, 'dtdocext'), 'DD/MM/YY')  + ' Cig/Cup ' + trim(dw_stampa1.getitemstring(i, 'cigcup')) )

Next

ds_xml.saveas('c:\temp\xxx.xml', xml!,  true)

In dw_stampa_1 i have 2 rows.

i need one  header and 2 details like dw_stampa1.

The detail are about the last 4 fields.

The ds_xml ( see attached ) the export give me only 1 detail. Why ?

ty all

G.

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi Gimmy;

   The DWO is of a Freeform type - thus, no header - no headings. If you change the "dw_distpaga_xml" DWO into a tabular format - the the headings will be produced. 

HTH

Regards ... Chris

Former Member
0 Likes

Hi Chris

Where is the difference ?

They have the same 'processing' value: '0'

Former Member
0 Likes

   Except one has HEADER elements and the other one does not (typically). You could also manually add header elements as well.

Personally, I always prefer to use the GRID style as all the columns line up nicely with its related heading.

Former Member
0 Likes

What does that have to do with exporting it to XML?  The XML export template defines the format there, not the display of the datawindow.

Former Member
0 Likes

You are correct Bruce ... I was thinking Excel / Text / etc - not XML. Please ignore that suggestion Gimmy.

Former Member
0 Likes

I need to save the contents of DW in XML format.

Banks, here in Europe, will exchange data in XML format (which contains the structure and data).

Is there something wrong with my reasoning? You can not do with DW?

See attached file ( it is a PDF ) for example at point

4. Examples from internet

4.1 Domestic Payment Estonia, 2 payments:

Former Member
0 Likes

No, you're doing fine.  Just that some of the suggestions you were getting were taking you down the wrong path.

Here's a trivial example of a master detail XML export.

The first thing you have to do is create a nested datawindow.  For this example, I created the detail using the EMP table from the EAServer Demo database, taking dept_id as an argument.  Note the XML template for the detail info.

Then I created the master using the DEPT table from that same database and included the d_dept datawindow in it as a report, linking them with the dept_id column from the master.  Also note the XML template for the master, and how I've defined d_dept (the reference to the nested datawindow) as the start of the detail (the grey bar).

Retrieve the master datawindow (it will retrieve the nested datawindow), export the master, and viola: nested XML.

What you get in the export is all in a single line (no whitespace).  I've cleaned it up with NotePad++ so the master/detail shows.

Former Member
0 Likes

Ty Bruce



I think the problem is that I can not put the gray line that identifies the detail (The two are of tabular DW  see attached).




Someone know Why ?

Former Member
0 Likes

XML can only export DATA, not visual indicators.

Former Member
0 Likes

The grey bar he is referring to isn't something that gets exported, it's a setting in the XML template that tells the datawindow how to do the export.

Former Member
0 Likes

yes Bruce, but if i open the template i don't find it.

=(

Former Member
0 Likes

Right click on CdtTrfTxInf and select "Starts Detail" from the popup menu.

Former Member
0 Likes

if I put it (right click of mouse) and save, at the reopening of the object it is gone.

Former Member
0 Likes

There might be something wrong with the syntax of your datawindow that is causing the painter to choke when saving it.  All that happens when you mark an element as starting the detail is that it adds an __pbband=~"detail~" attribute to that element.  You can open the datawindow up in source mode and add that manually.  It seems to have remained after I did that.

Answers (2)

Answers (2)

Former Member
0 Likes

Done!

Former Member
0 Likes

I think the export template doesn't have the any indication of where the break in header and detail is.

Is there a horizontal grey line in the export template the design mode?

Exported dw should have something this: <MyDetail __pbband=~"group~">

Former Member
0 Likes

you're right.

My template does not have the gray line that identifies the detail, but if I put it (right click of mause) and save; at the reopening of the object it is gone.

why?