08-21-2020 7:16 AM
Hello,
I want to make the presence of 2 tags <COMP1> and <COMP2> conditioned by the value 'ID01' of another tag <ZLOGID> which is one level above.
And I've got a syntax error : "BL has no component BL_FIC".
Where is the problem please ?
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary" xmlns:def="http://www.sap.com/abapxml/types/defined">
<tt:root name="ROOT" type="?"/>
<tt:root name="BL_FILE" type="ddic:ZTT_XML_BL"/>
<tt:template>
<tt:loop ref=".BL_FILE">
<BL_FILE>
<ZLOGID tt:value-ref="BL_FIC.ZLOGID"/>
<tt:loop ref="BL">
<BL>
<BUKRS tt:value-ref="BL_HD.BUKRS"/>
<KUNZT tt:value-ref="BL_HD.KUNZT"/>
<tt:s-cond check="(BL_HD.KUNZT)='T036' or (BL_HD.KUNZT)='T037'">
<BL_INFO_PR>
<ZPR_NAME tt:value-ref="BL_HD.ZPR_NAME"/>
</BL_INFO_PR>
</tt:s-cond>
<tt:s-cond check="(BL_FIC.ZLOGID)='ID01'">
<COMP1 tt:value-ref="BL_HD.ZCOMP1"/>
<COMP2 tt:value-ref="BL_HD.ZCOMP2"/>
</tt:s-cond>
<tt:loop ref="BL_LN">
<BL_POSTE>
<POSNR tt:value-ref="POSNR"/>
<MATNR tt:value-ref="MATNR"/>
</BL_POSTE>
</tt:loop>
</BL>
</tt:loop>
</BL_FILE>
</tt:loop>
</tt:template>
</tt:transform>
08-21-2020 7:16 AM
Hi and welcome to the SAP Community!
Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't already), as it provides tips for preparing questions that draw responses from our members. For example, you can outline what steps you took to find answers (and why they weren't helpful), share screenshots of what you've seen/done, make sure you've applied the appropriate tags, and use a more descriptive subject line. The more details you provide, the more likely it is that members will be able to assist you.
Should you wish, you can revise your question by selecting Actions, then Edit (although once someone answers your question, you'll lose the ability to edit the question -- but if that happens, you can leave more details in a comment).
Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS. By personalizing your profile with a photo of you, you encourage readers to respond.
Cheers,
Julia
SAP
Community Moderator
08-21-2020 7:47 AM
08-21-2020 7:51 AM
I guess the syntax error is at this line:
<tt:s-cond check="(BL_FIC.ZLOGID)='ID01'">
The issue is that BL_FIC is taken from BL_FILE.BL, but you want to take it from BL_FILE. The classic solution is to use the "tt:name" attribute:
<tt:loop ref=".BL_FILE" name="bl_file"> <=========== + name="bl_file"
<BL_FILE>
<tt:loop ref="BL">
<BL>
<tt:s-cond check="$bl_file.BL_FIC.ZLOGID='ID01'"> <====== $bl_file
11-03-2020 3:59 PM
11-03-2020 4:17 PM