2015 Sep 08 8:03 AM
Dear Experts,
I just want to know how do we find out the constants that we pass as a parameter to a method.
For example,
while implementing TOP_OF_PAGE event, I have to use ADD_TEXT method.
In this method we passing following parameters along with other
fix_lines = 'X'
sap_style = cl_dd_area=>heading
sap_color = cl_dd_area=>list_heading_int
sap_fontsize = cl_dd_area=>large
How will I find out what can be pass to above exporting parameters like I have passed following
cl_dd_area=>heading or cl_dd_area=>list_heading_int or cl_dd_area=>large.
Regards,
Jaspal Kumar
2015 Sep 08 8:50 AM
Hi.
I suppose you need to see Interface CL_DD_DOCUMENT. From SE24 you'll see your method ADD_TEXT and its parameters.
Parameters:
| TEXT | Importing | Type | SDYDO_TEXT_ELEMENT |
| TEXT_TABLE | Importing | Type | SDYDO_TEXT_TABLE |
| FIX_LINES | Importing | Type | SDYDO_FLAG |
| SAP_STYLE | Importing | Type | SDYDO_ATTRIBUTE |
| SAP_COLOR | Importing | Type | SDYDO_ATTRIBUTE |
| SAP_FONTSIZE | Importing | Type | SDYDO_ATTRIBUTE |
| SAP_FONTSTYLE | Importing | Type | SDYDO_ATTRIBUTE |
| SAP_EMPHASIS | Importing | Type | SDYDO_ATTRIBUTE |
| STYLE_CLASS | Importing | Type | SDYDO_ATTRIBUTE |
| DOCUMENT | Changing | Type Ref To | CL_DD_DOCUMENT |
Hope to help.
Bye
2015 Sep 08 9:04 AM
In the Class - CL_DD_AREA, you will find that SAP_STYLE is a Parameter of the METHOD Add_text. This parameter of type - SDYDO_ATTRIBUTE.
Now go to the "Attribute tab" of this class. Any attribute which is of type SDYDO_ATTRIBUTE can be assigned here. But since it is attribute of the class CL_DD_AREA, hence it is assigned using CL_DD_AREA=>heading , etc...
2015 Sep 08 9:21 AM
Ags thanks for ur reply.
you are right. I can go to the
I as asking how would I know the possible values for these parameters as I have passed
as
sap_style = cl_dd_area=>heading.
how would i know that the attribute sap_style will have cl_dd_area=>heading value.
regards,
Jaspal Kumar
2015 Sep 08 10:14 AM
Because This attribute sap_style is of data type - SDYDO_ATTRIBUTE and can only accept values of that type.
I hope i got your question correctly? Or else let me know.
2015 Sep 08 10:50 AM
Hi ags,
I really appreciate ur help. Let me put my question in other way.
example,
In FI module, there is a field called SHKZG for debit and credit.
whenever we use this domain , we can only enter 'S' or 'H' which is defined at domain level.
whenever we use this filed, we can enter only 'H' or 'S'.
now i come to my question.
I know that sap_style is of data type - SDYDO_ATTRIBUTE and can only accept values of that type.
But where can i find the values for sap_style attribute. Type is ok, it can accept value of type SDYDO_ATTRIBUTE .
I hope now my question is clear.
Thanks a lot once again for help.
Regards,
Jaspal
2015 Sep 08 11:39 AM
Yes, because for SHKZG values are maintained at DOMAIN level, but for SDYDO_ATTRIBUTE is part of the global Type-pool. If you double click it will show. Its not maintained at Database level, but a global variable only.
So to figure out the permitted values, you can go to the class - CL_DD_AREA and check its ATTRIBUTE tab. you will see the constants with values "EMPHASIS", "HEADING" etc. You can use these.
Another way is to get inside method ADD_TEXT and check the code. 1 time effort, but it will give you better clarification how SAP handles it.
"
* handle styles
CALL METHOD handle_styles EXPORTING sap_style = sap_style
"
Just note that this class,typepool,constant etc belong to the same package - SDYNAMICDOCUMENTS.
So the concept is that SAP must be creating all the permitted values in same package. You can search any values of this kind in future using this concept, if you feel lost.
2015 Sep 08 11:55 AM
Hi Ags,
Thanks once again.
now we are very close. like you said
"So to figure out the permitted values, you can go to the class - CL_DD_AREA and check its ATTRIBUTE tab. you will see the constants with values "EMPHASIS", "HEADING" etc. You can use these."
Now My question was, where it is mentioned that the for permitted values, I have to refer CL_DD_AREA class. Or Values from CL_DD_AREA class can be used in the method ADD_TEXT.
Regards,
Jaspal
2015 Sep 08 12:12 PM
As I told you, if a method belongs to a class and uses CONSTANTS as its parameters, the CLASS is ought to have ATTRUBUTEs defined for the constants, or else we can never find out the values.
The values will always be there in the same class attribute or the superclass attrbutes.
2015 Sep 08 12:29 PM
Hi Ags,
when I check method parameters, for example only ADD_TEXT, One parameter is SAP STYLE and it is of TYPE SDYDO_ATTRIBUTE and in description, " Recommended Styles'.
This SDYDO_ATTRIBUTE does not give any recommended value list nor it is mentioning that for recommended styles, I should refer the base class CL_DD_AREA.
I just wanted to know how and where to find these recommended values from?
but your line " The values will always be there in the same class attribute or the superclass attributes." is very helpful.
Regards,
Jaspal
2015 Sep 08 9:28 AM
Hi,
These constants are meant to simplify your task. Because they use symbolic names rather then internal value, you should be able to deduce from their name, wich one to use.
Admittedly, in this case names and values are identical - but you get the Intention.
In your example, you used cl_dd_area=>heading, for Parameter sap_style, meaning that you want your text to appear formatted as header.
If you have an idea (and usually you will), what your text is supposed to look like, by browsing the available constant-attributes of class cl_dd_area, you should be able to decide, which ones to use.
Best regards - Jörg