Abap Material

SAP Community SAPModerator Spotlight Eli Klovski. Moderator Spotlight is the community teams way of showing our appreciation to the most distinguished SAP Community moderators. Eli Klovski  has been selected for this quarters Moderator Spotlight as he is an enthusiastic, supportive and caring moderator. Eli is a moderator for FIN Finance, FIN Asset Accounting, FIN Controlling, FIN Financial, Supply Chain Management FIN Treasury Public Sector. Generate Simple Transformation for XML in ABAP Part II Passionate about SAP. Just wanted to quickly add some more information to my last post on the same topic Discovering a Hidden Gem Generate Simple Transformation for XML in ABAPIn this example, I will show how to use  Edit Simple Transformation Graphically feature of XSLTTOOL to generate simple transformations for XML elements having attributes. 4X4 Games Pc. Lets say there is a requirement to generate XML document from the ABAP data internal tables. Abap Materialmaintaindark Error ListSAP ABAP is the default programming language for SAP applications. SAP ABAP training course inclass and online by certified instructors. Click for more. And the resultant XML document should have the following structure. Basically, POSTCODE should be an attribute of Town element. New. Dataset lt Table lt Town POSTCODEB5 BIRMINGHAMlt Town lt County WARWICKlt County lt Table lt Table lt Town POSTCODENP2. NEWPORTlt Town lt County WALESlt County lt Table lt New. Abap Material DescriptionAbap MaterialMARC is an SAP Table used to store Plant Data for Material information. Includes field list, ABAP code, relation to other tables etc. Dataset Initial steps are similar to the example in my last post so Ive just copied the screen shots from there Create Table Type ZNEWDATASET in transaction SE1. The hierarchy structure should be compatible with the XML hierarchy. Now create the ST program in transaction XSLTTOOL. Spot the magic stick in the editor menu. Click on Edit Simple Transformation Graphically button magic stick and you will get the editor as below. Create a new root right click context menu in Data Roots section. Ive named it NEWDATASET but the important thing is to enter the correct type, created earlier. Now you can see the data root hierarchy as below. Drag and Drop the NEWDATASET root on right panel Simple Transfromation. It automaically generates the ST nodes corresponding to the ABAP structure. However, you need to adjust the names as per the XML element names. Now adjust the names in ST panel as per actual XML element names. Delete the Post. Code element as we need this as an attribute of Town, rather than an element. Important thing to remember Always use SAVE before adding, deleting or modifying nodes. Otherwise you will face errors during node operations. Select node Town, and then click on First Child button at the top toolbar. Further, use right click to get the conext menu for Town element and create a new attribute POSTCODE. Now drag the POSTCODE from left panel data to right panel on the POSTCODE attribute to create association. The index numbers shows the association between data nodes and xml nodes. Save and Activate. The ST program ZRAMTESTATTR1, generated by the utility, is as below lt NEWDATASET typeddic ZNEWDATASET lt tt template lt New. Data. Set lt tt loop ref. NEWDATASET lt Table lt Town                                     lt County tt value refCOUNTY lt Table lt tt loop lt New. Data. Set lt tt template lt tt transform Example ABAP code to call the transformation is as below REPORT zramabaptoxml. DATA ltsource TYPE znewdataset. LIKE LINE OF ltsource. TYPE xstring. xstring ensures UTF 8 encoding. BIRMINGHAM. wasource county WARWICK. B5. APPEND wasource TO ltsource. NEWPORT. wasource county WALES. Vreveal Premium License Key there. NP2. 0. APPEND wasource TO ltsource. CALL TRANSFORMATION zramtestattr. SOURCE newdataset ltsource. RESULT XML xmlresult. CALL FUNCTION SCOLTRACESHOWXML. In case you want  help on how to download the XML documents etc, please check the standard example transaction SSTDEMO1.