Skip to Content

Generating XML from internal table

All,

I have a requirement where we need to generate XML file from an internal table. I have been successful to generate that but now they want the xml in a different format. I am having difficulty to do so.

I am also able to generate similar format but am not able to close ZMAM_RUN_TYPE at the top. I am able to do it at the end.

Requirement

- <sap:ZMAM_BCC_PUBDATE_GETLIST xmlns:sap="urn:sap-com:document:sap:rfc:functions.response">
  <NO_UPSELL_MARK /> 
  <ZMAM_RUN_TYPE>jobs</ZMAM_RUN_TYPE> 
- <ZMAM_BCC_LIST>
- <item>
  <AVM_NR>0010249901</AVM_NR> 
  <POS_NR>030</POS_NR> 
  <EIN_NR>000001</EIN_NR> 
  <INHK_KFM>PAJUP</INHK_KFM> 
  <BELEGEINH>PAJFRZ</BELEGEINH> 
  <PSTYV>ZSTD</PSTYV> 
  <GPAG>2010012045</GPAG> 
  <INSERENT>2010012045</INSERENT> 
  <REGULIERER>2010012045</REGULIERER> 
  <GPNR_RECH>2010012045</GPNR_RECH> 
  <S_TERMIN>2011-11-06</S_TERMIN> 
  <E_TERMIN>2011-12-05</E_TERMIN> 
  <MOTIV>000001</MOTIV> 
  <MOTIVID>100000220557</MOTIVID> 
  <AZART_GEST>0003</AZART_GEST> 
  <CHIFFRE_NR /> 
  <ZZPICCNT>00</ZZPICCNT> 
  <AENDATE>0000-00-00</AENDATE> 
  <AENTIME>00:00:00</AENTIME> 
  </item>
+ <item>
  <AVM_NR>0010249944</AVM_NR> 
  <POS_NR>020</POS_NR> 
  <EIN_NR>000001</EIN_NR> 
  <INHK_KFM>PAJUP</INHK_KFM> 
  <BELEGEINH>PAJFRZ</BELEGEINH> 
  <PSTYV>ZSTD</PSTYV> 
  <GPAG>2010012056</GPAG> 
  <INSERENT>2010012056</INSERENT> 
  <REGULIERER>2010012056</REGULIERER> 
  <GPNR_RECH>2010012056</GPNR_RECH> 
  <S_TERMIN>2011-12-04</S_TERMIN> 
  <E_TERMIN>2012-01-02</E_TERMIN> 
  <MOTIV>000001</MOTIV> 
  <MOTIVID>100000220594</MOTIVID> 
  <AZART_GEST>0003</AZART_GEST> 
  <CHIFFRE_NR /> 
  <ZZPICCNT>00</ZZPICCNT> 
  <AENDATE>0000-00-00</AENDATE> 
  <AENTIME>00:00:00</AENTIME> 
  </item>
+ <item>
  <AVM_NR>0010250017</AVM_NR> 
  <POS_NR>020</POS_NR> 
  <EIN_NR>000001</EIN_NR> 
  <INHK_KFM>PAJUP</INHK_KFM> 
  <BELEGEINH>PAJFRZ</BELEGEINH> 
  <PSTYV>ZSTD</PSTYV> 
  <GPAG>1010143394</GPAG> 
  <INSERENT>1010143394</INSERENT> 
  <REGULIERER>1010143394</REGULIERER> 
  <GPNR_RECH>1010143394</GPNR_RECH> 
  <S_TERMIN>2011-11-27</S_TERMIN> 
  <E_TERMIN>2011-12-26</E_TERMIN> 
  <MOTIV>000001</MOTIV> 
  <MOTIVID>100000220711</MOTIVID> 
  <AZART_GEST>0003</AZART_GEST> 
  <CHIFFRE_NR /> 
  <ZZPICCNT>00</ZZPICCNT> 
  <AENDATE>0000-00-00</AENDATE> 
  <AENTIME>00:00:00</AENTIME> 
  </item>
+ <item>
  <AVM_NR>0010250053</AVM_NR> 
  <POS_NR>020</POS_NR> 
  <EIN_NR>000001</EIN_NR> 
  <INHK_KFM>PAJUP</INHK_KFM> 
  <BELEGEINH>PAJFRZ</BELEGEINH> 
  <PSTYV>ZSTD</PSTYV> 
  <GPAG>2010012064</GPAG> 
  <INSERENT>2010012064</INSERENT> 
  <REGULIERER>2010012064</REGULIERER> 
  <GPNR_RECH>2010012064</GPNR_RECH> 
  <S_TERMIN>2011-11-27</S_TERMIN> 
  <E_TERMIN>2011-12-26</E_TERMIN> 
  <MOTIV>000001</MOTIV> 
  <MOTIVID>100000220733</MOTIVID> 
  <AZART_GEST>0003</AZART_GEST> 
  <CHIFFRE_NR /> 
  <ZZPICCNT>00</ZZPICCNT> 
  <AENDATE>0000-00-00</AENDATE> 
  <AENTIME>00:00:00</AENTIME> 
  </item>
+ <item>
  <AVM_NR>0010250511</AVM_NR> 
  <POS_NR>020</POS_NR> 
  <EIN_NR>000001</EIN_NR> 
  <INHK_KFM>PAJUP</INHK_KFM> 
  <BELEGEINH>PAJFRZ</BELEGEINH> 
  <PSTYV>ZSTD</PSTYV> 
  <GPAG>2010011719</GPAG> 
  <INSERENT>2010011719</INSERENT> 
  <REGULIERER>2010011719</REGULIERER> 
  <GPNR_RECH>2010011719</GPNR_RECH> 
  <S_TERMIN>2011-12-04</S_TERMIN> 
  <E_TERMIN>2012-01-02</E_TERMIN> 
  <MOTIV>000001</MOTIV> 
  <MOTIVID>100000220922</MOTIVID> 
  <AZART_GEST>0003</AZART_GEST> 
  <CHIFFRE_NR /> 
  <ZZPICCNT>00</ZZPICCNT> 
  <AENDATE>0000-00-00</AENDATE> 
  <AENTIME>00:00:00</AENTIME> 
  </item>
+ <item>
  <AVM_NR>0010250512</AVM_NR> 
  <POS_NR>010</POS_NR> 
  <EIN_NR>000001</EIN_NR> 
  <INHK_KFM>00004899</INHK_KFM> 
  <BELEGEINH>PAJFRZ</BELEGEINH> 
  <PSTYV>ZSTD</PSTYV> 
  <GPAG>2010011719</GPAG> 
  <INSERENT>2010011719</INSERENT> 
  <REGULIERER>2010011719</REGULIERER> 
  <GPNR_RECH>2010011719</GPNR_RECH> 
  <S_TERMIN>2011-12-04</S_TERMIN> 
  <E_TERMIN>2012-01-02</E_TERMIN> 
  <MOTIV>000001</MOTIV> 
  <MOTIVID>100000220923</MOTIVID> 
  <AZART_GEST>0003</AZART_GEST> 
  <CHIFFRE_NR /> 
  <ZZPICCNT>00</ZZPICCNT> 
  <AENDATE>0000-00-00</AENDATE> 
  <AENTIME>00:00:00</AENTIME> 
  </item>
  </ZMAM_BCC_LIST>
  </sap:ZMAM_BCC_PUBDATE_GETLIST>

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Dec 28, 2011 at 04:22 PM

    I am getting out put in the following format.

    <?xml version="1.0" ?> 
    - <ZMAM_BCC_PUBDATE_GETLIST>
    - <ZMAM_RUN_TYPE>
      REAL_ESTATE 
    - <ZMAM_BCC_LIST>
    - <item>
      <AVM_NR>0010262705</AVM_NR> 
      <POS_NR>010</POS_NR> 
      <EIN_NR>000012</EIN_NR> 
      <INHK_KFM>1142GTWN</INHK_KFM> 
      <BELEGEINH>OL7CLSRE</BELEGEINH> 
      <PSTYV>ZSTD</PSTYV> 
      <GPAG>1000004824</GPAG> 
      <INSERENT>1000004824</INSERENT> 
      <REGULIERER>1000004824</REGULIERER> 
      <GPNR_RECH>1000004824</GPNR_RECH> 
      <S_TERMIN>20110129</S_TERMIN> 
      <E_TERMIN>20110204</E_TERMIN> 
      <MOTIV>000001</MOTIV> 
      <MOTIVID>100000377005</MOTIVID> 
      <AZART_GEST>0003</AZART_GEST> 
      <CHIFFRE_NR /> 
      <ZZPICCNT>00</ZZPICCNT> 
      <AENDATE>00000000</AENDATE> 
      <AENTIME>000000</AENTIME> 
      </item>
    + <item>
      <AVM_NR>0010262706</AVM_NR> 
      <POS_NR>010</POS_NR> 
      <EIN_NR>000002</EIN_NR> 
      <INHK_KFM>1142AUPK</INHK_KFM> 
      <BELEGEINH>OL7CLSRE</BELEGEINH> 
      <PSTYV>ZSTD</PSTYV> 
      <GPAG>1000004824</GPAG> 
      <INSERENT>1000004824</INSERENT> 
      <REGULIERER>1000004824</REGULIERER> 
      <GPNR_RECH>1000004824</GPNR_RECH> 
      <S_TERMIN>20110129</S_TERMIN> 
      <E_TERMIN>20110204</E_TERMIN> 
      <MOTIV>000001</MOTIV> 
      <MOTIVID>100000377012</MOTIVID> 
      <AZART_GEST>0003</AZART_GEST> 
      <CHIFFRE_NR /> 
      <ZZPICCNT>00</ZZPICCNT> 
      <AENDATE>00000000</AENDATE> 
      <AENTIME>000000</AENTIME> 
      </item>
    + <item>
      <AVM_NR>0010262707</AVM_NR> 
      <POS_NR>010</POS_NR> 
      <EIN_NR>000002</EIN_NR> 
      <INHK_KFM>00001117</INHK_KFM> 
      <BELEGEINH>OL7CLSRE</BELEGEINH> 
      <PSTYV>ZSTD</PSTYV> 
      <GPAG>1000004824</GPAG> 
      <INSERENT>1000004824</INSERENT> 
      <REGULIERER>1000004824</REGULIERER> 
      <GPNR_RECH>1000004824</GPNR_RECH> 
      <S_TERMIN>20110130</S_TERMIN> 
      <E_TERMIN>20110205</E_TERMIN> 
      <MOTIV>000001</MOTIV> 
      <MOTIVID>100000377013</MOTIVID> 
      <AZART_GEST>0003</AZART_GEST> 
      <CHIFFRE_NR /> 
      <ZZPICCNT>00</ZZPICCNT> 
      <AENDATE>00000000</AENDATE> 
      <AENTIME>000000</AENTIME> 
      </item>
    + <item>
      <AVM_NR>0010262726</AVM_NR> 
      <POS_NR>010</POS_NR> 
      <EIN_NR>000013</EIN_NR> 
      <INHK_KFM>1157BETH</INHK_KFM> 
      <BELEGEINH>OL7CLSRE</BELEGEINH> 
      <PSTYV>ZSTD</PSTYV> 
      <GPAG>1000000810</GPAG> 
      <INSERENT>1000000810</INSERENT> 
      <REGULIERER>1000000810</REGULIERER> 
      <GPNR_RECH>1000000810</GPNR_RECH> 
      <S_TERMIN>20110129</S_TERMIN> 
      <E_TERMIN>20110204</E_TERMIN> 
      <MOTIV>000001</MOTIV> 
      <MOTIVID>100000377208</MOTIVID> 
      <AZART_GEST>0003</AZART_GEST> 
      <CHIFFRE_NR /> 
      <ZZPICCNT>00</ZZPICCNT> 
      <AENDATE>00000000</AENDATE> 
      <AENTIME>000000</AENTIME> 
      </item>
    + <item>
      <AVM_NR>0010262730</AVM_NR> 
      <POS_NR>020</POS_NR> 
      <EIN_NR>000012</EIN_NR> 
      <INHK_KFM>1142DUP</INHK_KFM> 
      <BELEGEINH>OL7CLSRE</BELEGEINH> 
      <PSTYV>ZMKD</PSTYV> 
      <GPAG>1000000810</GPAG> 
      <INSERENT>1000000810</INSERENT> 
      <REGULIERER>1000000810</REGULIERER> 
      <GPNR_RECH>1000000810</GPNR_RECH> 
      <S_TERMIN>20110129</S_TERMIN> 
      <E_TERMIN>20110204</E_TERMIN> 
      <MOTIV>000002</MOTIV> 
      <MOTIVID>100000377212</MOTIVID> 
      <AZART_GEST>0003</AZART_GEST> 
      <CHIFFRE_NR /> 
      <ZZPICCNT>00</ZZPICCNT> 
      <AENDATE>00000000</AENDATE> 
      <AENTIME>000000</AENTIME> 
      </item>
    + <item>
      <AVM_NR>0010264436</AVM_NR> 
      <POS_NR>010</POS_NR> 
      <EIN_NR>000010</EIN_NR> 
      <INHK_KFM>1157MONT</INHK_KFM> 
      <BELEGEINH>OL7CLSRE</BELEGEINH> 
      <PSTYV>ZSTD</PSTYV> 
      <GPAG>1000002073</GPAG> 
      <INSERENT>1000002073</INSERENT> 
      <REGULIERER>1000002073</REGULIERER> 
      <GPNR_RECH>1000002073</GPNR_RECH> 
      <S_TERMIN>20110716</S_TERMIN> 
      <E_TERMIN>20110722</E_TERMIN> 
      <MOTIV>000001</MOTIV> 
      <MOTIVID>100000380160</MOTIVID> 
      <AZART_GEST>0003</AZART_GEST> 
      <CHIFFRE_NR /> 
      <ZZPICCNT>00</ZZPICCNT> 
      <AENDATE>00000000</AENDATE> 
      <AENTIME>000000</AENTIME> 
      </item>
      </ZMAM_BCC_LIST>
      </ZMAM_RUN_TYPE>
      </ZMAM_BCC_PUBDATE_GETLIST>

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.