Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV GRID EXPORT TO XML

yogesh_pathak
Participant
0 Likes
4,412

Dear Madam / Sir,

Firstly thank you very much for attending my question.

My question is regarding Excise Dealer Return (India) to be filed in XML format.

I have completed ALV GRID with all required fields, but the XML portion is pending just because I don't know how to make XML as per Sample Format given by Excise Dept.

Although I have tried to make XML file by putting below mentioned code but the format is not as required:

FORM create_xml .
  DATA : l_xml TYPE REF TO cl_xml_document,
         sysubrc TYPE sy-subrc .
* CREATE THE XML OBJECT
  CREATE OBJECT l_xml.

* CONVERT THE DATA TO XML
  CALL METHOD l_xml->create_with_data( dataobject = gt_finalx[] ).

* DATA IS CONVERTED TO XML; DISPLAY THE XML-DOCUMENT
  CALL METHOD l_xml->display.
ENDFORM.                    " CREATE_XML

===========================================================

Below is the sample XML content provided by Excise Dept. in which the XML file must be created.

Kindly guide me as to how to make XML as per the format required.

With Warm Regards,

SAMPLE XML CODE PROVIDED BY EXCISE DEPT.

=======================================

- <ACES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ACES_DLR.xsd";>

- <RETURN ReturnType="DLR" ToolVer="1.0";>
- <HEADER-DATA>
  <RETURN-YEAR>2009</RETURN-YEAR> 
  <QUARTER>Jul-Sep</QUARTER> 
  <DEALER-NAME>ABC Limited</DEALER-NAME> 
  <REGISTRATION-NUMBER>BFMPS5767QXD001</REGISTRATION-NUMBER> 
  <NIL-RETURN>No</NIL-RETURN> 
  </HEADER-DATA>
- <INVOICE-HEADER>
- <INVOICE-PARTICULARS SL-NO="1">
  <INVOICE-NUMBER>12365897777777771541</INVOICE-NUMBER> 
  <INVOICE-DATE>15/11/2009</INVOICE-DATE> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>details of goods</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>01019020</CETSH-NUMBER> 
  <QUANTITY-CODE>U</QUANTITY-CODE> 
  <QUANTITY>1235.00<;/QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>226584.00<;/AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>details of goods</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>84369100</CETSH-NUMBER> 
  <QUANTITY-CODE>KG</QUANTITY-CODE> 
  <QUANTITY>3368.00<;/QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>99653.00<;/AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </INVOICE-PARTICULARS>
- <INVOICE-PARTICULARS SL-NO="2">
  <INVOICE-NUMBER>12556523655542154445</INVOICE-NUMBER> 
  <INVOICE-DATE>11/10/2009</INVOICE-DATE> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>details</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>63064900</CETSH-NUMBER> 
  <QUANTITY-CODE>U</QUANTITY-CODE> 
  <QUANTITY>456.00<;/QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>2236.00<;/AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </INVOICE-PARTICULARS>
  </INVOICE-HEADER>
- <DOCUMENT-HEADER>
- <DOCUMENT-DETAIL SL-NO="1">
  <INVOICE-BILL-ENTRY-NO>55623255451145</INVOICE-BILL-ENTRY-NO> 
  <DATE>17/10/2009</DATE> 
  <ISSUED-BY>Manufacturer</ISSUED-BY> 
  <REGISTRATION-NUMBER>BFMPS5767QXD002</REGISTRATION-NUMBER> 
  <NAME>SEZ ltd</NAME> 
  <ADDRESS>udyog vihar</ADDRESS> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>goods desc</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>84079020</CETSH-NUMBER> 
  <QUANTITY-CODE>U</QUANTITY-CODE> 
  <QUANTITY>66</QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>9999999999999</AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>Description Of Goods</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>84079020</CETSH-NUMBER> 
  <QUANTITY-CODE>U</QUANTITY-CODE> 
  <QUANTITY>21.00<;/QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>23.00<;/AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </DOCUMENT-DETAIL>
- <DOCUMENT-DETAIL SL-NO="2">
  <INVOICE-BILL-ENTRY-NO>556232554511889</INVOICE-BILL-ENTRY-NO> 
  <DATE>17/11/2009</DATE> 
  <ISSUED-BY>Importer</ISSUED-BY> 
  <REGISTRATION-NUMBER>BFMPS5767QXD005</REGISTRATION-NUMBER> 
  <NAME>SEG sec</NAME> 
  <ADDRESS>sec 2 ggn</ADDRESS> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>test data</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>44109092</CETSH-NUMBER> 
  <QUANTITY-CODE>KG</QUANTITY-CODE> 
  <QUANTITY>88.00<;/QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>256.00<;/AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </DOCUMENT-DETAIL>
  </DOCUMENT-HEADER>
- <SELF-ASSESSMENT-MEMORANDAM>
  <DATE>08/12/2009</DATE> 
  <PLACE>gurgaon</PLACE> 
  <REMARKS>Return for jul-sep 2009</REMARKS> 
  </SELF-ASSESSMENT-MEMORANDAM>
  </RETURN>
  </ACES>

Dear Madam / Sir,

Firstly thank you very much for attending my question.

My question is regarding Excise Dealer Return (India) to be filed in XML format.

I have completed ALV GRID with all required fields, but the XML portion is pending just because I don't know how to make XML as per Sample Format given by Excise Dept.

Although I have tried to make XML file by putting below mentioned code but the format is not as required:

FORM create_xml .
  DATA : l_xml TYPE REF TO cl_xml_document,
         sysubrc TYPE sy-subrc .
* CREATE THE XML OBJECT
  CREATE OBJECT l_xml.

* CONVERT THE DATA TO XML
  CALL METHOD l_xml->create_with_data( dataobject = gt_finalx[] ).

* DATA IS CONVERTED TO XML; DISPLAY THE XML-DOCUMENT
  CALL METHOD l_xml->display.
ENDFORM.                    " CREATE_XML

===========================================================

Below is the sample XML content provided by Excise Dept. in which the XML file must be created.

Kindly guide me as to how to make XML as per the format required.

With Warm Regards,

SAMPLE XML CODE PROVIDED BY EXCISE DEPT.

=======================================

- <ACES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ACES_DLR.xsd";>

- <RETURN ReturnType="DLR" ToolVer="1.0";>
- <HEADER-DATA>
  <RETURN-YEAR>2009</RETURN-YEAR> 
  <QUARTER>Jul-Sep</QUARTER> 
  <DEALER-NAME>ABC Limited</DEALER-NAME> 
  <REGISTRATION-NUMBER>BFMPS5767QXD001</REGISTRATION-NUMBER> 
  <NIL-RETURN>No</NIL-RETURN> 
  </HEADER-DATA>
- <INVOICE-HEADER>
- <INVOICE-PARTICULARS SL-NO="1">
  <INVOICE-NUMBER>12365897777777771541</INVOICE-NUMBER> 
  <INVOICE-DATE>15/11/2009</INVOICE-DATE> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>details of goods</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>01019020</CETSH-NUMBER> 
  <QUANTITY-CODE>U</QUANTITY-CODE> 
  <QUANTITY>1235.00<;/QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>226584.00<;/AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>details of goods</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>84369100</CETSH-NUMBER> 
  <QUANTITY-CODE>KG</QUANTITY-CODE> 
  <QUANTITY>3368.00<;/QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>99653.00<;/AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </INVOICE-PARTICULARS>
- <INVOICE-PARTICULARS SL-NO="2">
  <INVOICE-NUMBER>12556523655542154445</INVOICE-NUMBER> 
  <INVOICE-DATE>11/10/2009</INVOICE-DATE> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>details</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>63064900</CETSH-NUMBER> 
  <QUANTITY-CODE>U</QUANTITY-CODE> 
  <QUANTITY>456.00<;/QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>2236.00<;/AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </INVOICE-PARTICULARS>
  </INVOICE-HEADER>
- <DOCUMENT-HEADER>
- <DOCUMENT-DETAIL SL-NO="1">
  <INVOICE-BILL-ENTRY-NO>55623255451145</INVOICE-BILL-ENTRY-NO> 
  <DATE>17/10/2009</DATE> 
  <ISSUED-BY>Manufacturer</ISSUED-BY> 
  <REGISTRATION-NUMBER>BFMPS5767QXD002</REGISTRATION-NUMBER> 
  <NAME>SEZ ltd</NAME> 
  <ADDRESS>udyog vihar</ADDRESS> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>goods desc</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>84079020</CETSH-NUMBER> 
  <QUANTITY-CODE>U</QUANTITY-CODE> 
  <QUANTITY>66</QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>9999999999999</AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>Description Of Goods</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>84079020</CETSH-NUMBER> 
  <QUANTITY-CODE>U</QUANTITY-CODE> 
  <QUANTITY>21.00<;/QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>23.00<;/AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </DOCUMENT-DETAIL>
- <DOCUMENT-DETAIL SL-NO="2">
  <INVOICE-BILL-ENTRY-NO>556232554511889</INVOICE-BILL-ENTRY-NO> 
  <DATE>17/11/2009</DATE> 
  <ISSUED-BY>Importer</ISSUED-BY> 
  <REGISTRATION-NUMBER>BFMPS5767QXD005</REGISTRATION-NUMBER> 
  <NAME>SEG sec</NAME> 
  <ADDRESS>sec 2 ggn</ADDRESS> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>test data</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>44109092</CETSH-NUMBER> 
  <QUANTITY-CODE>KG</QUANTITY-CODE> 
  <QUANTITY>88.00<;/QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>256.00<;/AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </DOCUMENT-DETAIL>
  </DOCUMENT-HEADER>
- <SELF-ASSESSMENT-MEMORANDAM>
  <DATE>08/12/2009</DATE> 
  <PLACE>gurgaon</PLACE> 
  <REMARKS>Return for jul-sep 2009</REMARKS> 
  </SELF-ASSESSMENT-MEMORANDAM>
  </RETURN>
  </ACES>

24 REPLIES 24
Read only

Former Member
0 Likes
3,200

Hello Yogesh,

There are FMs like SAP_CONVERT_TO_XML_FORMAT that you can use to achieve this.

However, you can also use SIMPLE TRANSFORMATIONS (called using the statment Call Transformation) for describing transformations between ABAP data and XML. You can find more info on this at

http://help.sap.com/abapdocu_70/en/ABENABAP_ST.htm

Hope it helps...

Regards...Jaison

Read only

Lukas_Weigelt
Active Contributor
0 Likes
3,200

Hi Yogesh,

could you provide us with the source table's structure/contents which your sample xml document is supposed to be the result of?

regards, Lukas

Read only

0 Likes
3,200

Dear Lukas Weigelt,

Please find hereunder the XML Structure:

S.NoXML TAG/ Attribute Description Mandatory Data Validations Format/Length Sample Values

1 ACES Root element of the Dealer Return XML Y NA NA NA

2 RETURN Contains information of Return type and Version Y NA NA NA

3 Return Type First attribute of RETURN, should have value DLR Y Accepts only DLR NA DLR

4 ToolVer Second attribute of RETURN, current value 1.0 Y Contains schema version currently 1.0 NA 1.0

5

HEADER-DATA Contains basic return information like period etc. Y

6 RETURN-YEAR QUARTERLY RETURN UNDER RULE 7 OF CENVAT CREDIT RULES 2002 FOR THE YEAR Y Must be a valid year, cannot be future year. Length-4 2009

7 QUARTER Return for the quarter ending Y Quarter for which return is being filed January-March --> Jan-Mar April-June > Apr-Jun July-September> Jul-Sep October-December -->Oct-Dec Exact values as per enumeration in schema Jan-Mar

8 DEALER-NAME Name of the first stage/second stage dealer Y Maximum 255 characters 255 characters abc limited

9 REGISTRATION-NUMBER Excise registration number Y PAN based Valid registration number, Registration number must have 15 characters. First 10 characters from PAN, next 2 characters should be in XM, XD, EM or ED, last three digits are running serial number. Length- 15 ABCDE1234FXD001 or ABCDE1234FXM001 or AACCA8076DEM001 or AACCA8076DED001

10 INVOICE-HEADER INVOICES ISSUED BY FIRST STAGE/ SECOND STAGE DEALER Y

11 INVOICE-PARTICULARS PARTICULARS OF INVOICES ISSUED BY FIRST STAGE/SECOND STAGE DEALER maintained by attribute SL-NO Y Attribute SL-NO is for indexing of invoices , SL-NO must start with 1 and should increase by 1 for each new item NA 1

12 INVOICE-NUMBER Invoice number Y Maximum 20 characters Maxlength-20 12345698563214500000

13 INVOICE-DATE Date of invoice Y Must be valid date in DD/MM/YYYY format Length-10 11/11/2008

14 INVOICE-ITEMS MAIN ITEMS IN THE INVOICE Y

15 DESCRIPTION-OF-GOODS Detailed description of goods Y Maximum 255 characters Maxlength-255

16 CETSH-NUMBER CETSH number Y Length 8 characters, Full list provided in excel CETSH-UOM.xls; CETSH entered apart from will be rejected at the time of XML processing. Length-8 1011090

17 QUANTITY-CODE Quantity Code i.e. Unit of measure applicable to CETSH Y Please provide correct UOM applicable to CETSH else return XML will be rejected. Refer CETSH-UOM LIST for applicable code to CETSH provided in CETSH-UOM.xls file. Exact values as per enumeration in schema U

18 QUANTITY Quantity Y decimal between 0 and 999999999999.99 12354

19 AMOUNT-OF-DUTY-INVOLVED Amount of Duty Involved (Rs) Y Whole number between 0 and 9999999999999 22256235

20 DOCUMENT-HEADER DOCUMENTS BASED ON WHICH THE CREDIT IS PASSED ON Y

21 DOCUMENT-DETAIL PARTICULARS OF THE DOCUMENTS BASED ON WHICH THE CREDIT IS PASSED ON maintained by attribute SL-NO Y Attribute SL-NO is for indexing of records, SL-NO must start with 1 and should increase by 1 for each new item. NA 1

22 INVOICE-BILL-ENTRY-NO Invoice/Bill Of Entry Number Y Maximum 20 characters Maxlength-20 88898884454

23 DATE Date Y Must be valid date in DD/MM/YYYY format Length-10 11/11/2008

24 ISSUED-BY Issued By Y One of the following : Importer, Manufacturer or Dealer Enumerations provided in schema Dealer

25 REGISTRATION-NUMBER Registration Number Y PAN based Valid registration number, Registration number must have 15 characters. First 10 characters from PAN, next 2 characters should be in XM, XD, EM or ED, last three digits are running serial number. Length- 15 ABCDE1234FXD001 or ABCDE1234FXM001 or AACCA8076DEM001 or AACCA8076DED001

26 NAME Name N Maximum 100 characters Maxlength-100 xyz limited

27 ADDRESS Address N Maximum 200 characters Maxlength-200 abc street, road no 4 , Goa

28 SELF-ASSESSMENT-MEMORANDAM Declaration section of return Y

29 DATE Date of filing return Y Must be a valid date in DD/MM/YYYY format Length-10 10/12/2009

30 PLACE Place of filing return Y Maximum 50 characters Maxlength-50 Gurgaon

31 REMARKS Remarks Y Maximum 1000 characters Maxlength-1000

Read only

0 Likes
3,200

Dear Lukas Weigelt,

Thanks for your reply.

Please find the XML Structure as under:

Just copy and paste in MS-EXCEL for better view.

S.No XML TAG/ Attribute Description Mandatory Data Validations Format/Length Sample Values

1 ACES Root element of the Dealer Return XML Y NA NA NA

2 RETURN Contains information of Return type and Version Y NA NA NA

3 Return Type First attribute of RETURN, should have value DLR Y Accepts only DLR NA DLR

4 ToolVer Second attribute of RETURN, current value 1.0 Y Contains schema version currently 1.0 NA 1.0

5

HEADER-DATA Contains basic return information like period etc. Y

6 RETURN-YEAR QUARTERLY RETURN UNDER RULE 7 OF CENVAT CREDIT RULES 2002 FOR THE YEAR Y Must be a valid year, cannot be future year. Length-4 2009

7 QUARTER Return for the quarter ending Y Quarter for which return is being filed January-March --> Jan-Mar April-June > Apr-Jun July-September> Jul-Sep October-December -->Oct-Dec Exact values as per enumeration in schema Jan-Mar

8 DEALER-NAME Name of the first stage/second stage dealer Y Maximum 255 characters 255 characters abc limited

9 REGISTRATION-NUMBER Excise registration number Y PAN based Valid registration number, Registration number must have 15 characters. First 10 characters from PAN, next 2 characters should be in XM, XD, EM or ED, last three digits are running serial number. Length- 15 ABCDE1234FXD001 or ABCDE1234FXM001 or AACCA8076DEM001 or AACCA8076DED001

10 INVOICE-HEADER INVOICES ISSUED BY FIRST STAGE/ SECOND STAGE DEALER Y

11 INVOICE-PARTICULARS PARTICULARS OF INVOICES ISSUED BY FIRST STAGE/SECOND STAGE DEALER maintained by attribute SL-NO Y Attribute SL-NO is for indexing of invoices , SL-NO must start with 1 and should increase by 1 for each new item NA 1

12 INVOICE-NUMBER Invoice number Y Maximum 20 characters Maxlength-20 12345698563214500000

13 INVOICE-DATE Date of invoice Y Must be valid date in DD/MM/YYYY format Length-10 11/11/2008

14 INVOICE-ITEMS MAIN ITEMS IN THE INVOICE Y

15 DESCRIPTION-OF-GOODS Detailed description of goods Y Maximum 255 characters Maxlength-255

16 CETSH-NUMBER CETSH number Y Length 8 characters, Full list provided in excel CETSH-UOM.xls; CETSH entered apart from will be rejected at the time of XML processing. Length-8 1011090

17 QUANTITY-CODE Quantity Code i.e. Unit of measure applicable to CETSH Y Please provide correct UOM applicable to CETSH else return XML will be rejected. Refer CETSH-UOM LIST for applicable code to CETSH provided in CETSH-UOM.xls file. Exact values as per enumeration in schema U

18 QUANTITY Quantity Y decimal between 0 and 999999999999.99 12354

19 AMOUNT-OF-DUTY-INVOLVED Amount of Duty Involved (Rs) Y Whole number between 0 and 9999999999999 22256235

20 DOCUMENT-HEADER DOCUMENTS BASED ON WHICH THE CREDIT IS PASSED ON Y

21 DOCUMENT-DETAIL PARTICULARS OF THE DOCUMENTS BASED ON WHICH THE CREDIT IS PASSED ON maintained by attribute SL-NO Y Attribute SL-NO is for indexing of records, SL-NO must start with 1 and should increase by 1 for each new item. NA 1

22 INVOICE-BILL-ENTRY-NO Invoice/Bill Of Entry Number Y Maximum 20 characters Maxlength-20 88898884454

23 DATE Date Y Must be valid date in DD/MM/YYYY format Length-10 11/11/2008

24 ISSUED-BY Issued By Y One of the following : Importer, Manufacturer or Dealer Enumerations provided in schema Dealer

25 REGISTRATION-NUMBER Registration Number Y PAN based Valid registration number, Registration number must have 15 characters. First 10 characters from PAN, next 2 characters should be in XM, XD, EM or ED, last three digits are running serial number. Length- 15 ABCDE1234FXD001 or ABCDE1234FXM001 or AACCA8076DEM001 or AACCA8076DED001

26 NAME Name N Maximum 100 characters Maxlength-100 xyz limited

27 ADDRESS Address N Maximum 200 characters Maxlength-200 abc street, road no 4 , Goa

28 SELF-ASSESSMENT-MEMORANDAM Declaration section of return Y

29 DATE Date of filing return Y Must be a valid date in DD/MM/YYYY format Length-10 10/12/2009

30 PLACE Place of filing return Y Maximum 50 characters Maxlength-50 Gurgaon

31 REMARKS Remarks Y Maximum 1000 characters Maxlength-1000

Read only

Lukas_Weigelt
Active Contributor
0 Likes
3,200

Hi Yogesh,

Actually I wanted to know the structure of your table "gt_finalx[]"

Let me elaborate why:

When converting from ABAP to XML you can either use the xml-library (which you already did in your form "create_xml") or Transformations.

For better understanding how XSLT/ST-Transformations work, you should try this Form:

FORM convert_xml2
USING gt_finalx TYPE ????.

TYPE-POOLS: abap.    " Needed for following Data definition

DATA: lt_source_itab TYPE abap_trans_srcbind_tab, " Predefined Structure for the following CALL TRASNFORMATION
      ls_source_wa   TYPE abap_trans_resbind.

DATA: output_stream type xstring. " for xml-stream

GET REFERENCE OF gt_finalx INTO ls_source_wa-value. " pointer for actual data source in predefined source structure of the transformation
ls_source_wa-name = 'ROOTTAG'. " Root element, can be anything in this case; doesn't nessecarily have anything to do with the actual XML Document
APPEND ls_source_wa TO lt_source_itab. " append to table, as the transformation needs a table..

TRY.

    CALL TRANSFORMATION id
      SOURCE (lt_source_itab)
      RESULT XML output_stream. " rendered XML Document from simple transformation id --> identical

  CATCH cx_st_error.

ENDTRY.

CALL FUNCTION 'DISPLAY_XML_STRING'
  EXPORTING
    xml_string = output_stream.

ENDFORM.

This form should convert your table into an xml-document keeping the original structure of your table. This is not what you ultimately need, but this output is what you need to know for later understanding your own Transformation/Template which you'll have to write, because every Transformation implicitly uses the simple Transformation 'id' before running.

Maybe this doesn't make much sense to you yet, but try to run this form and in case it works for you, post the xml-output generated so I can better understand the source data.

Regards, Lukas

Edited by: Lukas Weigelt on Sep 29, 2010 12:05 PM

Read only

0 Likes
3,200

Hi Lukas,

Hope you are fine.

Sorry for inconvenience caused to you due to my duplicate posting of reply.

I have simply attach your code to my ALV and succeeded in getting XML.

The same I have tried initially, but in different way (code mentioned in my Question).

The exact Column Heading that is mentioned in Text Elements in my ALV in not appearing in XML, instead field name of my final internal table is displayed.

For example:

<DLNAME>abc ltd.</DLNAME> 

Here instead of

<DLNAME>

(which is one of the field name of my final internal table)

<DEALER-NAME>

(text mentioned in Text Elements->Text Symbols ) must be displayed.

Also there are items which is not in my internal table and is to be attached at the end of XML(after all data of internal table),

For example:

- <SELF-ASSESSMENT-MEMORANDAM>
  <DATE>08/12/2009</DATE> 
  <PLACE>gurgaon</PLACE> 
  <REMARKS>Return for jul-sep 2009</REMARKS> 
  </SELF-ASSESSMENT-MEMORANDAM>

How It can be inserted (as a part of XML) while making XML

Thanks for your reply.

Warm regards.

Read only

0 Likes
3,200

Hi Lukas,

Hope you are fine.

Sorry for inconvenience caused to you due to my duplicate posting of reply.

I have simply attach your code to my ALV and succeeded in getting XML.

The same I have tried initially, but in different way (code mentioned in my Question).

The exact Column Heading that is mentioned in Text Elements in my ALV in not appearing in XML, instead field name of my final internal table is displayed.

For example:

<DLNAME>abc ltd.</DLNAME> 

Here instead of

<DLNAME>

(which is one of the field name of my final internal table)

<DEALER-NAME>

(text mentioned in Text Elements->Text Symbols ) must be displayed.

Also there are items which is not in my internal table and is to be attached at the end of XML(after all data of internal table),

For example:

- <SELF-ASSESSMENT-MEMORANDAM>
  <DATE>08/12/2009</DATE> 
  <PLACE>gurgaon</PLACE> 
  <REMARKS>Return for jul-sep 2009</REMARKS> 
  </SELF-ASSESSMENT-MEMORANDAM>

How It can be inserted (as a part of XML) while making XML

Thanks for your reply.

Warm regards.

Read only

0 Likes
3,200

Hi Yogesh,

Please post the XML-Output generated by the form I posted earlier. Else I practically can't help you

Edit: Additionally, I can highly recommend you to take a look at Tobias Trapp's Community Blog, he is an expert with anything that's got to do with XML.

http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/u/35460%3fref=srchsp [original link is broken] [original link is broken]

+ also the two books "XML Data Exchange using ABAP" and "XML for ABAP Developers" he wrote (SAP Press).

In case the whole XML thing is entirely new to you, you should take a look here: http://www.w3schools.com/

Regards, Lukas

Edited by: Lukas Weigelt on Oct 1, 2010 12:51 PM

Read only

0 Likes
3,200

Dear Lukas,

Will certainly look into the link provided by you and thanks for the same.

Please find as you requested (Output generated by the Form you sent)

 <?xml version="1.0" encoding="utf-8" ?> 
- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
- <asx:values>
- <ROOTTAG>
- <item>
  <RTNTYPE>DLR</RTNTYPE> 
  <TOOLVER>1.0</TOOLVER> 
  <RTNYEAR>2009</RTNYEAR> 
  <QUARTER>May-May</QUARTER> 
  <DLNAME>Colourtex Ltd.Vakharia-Surat</DLNAME> 
  <DLREGNO>AAACC4513FXD005</DLREGNO> 
  <DLINVSR>1</DLINVSR> 
  <DLINVNO>1519000001</DLINVNO> 
  <DLINVDT>01/05/2009</DLINVDT> 
  <DLGOODS>CORALENE GREY BRS</DLGOODS> 
  <DLCHAPID>32041195</DLCHAPID> 
  <DLMEINS>KG</DLMEINS> 
  <DLMENGE>50.0</DLMENGE> 
  <DLEXBED>551.0</DLEXBED> 
  <MRINVSR /> 
  <MRINVNO /> 
  <MRINVDT /> 
  <ISSUE /> 
  <MRREGNO /> 
  <MRNAME /> 
  <MRADD /> 
  <MRGOODS /> 
  <MRCHAPID /> 
  <MRMEINS /> 
  <MRMENGE>0.0</MRMENGE> 
  <MREXBED>0.0</MREXBED> 
  <DATE>02/05/2009</DATE> 
  <PLACE>SURAT</PLACE> 
  <REMARKS>NOT APPLY</REMARKS> 
  </item>
  </ROOTTAG>
  </asx:values>
  </asx:abap>

And below is the structure of Final Internal Table GT_FINALX.

TYPES : BEGIN OF t_finalx,
        rtntype  TYPE c LENGTH 3,          " ReturnType             EXACT VALUE DLR
        toolver  TYPE c LENGTH 3,          " toolVer                EXACT VALUE 1.0
        rtnyear  TYPE j_1irg23d-docyr,     " RETURN-YEAR            LENGTH 4
        quarter  TYPE c LENGTH 7,          " QUARTER                Apr-Jun
        dlname   TYPE kna1-name1,          " DEALER-NAME            MAX LENGTH 255 CHAR
        dlregno  TYPE j_1imovend-j_1iexrn, " REGISTRATION-NUMBER    LENGTH 15
        dlinvsr  TYPE c LENGTH 5,          " SL-NO                  +1
        dlinvno  TYPE j_1irg23d-depexnum,  " INVOICE-NUMBER         MAX LENGTH 20
        dlinvdt  TYPE c LENGTH 10,         " INVOICE-DATE
        dlgoods  TYPE j_1irg23d-maktx,     " DESCRIPTION-OF-GOODS   MAX LENGTH 255
        dlchapid TYPE j_1irg23d-chapid,    " CETSH-NUMBER           LENGTH 8
        dlmeins  TYPE j_1irg23d-meins,     " QUANTITY-CODE          KG
        dlmenge  TYPE j_1irg23d-menge,     " QUANTITY
        dlexbed  TYPE j_1irg23d-exbed,     " AMOUNT-OF-DUTY-INVOLVED
        mrinvsr  TYPE c LENGTH 5,          " SL-NO2                 +1
        mrinvno  TYPE j_1irg23d-depexnum,  " INVOICE-BILL-ENTRY-NO  MAX LENGTH 20
        mrinvdt  TYPE c LENGTH 10,         " DATE
        issue    TYPE c LENGTH 12,         " ISSUED-BY              Dealer
        mrregno  TYPE j_1imovend-j_1iexrn, " REGISTRATION-NUMBER3   LENGTH 15
        mrname   TYPE lfa1-name1,          " NAME                   MAX LENGTH 100 CHAR
        mradd    TYPE c LENGTH 200,        " ADDRESS                MAX 200 CHAR
        mrgoods  TYPE j_1irg23d-maktx,     " DESCRIPTION-OF-GOODS4  MAX LENGTH 255
        mrchapid TYPE j_1irg23d-chapid,    " CETSH-NUMBER5          LENGTH 8
        mrmeins  TYPE j_1irg23d-meins,     " QUANTITY-CODE6         KG
        mrmenge  TYPE j_1irg23d-menge,     " QUANTITY7
        mrexbed  TYPE j_1irg23d-exbed,     " AMOUNT-OF-DUTY-INVOLVED8
        date     TYPE c LENGTH 10,         " DATE9                  Date of filing return
        place    TYPE t001w-ort01,         " PLACE                  Place of filing return
        remarks  TYPE c LENGTH 1000,       " REMARKS                Remarks
        END OF t_finalx.

Warm Regards.

Read only

0 Likes
3,200

Hi Yogesh,

1. Use TC SE80 to create a new XSLT Transformation. See as a Reference:

http://help.sap.com/saphelp_nw04s/helpdata/en/fd/9d734b389211d596a200a0c94260a5/content.htm

In the new Transformation Sourcecode WIndow, overwrite its contents with this code:

Edit: Within a Tag, such as <xsl:text disable-output-escaping="yes"> to display angle brackets you have to use "_&_l_t_;" and "_&_g_t_;_" without the underlines...be careful when copying, the Forum interpreted these expressions into "<" and ">"...

<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:sap="http://www.sap.com/sapxsl">

<xsl:strip-space elements="*"/>

<xsl:template match="/">

<xsl:text disable-output-escaping="yes">&lt;ACES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ACES_DLR.xsd"&gt;</xsl:text>
    <xsl:text disable-output-escaping="yes">&lt;RETURN ReturnType="DLR" ToolVer="1.0"&gt;</xsl:text>
        <xsl:text disable-output-escaping="yes">&lt;HEADER-DATA&gt;</xsl:text>
            <xsl:text disable-output-escaping="yes">&lt;RETURN-YEAR&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/RTNYEAR" />
            <xsl:text disable-output-escaping="yes">&lt;/RETURN-YEAR&gt;</xsl:text>
        <xsl:text disable-output-escaping="yes">&lt;/HEADER-DATA&gt;</xsl:text>
    <xsl:text disable-output-escaping="yes">&lt;/RETURN&gt;</xsl:text>
<xsl:text disable-output-escaping="yes">&lt;/ACES&gt;</xsl:text>


</xsl:template>

</xsl:transform>

2. In the Form I posted earlier, replace 'id' by your Transformation's name. Execute.

Result:

<?xml version="1.0" encoding="utf-8" ?> 
- <ACES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ACES_DLR.xsd">
- <RETURN ReturnType="DLR" ToolVer="1.0">
- <HEADER-DATA>
  <RETURN-YEAR>2009</RETURN-YEAR> 
  </HEADER-DATA>
  </RETURN>
  </ACES>

I only used the first element of your example. But with this, you can see how to nest your XML file the way it is desired and also how to access your data from the internal table, through XPATH-Expressions.

Because of the XPATH-Expression I wanted you to use the Transformation 'id' earlier. In your case, you only have one table, so it's easy, but in case you have deep structure within a deep structure within a deep strucutre with a ton of references, you'll probably end up not knowing how your table nests, so with Transformation 'id' you can simply look that up.

This should do it. Now you just have to get used to XSLT/XML

<< Point begging removed >>

best wishes, Lukas

Edited by: Lukas Weigelt on Oct 1, 2010 3:47 PM

Edited by: Lukas Weigelt on Oct 1, 2010 3:50 PM

Edited by: Lukas Weigelt on Oct 1, 2010 3:54 PM

Edited by: Rob Burbank on Oct 1, 2010 2:55 PM

Read only

0 Likes
3,200

Dear Lukas,

Thanks for your support.

As per your last reply I have created a new Transformation ZBEXRTN.

Though you have alerted me while copy the source code to a new Transformation, still I am not getting what to do with this error since I am new to xml.

Below is the Description of the Syntax error:

Transformation ZBEXRTN
XML parsing error (3002) in ZBEXRTN, line 9, column 157: end tag
'xsl:text' does not match begin tag 'ACES'

For your information; I have replaced "id" with "zbexrtn" in the form.

Please guide me as I thought I am nearer to some conclusion.

Warm Regards.

Read only

0 Likes
3,200

Hi Yogesh,

angle brackets which you want to be generated as output have to be expressed as "_&_l_t_;_" for "<" and "_&_g_t_;_" for ">" WITHOUT the quotes/underlines. As I said, when I write ampersand l t semicolon in forum it's interpreted as <, so the code I posted is messed up (maybe I'm doing something wrong, I don't know).

Anyway, you have to alter the code like:

<xsl:text disable-output-escaping="yes">AMPERSANDLOWERTHANSEMIKOLON/HEADER-DATAAMPERSANDGREATERTHANSEMIKOLON</xsl:text>

for every occurence of angle brackets of your custom elements.

Regards, Lukas

Read only

0 Likes
3,200

Dear Lukas,

I have done what you have suggested regarding Angle Brackets.

And now there is no syntax error in Transformation.

I have executed the program and a Runtime Error is arrived.

What can be the reason for the error.

FOLLOWING IS THE ERROR INFORMATION:

Runtime Errors         RAISE_EXCEPTION

Short text
    Exception condition "NO_XML_DOCUMENT" raised.

Source Code Extract
      create object g_xml_document.
      if g_xml_document->parse_xstring(
              stream = xml_string ) <> 0.
>>>>       raise NO_XML_DOCUMENT.
      endif.

Warm Regards.

Read only

0 Likes
3,200

Hi Yogesh,

the only possibility is a typo in the Transformation, because I should have the exact same as you and it works for me. Maybe you used &lt instead of &gt somewhere or forgot a semicolon or the like, check your XSLT code again.

best regards,

Lukas

Read only

0 Likes
3,200

Dear Lukas,

All &lt; and &gt; pair is ok.

I have tried to put my Transformation code here for your reference but I afraid you may not find it properly.

<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:sap="http://www.sap.com/sapxsl">

<xsl:strip-space elements="*"/>

<xsl:template match="/">

<xsl:text disable-output-escaping="yes">&lt;ACES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ACES_DLR.xsd"&gt;</xsl:text>

    <xsl:text disable-output-escaping="yes">&lt;RETURN ReturnType="DLR" ToolVer="1.0"&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;HEADER-DATA&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;RETURN-YEAR&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/RTNYEAR" />
            <xsl:text disable-output-escaping="yes">&lt;/RETURN-YEAR&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;QUARTER&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/QUARTER" />
            <xsl:text disable-output-escaping="yes">&lt;/QUARTER&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;DEALER-NAME&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/DLNAME" />
            <xsl:text disable-output-escaping="yes">&lt;/DEALER-NAME&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;REGISTRATION-NUMBER&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/DLREGNO" />
            <xsl:text disable-output-escaping="yes">&lt;/REGISTRATION-NUMBER&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;NIL-RETURN&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/No" />
            <xsl:text disable-output-escaping="yes">&lt;/NIL-RETURN&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;/HEADER-DATA&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;INVOICE-HEADER&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;INVOICE-PARTICULARS&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;SL-NO&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/DLINVSR" />
                <xsl:text disable-output-escaping="yes">&lt;/SL-NO&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;INVOICE-NUMBER&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/DLINVNO" />
                <xsl:text disable-output-escaping="yes">&lt;/INVOICE-NUMBER&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;INVOICE-DATE&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/DLINVDT" />
                <xsl:text disable-output-escaping="yes">&lt;/INVOICE-DATE&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;INVOICE-ITEMS&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;DESCRIPTION-OF-GOODS&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/DLGOODS" />
                    <xsl:text disable-output-escaping="yes">&lt;/DESCRIPTION-OF-GOODS&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;CETSH-NUMBER&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/DLCHAPID" />
                    <xsl:text disable-output-escaping="yes">&lt;/CETSH-NUMBER&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;QUANTITY-CODE&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/DLMEINS" />
                    <xsl:text disable-output-escaping="yes">&lt;/QUANTITY-CODE&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;QUANTITY&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/DLMENGE" />
                    <xsl:text disable-output-escaping="yes">&lt;/QUANTITY&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;AMOUNT-OF-DUTY-INVOLVED&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/DLEXBED" />
                    <xsl:text disable-output-escaping="yes">&lt;/AMOUNT-OF-DUTY-INVOLVED&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;/INVOICE-ITEMS&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;/INVOICE-PARTICULARS&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;/INVOICE-HEADER&gt;</xsl:text>


        <xsl:text disable-output-escaping="yes">&lt;DOCUMENT-HEADER&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;DOCUMENT-DETAIL&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;SL-NO&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRINVSR" />
                <xsl:text disable-output-escaping="yes">&lt;/SL-NO&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;INVOICE-BILL-ENTRY-NO&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRINVNO" />
                <xsl:text disable-output-escaping="yes">&lt;/INVOICE-BILL-ENTRY-NO&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;DATE&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRINVDT" />
                <xsl:text disable-output-escaping="yes">&lt;/DATE&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;ISSUED-BY&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/ISSUE" />
                <xsl:text disable-output-escaping="yes">&lt;/ISSUED-BY&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;REGISTRATION-NUMBER&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRREGNO" />
                <xsl:text disable-output-escaping="yes">&lt;/REGISTRATION-NUMBER&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;NAME&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRNAME" />
                <xsl:text disable-output-escaping="yes">&lt;/NAME&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;ADDRESS&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRADD" />
                <xsl:text disable-output-escaping="yes">&lt;/ADDRESS&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;INVOICE-ITEMS&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;DESCRIPTION-OF-GOODS&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/MRGOODS" />
                    <xsl:text disable-output-escaping="yes">&lt;/DESCRIPTION-OF-GOODS&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;CETSH-NUMBER&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/MRCHAPID" />
                    <xsl:text disable-output-escaping="yes">&lt;/CETSH-NUMBER&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;QUANTITY-CODE&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/MRMEINS" />
                    <xsl:text disable-output-escaping="yes">&lt;/QUANTITY-CODE&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;QUANTITY&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/MRMENGE" />
                    <xsl:text disable-output-escaping="yes">&lt;/QUANTITY&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;AMOUNT-OF-DUTY-INVOLVED&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/MREXBED" />
                    <xsl:text disable-output-escaping="yes">&lt;/AMOUNT-OF-DUTY-INVOLVED&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;/INVOICE-ITEMS&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;/DOCUMENT-DETAIL&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">lt;/DOCUMENT-HEADER&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;SELF-ASSESSMENT-MEMORANDAM&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;DATE&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/DATE" />
            <xsl:text disable-output-escaping="yes">&lt;/DATE&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;PLACE&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/PLACE" />
            <xsl:text disable-output-escaping="yes">&lt;/PLACE&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;REMARKS&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/REMAKRS" />
            <xsl:text disable-output-escaping="yes">&lt;/REMARKS&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;/SELF-ASSESSMENT-MEMORANDAM&gt;</xsl:text>

    <xsl:text disable-output-escaping="yes">&lt;/RETURN&gt;</xsl:text>

<xsl:text disable-output-escaping="yes">&lt;/ACES&gt;</xsl:text>

</xsl:template>

</xsl:transform>

Warm Regards.

Read only

0 Likes
3,200

Hi Yogesh,

Ampersand missing in closing Document-Header Tag

regards, Lukas

Read only

0 Likes
3,200

Dear Lukas,

Finally the output comes.

You have been such a good teacher for me.

As per you advice I have read more than 20 threads on the net and tried to learn how to code the XML, so also thanks for the advice and for your kind support too.

Questions remains though....

QUESTION No.(1)

Output comes for only one instance i.e. for One INVOICE-HEADER & One DOCUMENT-HEADER.

There are two types of data in my internal table, INVOICE-HEADER & DOCUMENT-HEADER, therefore I have to use IF condition on the basis of the field

DLINVSR (for invoice-header) (IF DEALER INVOICE NO IS NOT INITIAL)

and

MRINVSR (for document-header) (IF PURCHASE INVOICE NO IS NOT INITIAL).

( If the field DLINVSR is not initial then all the elements of DOCUMENT-HEADER should not be printed

and

if the field MRINVSR is not initial then all the elemtns of INVOICE-HEADER should not be printed)

Please guide me as to how I should apply IF condition.

QUESTION No.(2)

In the sample XML provided by the excise dept. there is en element like

<INVOICE-PARTICULARS SL-NO>

There is a space between the word INVOICE-PARTICULARS and SL-NO.

How can it be applied.

QUESTION No.(3)

I want to remove this sentence from the XML document

<?xml version="1.0" encoding="iso-8859-1" ?> 

QUESTION No.(4)

I don't want to repeat the element SELF-ASSESSMENT-MEMORANDAM., it must be at the last.

This is my present code of Transformation:


<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:sap="http://www.sap.com/sapxsl">

<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>

<xsl:strip-space elements="*"/>

<xsl:template match="/">

<xsl:text disable-output-escaping="yes">&lt;ACES&gt;</xsl:text>

    <xsl:text disable-output-escaping="yes">&lt;RETURN ReturnType="DLR" ToolVer="1.0"&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;HEADER-DATA&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;RETURN-YEAR&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/RTNYEAR" />
            <xsl:text disable-output-escaping="yes">&lt;/RETURN-YEAR&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;QUARTER&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/QUARTER" />
            <xsl:text disable-output-escaping="yes">&lt;/QUARTER&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;DEALER-NAME&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/DLNAME" />
            <xsl:text disable-output-escaping="yes">&lt;/DEALER-NAME&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;REGISTRATION-NUMBER&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/DLREGNO" />
            <xsl:text disable-output-escaping="yes">&lt;/REGISTRATION-NUMBER&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;/HEADER-DATA&gt;</xsl:text>

       <xsl:text disable-output-escaping="yes">&lt;INVOICE-HEADER&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;INVOICE-PARTICULARS&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/DLINVSR" />

                <xsl:text disable-output-escaping="yes">&lt;INVOICE-NUMBER&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/DLINVNO" />
                <xsl:text disable-output-escaping="yes">&lt;/INVOICE-NUMBER&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;INVOICE-DATE&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/DLINVDT" />
                <xsl:text disable-output-escaping="yes">&lt;/INVOICE-DATE&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;INVOICE-ITEMS&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;DESCRIPTION-OF-GOODS&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/DLGOODS" />
                    <xsl:text disable-output-escaping="yes">&lt;/DESCRIPTION-OF-GOODS&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;CETSH-NUMBER&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/DLCHAPID" />
                    <xsl:text disable-output-escaping="yes">&lt;/CETSH-NUMBER&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;QUANTITY-CODE&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/DLMEINS" />
                    <xsl:text disable-output-escaping="yes">&lt;/QUANTITY-CODE&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;QUANTITY&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/DLMENGE" />
                    <xsl:text disable-output-escaping="yes">&lt;/QUANTITY&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;AMOUNT-OF-DUTY-INVOLVED&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/DLEXBED" />
                    <xsl:text disable-output-escaping="yes">&lt;/AMOUNT-OF-DUTY-INVOLVED&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;/INVOICE-ITEMS&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;/INVOICE-PARTICULARS&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;/INVOICE-HEADER&gt;</xsl:text>


        <xsl:text disable-output-escaping="yes">&lt;DOCUMENT-HEADER&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;DOCUMENT-DETAIL&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;SL-NO&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRINVSR" />
                <xsl:text disable-output-escaping="yes">&lt;/SL-NO&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;INVOICE-BILL-ENTRY-NO&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRINVNO" />
                <xsl:text disable-output-escaping="yes">&lt;/INVOICE-BILL-ENTRY-NO&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;DATE&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRINVDT" />
                <xsl:text disable-output-escaping="yes">&lt;/DATE&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;ISSUED-BY&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/ISSUE" />
                <xsl:text disable-output-escaping="yes">&lt;/ISSUED-BY&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;REGISTRATION-NUMBER&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRREGNO" />
                <xsl:text disable-output-escaping="yes">&lt;/REGISTRATION-NUMBER&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;NAME&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRNAME" />
                <xsl:text disable-output-escaping="yes">&lt;/NAME&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;ADDRESS&gt;</xsl:text>
                    <xsl:value-of select="//ROOTTAG/item/MRADD" />
                <xsl:text disable-output-escaping="yes">&lt;/ADDRESS&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;INVOICE-ITEMS&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;DESCRIPTION-OF-GOODS&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/MRGOODS" />
                    <xsl:text disable-output-escaping="yes">&lt;/DESCRIPTION-OF-GOODS&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;CETSH-NUMBER&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/MRCHAPID" />
                    <xsl:text disable-output-escaping="yes">&lt;/CETSH-NUMBER&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;QUANTITY-CODE&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/MRMEINS" />
                    <xsl:text disable-output-escaping="yes">&lt;/QUANTITY-CODE&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;QUANTITY&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/MRMENGE" />
                    <xsl:text disable-output-escaping="yes">&lt;/QUANTITY&gt;</xsl:text>

                    <xsl:text disable-output-escaping="yes">&lt;AMOUNT-OF-DUTY-INVOLVED&gt;</xsl:text>
                        <xsl:value-of select="//ROOTTAG/item/MREXBED" />
                    <xsl:text disable-output-escaping="yes">&lt;/AMOUNT-OF-DUTY-INVOLVED&gt;</xsl:text>

                <xsl:text disable-output-escaping="yes">&lt;/INVOICE-ITEMS&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;/DOCUMENT-DETAIL&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;/DOCUMENT-HEADER&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;SELF-ASSESSMENT-MEMORANDAM&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;DATE&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/DATE" />
            <xsl:text disable-output-escaping="yes">&lt;/DATE&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;PLACE&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/PLACE" />
            <xsl:text disable-output-escaping="yes">&lt;/PLACE&gt;</xsl:text>

            <xsl:text disable-output-escaping="yes">&lt;REMARKS&gt;</xsl:text>
                <xsl:value-of select="//ROOTTAG/item/REMAKRS" />
            <xsl:text disable-output-escaping="yes">&lt;/REMARKS&gt;</xsl:text>

        <xsl:text disable-output-escaping="yes">&lt;/SELF-ASSESSMENT-MEMORANDAM&gt;</xsl:text>

    <xsl:text disable-output-escaping="yes">&lt;/RETURN&gt;</xsl:text>

<xsl:text disable-output-escaping="yes">&lt;/ACES&gt;</xsl:text>

</xsl:template>

</xsl:transform>

As this message exceeds the maximum length of characters, please see my next message for the sample XML provided by excise dept as per that I requires my XML output,in which you can actually understand my requirement.

Warm Regards.

Read only

0 Likes
3,200

And this is the sample XML in which I want my output:


- <ACES>
- <RETURN ReturnType="DLR" ToolVer="1.0">
- <HEADER-DATA>
  <RETURN-YEAR>2010</RETURN-YEAR> 
  <QUARTER>Apr-Jun</QUARTER> 
  <DEALER-NAME>VIN CHEMICALS</DEALER-NAME> 
  <REGISTRATION-NUMBER>ACAPG7657FXD002</REGISTRATION-NUMBER> 
  </HEADER-DATA>
- <INVOICE-HEADER>
- <INVOICE-PARTICULARS SL-NO="1">
  <INVOICE-NUMBER>1</INVOICE-NUMBER> 
  <INVOICE-DATE>20/04/2010</INVOICE-DATE> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>DODECYL BENZENE</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>29029030</CETSH-NUMBER> 
  <QUANTITY-CODE>KG</QUANTITY-CODE> 
  <QUANTITY>15120.00</QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>89797.00</AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </INVOICE-PARTICULARS>
- <INVOICE-PARTICULARS SL-NO="2">
  <INVOICE-NUMBER>2</INVOICE-NUMBER> 
  <INVOICE-DATE>20/04/2010</INVOICE-DATE> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>SODIUM TRIPOLY PHOSPHATE</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>28353100</CETSH-NUMBER> 
  <QUANTITY-CODE>GI F/S</QUANTITY-CODE> 
  <QUANTITY>10000.00</QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>33279.00</AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </INVOICE-PARTICULARS>
  </INVOICE-HEADER>
- <DOCUMENT-HEADER>
- <DOCUMENT-DETAIL SL-NO="1">
  <INVOICE-BILL-ENTRY-NO>77</INVOICE-BILL-ENTRY-NO> 
  <DATE>19/04/2010</DATE> 
  <ISSUED-BY>Manufacturer</ISSUED-BY> 
  <REGISTRATION-NUMBER>AAECA1210BXD001</REGISTRATION-NUMBER> 
  <NAME>ARDOR INTERNATIONAL PRIVATE LTD</NAME> 
  <ADDRESS>B/1001-1004,PREMIUM HOUSE AHMEDBAD</ADDRESS> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>DODECYL BENZENE</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>29029030</CETSH-NUMBER> 
  <QUANTITY-CODE>KG</QUANTITY-CODE> 
  <QUANTITY>15120.00</QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>89797.00</AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </DOCUMENT-DETAIL>
- <DOCUMENT-DETAIL SL-NO="2">
  <INVOICE-BILL-ENTRY-NO>78</INVOICE-BILL-ENTRY-NO> 
  <DATE>19/04/2010</DATE> 
  <ISSUED-BY>Manufacturer</ISSUED-BY> 
  <REGISTRATION-NUMBER>AAECA1210BXD001</REGISTRATION-NUMBER> 
  <NAME>ARDOR INTERNATIONAL PRIVATE LTD</NAME> 
  <ADDRESS>B/1001-1004,PREMIUM HOUSE AHMEDBAD</ADDRESS> 
- <INVOICE-ITEMS>
  <DESCRIPTION-OF-GOODS>DODECYL BENZENE</DESCRIPTION-OF-GOODS> 
  <CETSH-NUMBER>29029030</CETSH-NUMBER> 
  <QUANTITY-CODE>KG</QUANTITY-CODE> 
  <QUANTITY>10000.00</QUANTITY> 
  <AMOUNT-OF-DUTY-INVOLVED>33279.00</AMOUNT-OF-DUTY-INVOLVED> 
  </INVOICE-ITEMS>
  </DOCUMENT-DETAIL>
  </DOCUMENT-HEADER>
- <SELF-ASSESSMENT-MEMORANDAM>
  <DATE>30/09/2010</DATE> 
  <PLACE>SURAT</PLACE> 
  <REMARKS>TEST</REMARKS> 
  </SELF-ASSESSMENT-MEMORANDAM>
  </RETURN>
  </ACES>

Warm Regards.

Read only

0 Likes
3,200

Hi Yogesh,

glad I could help so far.

Concerning your questions:

1. I would use the choose-element instead of if-element. It would work like this:

<xsl:choose>
			
   <xsl:when test="//ROOTTAG/item/DLINVSR = ' '">
   output here
   </xsl:when>
   <xsl:otherwise>
   output here
   </xsl:otherwise>                
				
</xsl:choose>

Not sure whether the syntax works out like this, check w3schools for that.

2. SL-NO is an attribute of the element INVOICE-PARTICULARS. There are no spaces within Elements, it's forbidden. To select the values of the Attributes too, I'd do something like the following i guess.

<xsl:text disable-output-escaping="yes">&lt;ACES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ACES_DLR.xsd"&gt;</xsl:text>
    <xsl:text disable-output-escaping="yes">&lt;RETURN ReturnType="</xsl:text>
    <xsl:value-of select="//ROOTTAG/item/RTNTYPE" />
    <xsl:text disable-output-escaping="yes">" ToolVer="</xsl:text>
    <xsl:value-of select="//ROOTTAG/item/TOOLVER" />
    <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
    <xsl:text disable-output-escaping="yes">&lt;/RETURN&gt;</xsl:text>
<xsl:text disable-output-escaping="yes">&lt;/ACES&gt;</xsl:text>	

Maybe there is a more elegant way to do it, i don't know.

3. The XML-Prologue <?xml version="1.0" encoding="iso-8859-1" ?> is automatically generated by the Transformation. I saw some threads where this issue was discussed too...I can't guide you how to alter or remove it though.

4. I don't really understand the question. SELF-ASSESSMENT-MEMORANDAM is (as far as i see...) generated at the point where it is supposed to be according to your example.

regards,

Lukas

Read only

0 Likes
3,200

Dear Lukas,

Thanks for your quick response.

Just tell me why only the first record is displayed? what is missing in code to display all records?

Please guide me for the same.

Warm Regards.

Read only

0 Likes
3,200

Dear Lukas,

Please reply.

Warm Regards.

Edited by: Yogesh Pathak on Oct 19, 2010 2:10 PM

Read only

Former Member
0 Likes
3,200

you may try this

calling screen status module

SET PF-STATUS 'ZSTANDARD'.

Copy of 'STANDARD_FULLSCREEN' pf_status from SAPLKKBL

and goto se41 for copying , can delete not required buttons ,

without changinging standard fcodes.

sure you will achieve without programming logic

but it gives upto 90 fields(around)

Read only

0 Likes
3,200

Dear Friend,

Done as per you suggested, please elaborate more; how I can get XML as per my format.

Warm Regards.

Read only

Former Member
0 Likes
3,200

Dear Mr. Yogesh Pathak,

Our service 'e-filing of Central Excise registered Dealer' application allows customers to upload their data to ACES website. nt Provide your return data in excel format & we will generate XML file for you. We have done successfully e-Return from Software like Udyog Excise, Mircrobrain X-FA and SAP. It will cost you very minimum on per quater basis.

Regards

Rupesh Vardam

Manas Infotech, Mumbai

Cell : +91-9833662677