‎2006 Nov 21 5:18 AM
Hi All,
I am getting below error in a program -
"LS_BAPICUSGEN" and "T_BAPISTRUCT-DATA" are not mutually convertible in a Unicode program.
The code extract is -
MOVE t_bapistruct-data to ls_bapicusgen.
Here,
t_bapistruct-data is a charcter field of length 4000 and ls_bapicusgen is a work area of type BAPICUSGEN which contains 111 fields.
Please let me know how to fix this error and how to pass a string to the work area.
Thanks in advance.
Amogh
‎2006 Nov 21 5:46 AM
Hi,
Try using fieldsymbols.
field-symbols <fs> type t_bapistruct-data.
assign t_bapistruct-data to <fs> casting BAPICUSGEN.
Check and let me know if it works.
If so,kindly reward points by clicking the star on the left of reply and close the thread.
‎2006 Nov 21 5:19 AM
‎2006 Nov 21 5:22 AM
MOVE-corresponding t_bapistruct-data to ls_bapicusgen.
Read below info.
MOVE-CORRESPONDING sourcestruct TO destinationstruct.
This statement assigns the contents of the components of structure sourcestruct to the components of the destinationstruct structure that have identical names.
When it is executed, it is broken down into a set of MOVEstatements, one for each pair of fields with identical names, as follows:
MOVE sourcestruct-comp1 TO destinationstruct-comp1.
MOVE sourcestruct-comp2 TO destinationstruct-comp2.
...
Any necessary type conversions are performed individually.
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3260358411d1829f0000e829fbfe/content.htm
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers
‎2006 Nov 21 5:26 AM
Hi,
I cant use MOVE-CORRESPONDING here because my source structure is a string (t_bapistruct-data). The field data is string of 4000 character length.
Is there any other way of doing it?
‎2006 Nov 21 5:33 AM
You cannot assign the 4000 character field to a table with different fields .. because that table may contain numeric or non charecter fields.
to achieve the functionality you have to divide the field
t_bapistruct-data manually into different parts you can do that as
ls_bapicusgen-field1 = t_bapistruct-data(0)+10.
hope ths helps.
‎2006 Nov 21 5:43 AM
Yes... surely this is one method... But not feasible when you have 150 fields in your target structure. Need to calculate offset for all 150 fields...
Is there any other simple and more accurate method of achiving this.
Amogh
‎2006 Nov 21 5:46 AM
Hi,
Try using fieldsymbols.
field-symbols <fs> type t_bapistruct-data.
assign t_bapistruct-data to <fs> casting BAPICUSGEN.
Check and let me know if it works.
If so,kindly reward points by clicking the star on the left of reply and close the thread.
‎2006 Nov 21 6:28 AM
Hi Jayanthi,
It is working with slight modifications....
I did it in this way...
field-symbols <fs> type Target structure.
assign source structure to <fs> casting.
No need to add structure name after Casting addition.
Thanks a lot for solving the problem....
Full points to u
Amogh
‎2006 Nov 21 7:11 AM
Hi Amogh,
Using offset values you can transfer data from T_BAPISTRUCT-DATA to LS_BAPICUSGEN.
For e.g
data: T_BAPISTRUCT-DATA like line of T_BAPISTRUCT-DATA.
LOOP AT T_BAPISTRUCT-DATA into S_BAPISTRUCT-DATA
LS_BAPICUSGEN-CUSTOMER = S_BAPISTRUCT-DATA+1(10).
LS_BAPICUSGEN-ACC_1_TIME = S_BAPISTRUCT-DATA+11(1).
LS_BAPICUSGEN-ORDR_BLK_G = S_BAPISTRUCT-DATA+ 12(2).
. . . . .
. . . . .
append LS_BAPICUSGEN to LT_BAPICUSGEN.
ENDLOOP.
If helpful reward points.
Regards
Bhupal Reddy