Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

conditional formating of cell into SAP query infoset

kaushal_sharma
Active Participant
0 Kudos

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

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

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

12 REPLIES 12

former_member196331
Active Contributor

Former Member
0 Kudos

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.

0 Kudos

Thankx to all.

raymond_giuseppi
Active Contributor
0 Kudos

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

0 Kudos

Hi Raymond,

Could you please guide how to acheive ICON type in sap query, with code sample?

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

0 Kudos

Thankx Raymond issue is resolved.

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.




0 Kudos

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

0 Kudos

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.

0 Kudos

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.

0 Kudos

Kaushal Sharma

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.