2011 Aug 31 7:36 AM
Hi Experts,
-
I have a requirement where i have to convert all(packed,raw,etc..) data types in CHAR type
-
Populate the data , in a table where all associated type are CHAR type and display it.
Regards
samuel
Hi Experts,
-
I have a requirement where i have to convert all(packed,raw,etc..) data types in CHAR type
-
Populate the data , in a table where all associated type are CHAR type and display it.
Regards
samuel
2011 Aug 31 7:43 AM
You should look at the method CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C( ) .
2011 Aug 31 8:17 AM
Hi,
thanks for quick response
could you please elaborate with some sample code
my values in the variables are 1.999(RAW) 33.666(DEC) 30.08.2011(DATS) respectively.
i am expecting these values to associate with 1.999(CHAR) 33.666(CHAR) 30.08.2011(CHAR) data type in an internal table .....
Thanks in advance.
2011 Aug 31 8:24 AM
Hello Sam,
Using this method is pretty straight forward
could you please elaborate with some sample code
Spoon feeding is not encouraged in the forums. Please try the solution & get back to the forum in case you face any specific errors.
Cheers,
Suhas
2011 Aug 31 8:53 AM
To be sure to understand you, you want to create an internal table with same field list (same field names) than an original one (internal table or ddic structrure) but in external format "character" (with or without conversion, comma ? conversion exit ?), map the data field by field converting to characters (kind of write-corresponding) and display,
Where are you blocked, getting structure definition, creating the dynamic internal table, mapping the data or displaying the table ?
There are many threads at sdn on each of these topics in sdn, did you use the search tool ?
Regards,
Raymond
2011 Aug 31 10:27 AM
hi,
You can get this by searching the sdn,[R|;
any ways please find the following code to be usefull.
tables mara.
data : wa_ymara type mara.
loop at i_ymara into wa_ymara.
call method cl_abap_container_utilities=>fill_container_c
exporting
im_value = wa_ymara
importing
ex_container = i_yindx-vdata
exceptions
illegal_parameter_type = 1
others = 2.
append i_yindx.
endloop.
regards,
kool.
2011 Aug 31 12:30 PM
Method cl_abap_container_utilities=>fill_container_c map the whole structure into a string field (container) that can be then converted back with method cl_abap_container_utilities=>read_container_c, in no case will this method convert data from internal format to external format.
Can you confirm your requirement ?
Regards,
Raymond
2011 Sep 01 3:16 PM
HI Raymond Giuseppi
THANK YOU
I have the table data in a field symbol ,now i want to convert the table data into CHAR type and put it in a static internal table and display it.
ACTUAL DATA at runtime in the field symbol : 01(raw) 29.647(dec) 17.08.2011(dats) 38.446(dec) 17.08.2011(dats)
Now i want to display the data in : 01(char) 29.647(char) 17.08.2011(char) 38.446(char) 17.08.2011(char)
2011 Sep 01 3:54 PM
- In the LOOP AT <itab> assigning <record> you can loop ASSIGNing [COMPONENT integer OF STRUCTURE record|http://help.sap.com/abapdocu_70/en/ABAPASSIGN_MEM_AREA.htm#&ABAP_ALTERNATIVE_7@7@] thru the fields of the record
- You could use method of CL_ABAP_STRUCTDESCR and/or CL_ABAP_DATADESCR (*) to get description of each field (once at first record) -> get length of external format (CHAR type) - perform this only once at first record (store result somewhere in an itab for performance)
- You will also be able to find a conversion exit name and then convert from internal to external format, or use WRITE (**), you may have to manage some types the "hard coded" way, eg. TIMS, DATS, etc.
Regards,
Raymond
(*) Read first [RTTS - Run Time Type Services|http://help.sap.com/abapdocu_70/en/ABENRTTI.htm]
(**) Problem with WRITE is it will pad some fields to the length available in the target field, which may be undesirable depending the definition of target field, so use length retrieved via abap utilities class.
2011 Sep 02 6:56 AM
hi
thanks for your reply
i am unable to interpret the line
- You will also be able to find a conversion exit name and
then convert from internal to external formatsince i am new...it seems to be complex to me
could you please explain with some sample code
Regards
samuel
Edited by: sam_samuel on Sep 2, 2011 2:10 PM
2011 Sep 03 3:20 PM
2011 Aug 31 12:42 PM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |