2007 Mar 14 3:31 PM
In my functional specs I have been given field names
Client Number
Record Type
Customer Name and so on
I need to create custom data types for all these and assign them to std values (vbak-kunnr, adrc-name1)
I am trying to determine what is the best naming convention to use for my custom data types
Would the convention be to use, new_kunnr, new_adrc_name1 or perhaps just ClientNumber, RecordType, CustomerName and so on
2007 Mar 14 3:39 PM
Hi,
You don't need to create data type/element for your coding purposes.
You can declare work areas (WA).
data: wa_new_kunnr(15) type c.
wa_new_kunnr = vbak-kunnr.
Regards,
Ferry Lianto
2007 Mar 14 3:34 PM
2007 Mar 14 3:35 PM
Hi,
You can try something like this.
ZNEW_KUNNR.
ZADRC_NAME1.
Regards,
Ferry Lianto
2007 Mar 14 3:36 PM
Hi Rich
All I want to do is
data: new_kunnr(15) type c
new_kunnr = vbak-kunnr
Am I creating a new data type here?
I need to come up with a consistent naming convention for my fields as I have many of them
2007 Mar 14 3:38 PM
Hi,
if you are refering for custom data types, defined in your abap program, there is no convention at all. You are free to choose your variable names.
If you ar talking about sap objects, like domains or data elements, then you must follow SAP conventions.
The main convention is that your SAP objects must begin with 'Z' ou 'Y' .
Regards,
2007 Mar 14 3:39 PM
Hi,
You don't need to create data type/element for your coding purposes.
You can declare work areas (WA).
data: wa_new_kunnr(15) type c.
wa_new_kunnr = vbak-kunnr.
Regards,
Ferry Lianto
2007 Mar 14 3:43 PM
2007 Mar 14 3:45 PM
but if I were to chose my variable names as CustomerNumber, RecordTypeand so on rather than wa_kunnr ... would that be a non sap thing to do. I ask this cos I have a Java background and thats how we would name variables
2007 Mar 14 3:51 PM
Camel Casing is not possible in ABAP as it is case insensitive for the variables unlike Java is
2007 Mar 14 3:55 PM
You can use any datatype name you like. But it is best to use meaningful names such as
W_BILLING_METHOD instead of W_KVGR4.
The same is for internal tables. I have seen an internal table with the following definition
BEGIN OF T_DATA....
FIELD1(10),
FIELD2(10),
FIELD3(10),
.........
END OF T_DATA
etc.....
2007 Mar 14 3:50 PM
2007 Mar 14 3:56 PM
I think its best I include my scenario so people can better answer my question
My report has four different parts, each has a filler, record type, customer number which need to be initialized to certain values that are different
The four parts are Name/Address, Credit Order, Sub total and Total
Name/Address has Record type = A , customer number = vbak-kunnr
Credit Order has Record type = R, customer number = vbak-kunnr
SubTotal has Record type= space and customer number = 99
Total has Record type = S and customer number = 9999
So I have to create variables for these and am trying to figure out a proper naming convention
I could do RecordType_Name, RecordType_CreditOrder and so on but that does not seem the best way to me. Any ideas!
2007 Mar 14 7:16 PM
Hi Megan,
Usually we use the keyword TYPES to declare user-defined data types. The naming convention we follow is type_s_<typename>.
In order to declare data objects the naming convention is w_<objname>. In the same way,
For internal tables it is t_<tabname>.
For work areas it is wa_<work area-name>.
For parameters it is p_<parameter-name>.
For select-options it is s_<name>.
So according to ur requirement u use the above mentioned naming convention in ur report. Hope u get satisfied with my reply.
Regards,
Swapna.
2007 Mar 15 9:55 PM