12-13-2006 6:31 PM
Here is a part of my code. lv_string variable was type string initially but i got an error Not mutually convertible in a Unicode Program. I changed it to type ty_afko. Now the program works but the data it puts out has just a bunch of #####. I cannot make all value in the internal table type char because then my select statement is giving errors.. Please help...
Type: BEGIN OF ty_afko,
rsnum LIKE afko-rsnum, " Number of reservation
aprio LIKE afko-aprio, " Order Priority
maufnr LIKE afko-maufnr, " Number of superior order
lead_aufnr LIKE afko-lead_aufnr, " Leading order in current processing
END OF ty_afko.
data: gt_afko TYPE STANDARD TABLE OF ty_afko INITIAL SIZE 0,
wa_afko TYPE ty_afko,
select rsnum aprio maufnr lead_aufnr
from afko into table gt_afko.
IF gv_error = 'X'.
EXIT.
ELSE.
<b>DATA: Lv_string type ty_afko.</b>
loop at gt_afko into wa_afko.
clear lv_string.
<b> move wa_afko to lv_string.</b>
perform f_transfer_dataset using gc_f_afko lv_string changing gv_error.
endloop.
endif.
FORM f_transfer_dataset USING p_file
p_data
CHANGING p_error TYPE c.
Data: lv_file(25) type c.
CONCATENATE gc_path p_file INTO lv_file.
TRANSFER p_data TO lv_file.
ENDFORM. "F_TRANSFER_DATASET
12-13-2006 7:01 PM
hi,
All the P type fields will be displayed as ##### in the application layer, i.e. type P, type CURR.
So, when looping at the final table where you have to transfer the fields, move the P type fields to a character type field.
This will solve your issue.
Regards,
Navneet
12-13-2006 7:01 PM
hi,
All the P type fields will be displayed as ##### in the application layer, i.e. type P, type CURR.
So, when looping at the final table where you have to transfer the fields, move the P type fields to a character type field.
This will solve your issue.
Regards,
Navneet
12-13-2006 7:37 PM
Type: BEGIN OF ty_afko,
rsnum LIKE afko-rsnum, " Number of reservation
aprio LIKE afko-aprio, " Order Priority
maufnr LIKE afko-maufnr, " Number of superior order
lead_aufnr LIKE afko-lead_aufnr, " Leading order in current processing
END OF ty_afko.
Do you mean change from "LIKE afko-something" to "type c" ? I did this but then i get an error with the select statement. I think it is because it collects type p and when it tries to put it in an internal table ... it has type c.
Or
IF gv_error = 'X'.
EXIT.
ELSE.
DAta: Lv_sting type ty_afko.
loop at gt_afko into wa_afko.
clear gv_string.
move wa_afko to gv_string.
perform f_transfer_dataset using gc_f_afko lv_string changing gv_error.
endloop.
endif.
Change it some where here... not sure how to do that..
12-13-2006 11:24 PM
The key is to create another empty structure with fields of type c.
TYPES: BEGIN OF ty_resb,
bdter TYPE RESB-BDTER, " This field is type d
bdmng type resb-bdmng, " This field is type p with 3 decimals - total 14
END OF ty_resb,
BEGIN OF ty_resbstr, " This structure is the same as above but the field types will be char.
bdter(10),
bdmng(14),
END OF ty_resbstr.
DATA: gt_resb TYPE STANDARD TABLE OF ty_resb,
wa_resb TYPE ty_resb,
structure type ty_resbstr. " Empty fields with the same structure as the work area.
SELECT bdter bdmng FROM resb INTO corresponding fields of TABLE gt_resb.
open dataset pfile for output in text mode encoding default.
loop at gt_resb into wa_resb.
clear gv_string.
move-corresponding wa_resb to gv_string.
perform f_transfer_dataset using gc_f_resb gv_string.
endloop.
FORM f_transfer_dataset USING p_file p_data.
TRANSFER p_data TO lv_file.
ENDFORM.
12-15-2006 8:38 PM
Hi
I am sorry for the late reply.
Do not define gv_string as type string. give it as gv_string(1023) type c.
Then move the P type fields to the gv_string at that offset. For instance, the first field is of length 20 and second field is P type currency field of length 13 then give
gv_string+20(13) = itab-currency_field.
This will solve the problem.
Regards,
Navneet
12-15-2006 8:50 PM
Hi
Yes, you are correct in creating a new internal with character type fields. You could also do it by using the variable of type C and not string and move the P type field to Char type field.
Regards,
Navneet