$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
0

How to get a number of lines of internal table within XML transformation

Dec 07, 2016 at 08:55 AM

51

avatar image

Hello experts,

let's say, I have a table with 5 lines (e.g. param.t_validation that represent some validations) and I need to generate the following XML:

<dataValidations count="5">

...
</dataValidations>

How to achieve this? Is there any operator or function that counts lines of tables?

<tt:s-cond check="not-initial(param.t_validation)">
<dataValidations>
<tt:attribute name="count" value-ref=???????????/>
</dataValidations>
</tt:s-cond>

Thank you,
Tomas

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Horst Keller
Dec 07, 2016 at 09:53 AM
3

You get the number of lines with the ABAP lines( ... ) function and write an XSLT or ST transformation or use an sXML or iXML method to serialize it and the internal table as you wish.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thank you for you replay Horst.

If I understood you correctly, such operator (LINES(..)) does not exit in the transformation itself and I have to somehow create it via some of the techniques which you describe.

Since I am new in this, you know where I could find for some more details/examples on how to do this?

Thanks, Tomas

0
Horst Keller
Dec 07, 2016 at 10:23 AM
0

Yep, in ST you can use tt:attribute.

See the documentation for many examples.

Horst

Share
10 |10000 characters needed characters left characters exceeded
Sandra Rossi Dec 07, 2016 at 02:00 PM
0

Other possibilities:

  • "count(node)" exists in XPATH and so can be used via XSLT, but anyway I don't advise using it as ST is much much faster than XSLT.
  • In ST, there's also call-method to execute ABAP code, but it sounds counter-performing.
Share
10 |10000 characters needed characters left characters exceeded