cancel
Showing results for 
Search instead for 
Did you mean: 

change switch graphic in transaction CG42 in user-exit

Former Member
0 Kudos
427

Hi,

we would like to print labels. The information, which should be printed on the label are specification symbols.

The graphics, which are maintained in phrases are available in the directory ....SAP\frontend\sap_gui\wwi\graphics and should be printed also.

Now my client like to change/switch the pathname of the graphic only for this label ...

e.g.

original pathname:

SAP\frontend\sap_gui\wwi\graphics\picture_old.bmp

to new:

SAP\frontend\sap_gui\wwi\graphics\picture_new.bmp

The other forms, sops, labels, ... should use the old standard graphics, only the new label should use the new graphics.

(The new graphics are little bit different to the standard graphics.)

The aim is to change the graphic without changing the masterdata of the specification.

Can this be done in the user-exit of the repeating group or by a condition in the sourcecode ?

Thanks,

Manu.

Accepted Solutions (0)

Answers (3)

Answers (3)

christoph_bergemann
Active Contributor
0 Kudos

Dear Manual

a lot of proposals have been provided.Still my greatest dought for a soluzion is the "condition". Only if you have a logic like:

a.) for material number 1 print graphic1 else graphic 2

b.) for sales organisation 1 print graphic1 else graphic 2

c.) for plant 1 print graphic1 else graphic 2

and so on you will get a solution.

Coming back to your statement:

"Now my client like to change/switch the pathname of the graphic only for this label ..."


If we can define the term "label" as the "generation variant" of the report you will get a solution (but then any of the propsals above are only a strating point; you would then need customer specific additional symbols). May be using LABELSTOCK application object and other GLM topics you have "additional" parameters


Can you may be provide feedback if you have now found a solution?


C.B.

Former Member
0 Kudos

Dear all, i too needed this functionality.

There are more ways to achieve the same, but i think it's nicest to create a separate function module for this. The Fm should indeed as C.B. mentions have the signature as the other C14N functions.

In the end you would need functionality similar to FM's:

  • C14N_SYMBOL_STACK_PUSH
  • HM51_SYMBOL_DG_LABEL_GRAPHIC


C14N_SYMBOL_STACK_PUSH: shows how to read data from the symbol/phrase itself.

HM51_SYMBOL_DG_LABEL_GRAPHIC: shows how to set the output to a file (graphic): val_type = 3 and filep holds image path and file.


In your own function module, you should be able to re-create this process and apply your own programming logic to determine what pictogram should be outputted.

In my case I used Fm C12J_REPGEN_GET to read the Generation Variant info to base my output on.

To output on the label, just use the symbol you want and select output method M as Manuel Wichert has posted. Needless to say, the retrieved phrase must have a symbol attached or the FM will have to add it.

BR, Mat

Mark-Pfister
Active Contributor
0 Kudos

Hello,

filep holds image path and file.


The file name is enough if the file is located in the default graphics folder of WWI -> no need for the path.


Copy template for symbol methods is: "C14N_SYMBOL_METHOD".


Greets


Mark

christoph_bergemann
Active Contributor
0 Kudos

Dear Manuel

normally the WWI set up is like this:

a.) you have a local WWI

b.) you have generation server WWI farm

To retrieve picture symbols as in your example normally a phrase is used and the graphic is "linked in the "gaphic" part of the phrase (per language). In the phrase you need to specify if i remember correct the "file" name. Now you have the issue (if I understand your demand correct) that you would need two phrases which need to maintained properly in a value assignment which you then need to retrive in WWI. Normally here you would use different ratings to make sure that per WWI report the "wished" value assignment data record is retrieved leading to "picture_new" instead of "picture_old".

E.g. you could use phrase in a value assigment 1 linked to graphic1 and create data record with rating "Label1" and you could use a phrase 2 linke to graphic2 with ratin "label2"; now you need only to specify your generation variant properly. Generation variant1 would use rating "label1" and generation variant2 would use rating "lable2". In doing so you avoid any WWI logic.

In any case: you need a logic so that the WWI template can retrieve the right symbol. I have never used the user-exit nor a condition in layout; my assumption would be: might be possible, but i have some doubt that the "end user" will understand what is going on (why WWI layout is retrieving picutre one instead of picutre two). The condition need to be "very" clear to retrieve the right graphic. I have no idea which condition you are thinking about to be used (your symbol is a GHS Symbol)

Regarding WWI: if you have a local WWI you need to distribute the graphic to all local clients. If it us sufficient that any the raw report is supported you need to distribute the ghaphic to all generation servers

C.B.

PS: may be close yor parallel thread: http://scn.sap.com/thread/3327380

Former Member
0 Kudos

Hi Christoph,

thanks for reply :-).

e.g.

the specification a has two graphics picture_1, picture_2

the specification b has three graphics picture_1, picture_3, picture_4

These graphics should appear on the label.

I do not know which graphic and the number of graphics because the specifications are different among themselves .. and there are a lot of specifications in the system.

I only know, if in the specification the picture_1 and picture_2 is linked it should be replaced by

picture_1_new and picture_2_new.

The client don't want to change masterdata of the specifications.

The easiest way is it to make a new phrase linked to the new picture. Link the new phrase to the specification, then I can use it in CG42 similar to the original GHS Symbol, but this is not required by the client.

The question is ... how can I map the old to the new ?

The condition should be as followed.

If phrase-graphic = 'picture_1'.

phrase-graphic = 'picture_1_new'.

endif.

If phrase-graphic = 'picture_2'.

phrase-graphic = 'picture_2_new'.

endif.

Parallel thread closed---thanks.

christoph_bergemann
Active Contributor
0 Kudos

Dear Manuel

may be I did not understand your demand correct. I have had the impression that you have graphic1 and in graphic2 and in same labels graphic1 should show up and in other ones grachic2 without changing masterdata.

This is a "case by case" decision. If you need "global" change you could simply modify/adapt the phrase. The issue comes up by the demand of the customer:

"Now my client like to change/switch the pathname of the graphic only for this label ..."

The issue is the "condition" you need to define. By using special report symbols you could try to check the "generation variant" in WWI layout used to generate the label. Now if generation variant is generation variant1 may be you succeed to retrieve graphic1 and if generation variant is generation variant2  you would retrieve graphic2. Nether tried it this way; but might be an option.

There has been a "similar" thread in this FORUM. Please check this: http://scn.sap.com/thread/1400700

C.B.

Former Member
0 Kudos

Hi Christoph,

this is exactly what I need. Thanks a lot.

Do know, how and especially where can I create a new symbol method ?

Is it possible to send you an email directly ?

Former Member
0 Kudos

Deal Manuel,

After going thru your thread, there are couple of issues to be discussed.

1. Place holder for the pictures -

a. Here, business would like to continue with the same master data. this means - no additional phrase will be added to the specification fro new pictures.

If my assumtion is correct, then you can have a look into the phrase...how can you place one more graphic path along with the old grhaphic.

b. If business don't want to disturb the old phrase value (master data), willing to add one more characteristic to the property tree - value assignment. In this case, you don't have any trouble. add new characteristic and fetch the new phrase which have new value (picture). the same can be called in the wwi reports.

Former Member
0 Kudos

In continuation to the above -

If the option "b"mentioned above is not valid. you are focussing only option "a".......then you need create a new report symbol, with the same class and charactestic details.

my suggestion would be, create the new symbol under new symbol group.

specify symbol -

path - SPRO > ENvironment, Health & Safety > Basic Data and Tools > Report definition > Report symbols > Check and Specify Report symbols.

Report symbol group - SPRO > ENvironment, Health & Safety > Basic Data and Tools > Report definition > Report symbols > Specify Report symbol groups.

Eventhough you create the above, in said manner.......the value will be same in report.

to get the variation in the value, you have to develop a new function module to fetch the new value....the same function module to be placed in "Report symbol group", which has been created newly.....under the field "Foreign key - function module".

while doing the report generation, the above function module will drive to fetch the new picture, placed against the language key in the phrase.

I haven't worked with this kind of scenario before, but i am confident...it will work. if you could spend some time further to investigate.

Constraints -  while using the generation variant, it may restrict the value.....as you are using the place holder for the picture in phrase, which is language dependent.

Hints - while building the function module, consider the BAPI "BAPI_BUS1091_GETDETAIL", which consists the function " C1F0_PHRASES_READ". this function need to be modified further to focus only with limited language keys (new pictures stored),

Regards

kamal

Former Member
0 Kudos

Hi Experts,

I asked a developer and he make the following comment.

Changing name of symbols at this place

The pattern fm should be C14N_SYMBOL_SUBST_REFERENCE

Has anyone experiences handling this way ?


Former Member
0 Kudos

Hi Manuel,

the function module is a normal funciton module which checks the values in the structures RCGLSYSELC, etrc.,

for that there must be a symbol available.

In your case, you mentioned

****************

original pathname:

SAP\frontend\sap_gui\wwi\graphics\picture_old.bmp

to new:

SAP\frontend\sap_gui\wwi\graphics\picture_new.bmp

*******************

and you are not interested to edit the substance data.

then how the above path would be act as a symbol.  the path you mentioned is just to store the pictures. some how we have to link these pictures to substances by using the phrases, by filling the graphic field in the phrase.

Hint - atleast create one phrase with the graphic "Picture_new" and use this as a descriptor symbol. refer the same, whenever there is an instance calling the "Picture_old". I haven't worked in this way. have a try.....

Regards

kamal

christoph_bergemann
Active Contributor
0 Kudos

Dear Manuel

my assumption would be: C14N_SYMBOL_SUBST_REFERENCE is not the right function module to start with but could guide you. But the correct one is mentioned if i remember correct in SAP customizing (creating report symbols)

Use the dummy one of SAP and create a customer specific one; in coding the value retrieved need to be manipulated and then it will work in my opinion and the function modukle need to be aded accordoing to my knowledge at the place you have shown in your picture.

C.B.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Christoph,

thanks.

The FM C14N_SYMBOL_SUBST_REFERENCE sould be a pattern for the customer FM.

But unfortunately in the interface of the FM I don't find a field with the picture name.

Did I something wrong ?

christoph_bergemann
Active Contributor
0 Kudos

Dear Manuel

as explained: C14N_SYMBOL_SUBST_REFERENCE is the wrong FM to start with. This FM is dedicated in WWI layout of Dangerous Goods topics.

Please check:

http://help.sap.com/saphelp_46c/helpdata/en/a7/2875190a6c11d28a220000e829fbbd/content.htm

and especially:

http://help.sap.com/saphelp_erp60_sp/helpdata/en/a7/2875330a6c11d28a220000e829fbbd/content.htm

Expansion Mode is explained as well here:

http://help.sap.com/saphelp_erp2005/helpdata/ru/a7/2874ff0a6c11d28a220000e829fbbd/content.htm

Chapter: Examples of Symbols

explains the use of graphics in phrases.

http://www.stechno.net/sap-notes.html?view=sapnote&id=1576098

Is very helpful (referring to an OSS note)

C.B.