2011 Jan 04 4:38 AM
Hi all,
My requirement is to download the ALV output into XML based on the variant.
For example: If my ALV displays 3 fields in the output,only those field's information should be displayed in the downloaded XML file.
Your suggestions would be really valuable.
Thanks..
What kind of dynamic programming? Could you please give me an example?
Thanks
2011 Jan 04 4:43 AM
Howdy,
To determine what changes to the variant have been made, you need to get the frontend fieldcatalog of the ALV so that you know which fields are hidden etc (method CL_GUI_ALV_GRID->GET_FRONTEND_FIELDCATALOG). You then also have to check which entries have been filtered out (method CL_GUI_ALV_GRID->GET_FILTERED_ENTRIES).
Once you have the field catalog you will have to do some dynamic programming to build your XML, particularly to skip over the columns that are hidden.
Hope this helps to get you started.
Cheers
Alex
2011 Jan 04 5:59 AM
What kind of dynamic programming? Could you please give me an example?
Thanks
2011 Jan 04 6:20 AM
For example say your ALV output table is gt_output, and the frontend field catalog is gt_fcat:
FIELD-SYMBOLS: <field> type any.
loop at gt_output assigning <output>.
loop at gt_fcat assigning <fcat> where tech eq abap_false and no_out eq abap_false. "Ignore hidden entries
assign component <fcat>-fieldname of structure <output> to <field>.
"Now write the field to your XML structure.
endloop.
endloop.
Alternatively you can build the output into an internal table with a key-value pair eg FIELDNAME and VALUE and then use a Simple transformation to convert to XML - personally this might be a better way to go if you know transformations.
Cheers
Alex
Edited by: Alex Cook on Jan 4, 2011 4:51 PM
Tidied up code - XML write isn't working
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |