09-16-2015 5:31 AM
Hi ABAPers,
I am a functional consultant and i have bit knowledge of ABAP.
I am looking for a solution in SAP query.
Infoset query created with table EKPO and added one Z field in extras. This is value field. Now the requirement is wherever the value of Z field is more than 100,000, cell background should be highlighted in red colour. Output format is in ALV.
I wounder, if experts can help me to built up this query. Please help to give complete code.
Regards,
Kaushal Sharma
09-16-2015 10:03 AM
I too don't think you can manage the ALV layout from the Infoset definition.
Could you consider adding another column/field with an ICON type, by default initial value or some "green" type icon, and a "red" type icon when treeshold reached?
Regards,
Raymond
09-16-2015 5:53 AM
Hi,
Please have a look on below thread.
http://wiki.scn.sap.com/wiki/display/Snippets/Coloring+a+cell+in+an+ALV+conditionally
09-16-2015 6:42 AM
I don't think query output supports conditional formatting.
What you will have to do is save an excel-in-place layout and apply conditional formatting within excel.
Otherwise, go for a custom report.
In that case above solution will come in handy.
09-16-2015 7:34 AM
09-16-2015 10:03 AM
I too don't think you can manage the ALV layout from the Infoset definition.
Could you consider adding another column/field with an ICON type, by default initial value or some "green" type icon, and a "red" type icon when treeshold reached?
Regards,
Raymond
09-16-2015 11:12 AM
Hi Raymond,
Could you please guide how to acheive ICON type in sap query, with code sample?
09-16-2015 12:06 PM
Add another field (you did it already with your z-field) use data element ICON_D for example, to fill the value just add some
TYPE-POOLS: icon. " or use @xx@ codes from table ICON
IF warea-zfield1 GT 1000000.
MOVE icon_red_light TO warea-zfield2. " @0A@
ELSE.
MOVE icon_light_out TO warea-zfield2. " @EB@
ENDIF.
Regards,
Raymond
09-16-2015 1:18 PM
11-03-2015 1:02 PM
Good to know that it worked for you.
But its not working in my case.
I have added a new additional field (say ZICN) with LIKE Reference ICON-ID.
Added code as below:
TYPE-POOLS: icon. " or use @xx@ codes from table ICON
IF CNDH LT 100.
MOVE icon_red_light TO ZICN. " @0A@
ELSE.
MOVE icon_light_out TO ZICN. " @EB@
ENDIF.
But in vein.
Can you please guide me as to where I am making a mistake.
Hope for a reply.
Regards,
Chin2.
11-03-2015 2:28 PM
Hi Chitan,
Your code seems to be corrected but what about field CNDH field?
I did like to share information that there is two way to achieve this requirement.
1. Add extra field in infoquery and write code as mentioned in this blog.
2. Add local field Query (SQ01) and write mathematical formula and condition. This method is very simple to writing a code.
Regards,
Kaushal Sharma
11-05-2015 6:00 AM
Thank you so much for your response.
CNDH is my calculation field in my infoset query.
Since my query is having hell lot of coding part, I may not be able to shift it to SQ01.
Also, as you can see the code is almost same as what is mentioned in your case but still not working.
Would expect reply from other members as well or else will create a new thread.
Thanks Kaushal.
Regards,
Chin2.
11-05-2015 6:44 AM
Hi Chintan,
Though you have lot of coding in Infoset query, you need to have query (SQ01) to run the query so it is better to create local field in query and try to put your condition and formula.
11-05-2015 9:22 AM
Thank you so much for your time and response.
Actually, the code worked very well but there was certain error in updating the infoset field in query.
Now it is working like a Charm.
Thanks a lot for help.
Regards,
Chin2.