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

creating self xml file from abap code

former_member445510
Active Participant
0 Likes
706

Hello,

I want to create self XML file to the base on table BKPF  BSEG and BSET as following:

I know the "call transformation ('ID')", but with this abap code, i can not create a flexible tags....<....> </.....>.

Please can some one help me?

2 REPLIES 2
Read only

hendrik_brandes
Contributor
0 Likes
514

Hello,

I would suggest to use XSLT or Simple-Transformations (ST) (in case you are not so familar with XSL I would prefere ST). Create a new transformation and match this with your own tags:

DATA:

  l_xml type string,

  lt_bkpf     type table of bkpf,

  lt_bseg     type table of bseg,

  lt_bset    type table of bset.

CALL TRANSFORMATION yreporting_new

  SOURCE BKPF = lt_bkpf

                BSEG = lt_bseg

                 BSET = lt_bset

  RESULT XML l_xml.

And the transformation ( goto XSLT_TOOL 😞

 

<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

<!-- called by SSTDEMO_FLBOOKINGS -->

<tt:root name="BKPF"/>

<tt:root name="BSEG"/>

<tt:root name="BSET"/>

<tt:template>

<reportingdocument>

  <reporterid>...</reporterid>

<tt:loop ref=“BKPF“ name=“line“>

      <invoicedocument>

<tt:loop ref=“BSEG“ name=“bsegline“>

  <tt:cond check="$line.ID = $bseg.line.ID">

      <VATNumber>

...

      </VATNumber>

</tt:loop>

      </invoicedocument>

</tt:loop>

  </tt:ref>

</reportingdocument>

</tt:template>

</tt:transform>

Remark: This is only a schema not the solution. There will be a lot more, for running this, but there are some good examples in the system and the documentation is your friend:

http://help.sap.com/saphelp_nw73/helpdata/en/e3/7d4719ca581441b6841f1054ff1326/frameset.htm

Kind regards and have fun,

Hendrik

Read only

Former Member
0 Likes
514

Hi Ouail,

i would suggest you to store the data in an internal table and then write data into xml format.

Kindly go through the following link ,it may help you.

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

Hope it helps!!!!

Regards,

Alora