cancel
Showing results for 
Search instead for 
Did you mean: 

Resorting of components and display on WWI report

Former Member
0 Kudos

Hi,

we would like to display the ingredients of a compostion on a WWI report. We have implemented a user exit GEN_POSRG to change the sorting order of the ingredient before the output. The ingredients need to be displayed as a flow text separated by comma. Unfortunately the combination of both cases does not seem to be that easy. I tried to use two POS repeating groups (S:POS;1) and comma (S:POS;2-) to show the first ingredient and then in a loop all other ingredients with a preceeding comma. When attaching the user exit to both POS groups the first POS group wil lonly get the first ingredient instead of all. So the sorting does no work.

Any idea on how to solve this?

Regards, Michael

Accepted Solutions (0)

Answers (1)

Answers (1)

christoph_bergemann
Active Contributor
0 Kudos

Hello Michael

I did not catch your requirement. E.g. if you print the "hazardous ingredients" (the names of the ingredients) in a WWI document you use normal WWI techniques and need to use use this exit programming.

What do you are thinking of if your are using the term "sorting"? Do you try to figure out which ingridient is more "hazardnous" and the sort by this "criteria"? Something like that should not be done in WWI logic (possible but not receommended) Yout will never have a 1:1 relation of data in database and the data whcih is printed in the document. Normally something like this is not easy to understand from user perspective.

With best regards

C.B.

Former Member
0 Kudos

Hi,

by (re-)sorting I mean changing the order of the components e.g. according to its level in the product.

As an example: in the compositon in EH&S the components are stored in the following order: A, B, C, D. But on the WWI document I want them to be shown as "A, C, B, D". And the commas should be set as shown. No comma at the end.

My question is rather general how this problem can be solved using purely WWI layouting. And if it can be solved at all using just layouting functionality.

Regards, Michael

Ralph_P
Advisor
Advisor
0 Kudos

Hello Michael,

it might be possible to use a stack. Say you want to sort the ingredients based on their content, the component with the highest content in the mixture should come first. Try:

Initialize stack:

<11BRG001(M,SAP_EHS_1012_004;)><11BRG002(S:POS;)>

<01GESTVCOMPA(M:C14N_SYMBOL_STACK_NEW)[D:Value]>

<01GESTVCOMPA(M:C14N_SYMBOL_STACK_PUSH)[D:Value]>

Sort stack in descending order:

<01GESTVCOMPA(M:C14N_SYMBOL_STACK_SORT_DESC)[D:Value]>

<11ERG002><11ERG001>

If stack is not empty:

<13BNG005(*:01GESTVCOMPA(M:C14N_SYMBOL_STACK_TOP))>

Print highest value:

<11BRG006(M,SAP_EHS_1012_004;*)>

<11BRG007(S:POS;1)>

<01GESTVCOMPA(M:C14N_SYMBOL_STACK_TOP)>

<11ERG007>

Print all other values:

<11BRG008(S:POS;2-*)>

, <01GESTVCOMPA(M:C14N_SYMBOL_STACK_TOP)>

<11ERG008><11ERG006><13ENG005>

I haven't tested this code but it should work. Please note that the stack may in your system not be in name space C14N but rather in /TDAG/CS104 or ZISI104. You need to check this.

Good Luck,

Ralph

Edited by: Ralph Paczkowski on Mar 2, 2012 1:12 PM

Former Member
0 Kudos

Hi Ralph,

thanks for your hints. I never fully understood how this WWI stack story works....

But in the meantime I have managed to solve the problem using a global table and two user-exits (with parameters).

Thanks a lot a lot and kind regards, Michael

Ralph_P
Advisor
Advisor
0 Kudos

Hi Michael,

no sweat. The stack is not that complicated. Think of it as a variable into which you can write one or more values. You can then work with these values (e.g. sort them) and, at a later point time, write the values out of the stack into the template. That's basically it.

Ralph

Former Member
0 Kudos

Hi Ralph,

Thank you for providing the stack method. I also tried to sort the ingredients on the WWI report with the concentration in descending order. I've tried your stack code and it works well, however when I tried to output the component associate to the concentration, it's not working (obviously I don't know how) : only the concentration is in the correct order, the name and the CAS number order is unchanged.

<11BRG006(M,SAP_EHS_1012_004;*)>

<11BRG007(S:POS;*)>

  <01GESTRSUBID> - <01GESTVCOMPA(M:C14N_SYMBOL_STACK_TOP)> - <01GESTRIDENT(I:NUM,CAS,)> <01GESTVCOMPA(M:C14N_SYMBOL_STACK_POP)>

<11ERG007>

Is there anyway to order the all the information as an row? or stack more than one information and sort at the same time as a whole row?

Thank you.

Former Member
0 Kudos

Hi Michael,

I'm having the same issue as yours (it's a while back, hopefully you still remember). You had solved it with global table and two user-exits (with parameters) : the user-exits uses SAP existing function modules or you had to create customized function modules?

Thank you.

michael_schmalfeldt2
Participant
0 Kudos

Hi,

we made our own function modules.

It's not rocket science (as we are simple-minded people 😞 first we are filling an internal table defined in the TOP Include of the function group and then were are reading this table for output.

Kind regards, Michael

christoph_bergemann
Active Contributor
0 Kudos

Dear Tianna

I assume this:

you have a VAT with these components: (in this sequence in database)

A          10 %

B          70%

C          20%

Now you would likee to generate a kind of output as:

CAS number B          70%

CAS number C          20%

CAS Number A          10%

Nether tried it like that. But I believe that he methodology shown by Ralph should work; but not sure

If you take a look to answer of MIchael: yes there seems to be a solution; but a kind of complex one (

But in the meantime I have managed to solve the problem using a global table and two user-exits (with parameters).)

For such "simple" demands it is better to use "exits" in CG02. These exits can read data in property X chaneg the "sequence" of the data. Then the database and WWi report content are in"sync"

The WWI normally start with component 1, 2,3 ... and do the print in the "POS" group.

But you can try to use as well "other" exits. So user need not to go back to hitlist.. but as well: never tried it; there was never such kind of demand

C.B.

Former Member
0 Kudos

Thank you Micheal, we use the sort FM and it works.

Former Member
0 Kudos


Thank you Christoph, we use the exit with the FM to sort. It works well.