Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

insert internal table into DB Table

Former Member
0 Likes
12,378

Hello Experts,

I am trying to insert an internal table into DDIC Table with

INSERT ZSRM_ADDR FROM table lt_addr_export.

I am gettimg the error message

The type of the db table are not Unicode convertible. What I can I do in this case ?

Regards

Marco

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,795

Did you activate the unicode flag in the program ? ( Check [ABAP Development Under Unicode|http://help.sap.com/saphelp_nw04/Helpdata/EN/79/c55458b3dc11d5993800508b6b8b11/frameset.htm] )

Regards,

Raymond

18 REPLIES 18
Read only

Former Member
0 Likes
2,795

Hi ,

check lt_addr_export is of table type ZSRM_ADDR .

Regards,

Prabhudas

Read only

Former Member
0 Likes
2,795

Hi

Check this link.May be useful for your req.

Thanks

Read only

Former Member
0 Likes
2,795

Hi,

You get such errors when the structure of your internal table lt_addr_export is different from that of your database table, here DDIC. Check your structures. You could probably missed the MANDT field in your internal table declaration.

Read only

Former Member
0 Likes
2,795

Hi,

Check the fields in your internal table and your Z table.

They must be same. Check their types also.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
2,795
TYPES: BEGIN OF lty_addr_export,
           partner       TYPE bu_partner,
           partner_guid  TYPE bu_partner_guid,
           addrnumber    TYPE ad_addrnum,
           adr_kind      TYPE bu_adrkind,
           street        TYPE ad_street,
           city1         TYPE ad_city1,
           country       TYPE land1,
           name_org      TYPE bbp_bp_name_org,
           post_code1    TYPE ad_pstcd1,
           c_o_name      TYPE ad_name_co,
*           DISTRICT      TYPE AD_CITY2,
           building      TYPE ad_bldng,
           floor         TYPE ad_floor,
           roomnumber    TYPE ad_roomnum,
         END OF lty_addr_export,

data lt_addr_export TYPE STANDARD TABLE OF lty_addr_export,

DDIC TABLE ZSRM_ADDR

MANDT	MANDT
PARTNER	BU_PARTNER
PARTNER_GUID	BU_PARTNER_GUID
ADDRNUMBER	AD_ADDRNUM
ADR_KIND	BU_ADRKIND
STREET	AD_STREET
CITY1	AD_CITY1
COUNTRY	LAND1
NAME_ORG	BBP_BP_NAME_ORG
POST_CODE1	AD_PSTCD1
C_O_NAME	AD_NAME_CO
BUILDING	AD_BLDNG
FLOOR	AD_FLOOR
ROOMNUMBER	AD_ROOMNUM

They are equal

Read only

0 Likes
2,795

Hi,

Your internal table does not contain the MANDT field as I mentioned previously

Add the field in the beginning


MANDT TYPE SY-MANDT.

Read only

Former Member
0 Likes
2,795

I regret to say

this command causes sy-subrc 4 after executing.

Additonaly no insertion took place

What can the reason for it ?

INSERT ZSRM_ADDR FROM TABLE lt_addr_export ACCEPTING DUPLICATE KEYS.

Edited by: Marco M on Jul 8, 2009 3:43 PM

Read only

0 Likes
2,795

If the structure is same...would suggest you to declare the internal table as

DATA: lt_addr_export TYPE STANDARD TABLE OF lt_addr_export.

This will avoid all the problems!

Read only

Former Member
Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,796

Did you activate the unicode flag in the program ? ( Check [ABAP Development Under Unicode|http://help.sap.com/saphelp_nw04/Helpdata/EN/79/c55458b3dc11d5993800508b6b8b11/frameset.htm] )

Regards,

Raymond

Read only

0 Likes
2,795

it is a function module where can I do it

Read only

0 Likes
2,795

Activate it on the function group.

1. Select a function group in the Object Navigator.

2. Double-click on the function group name in the tree structure.

3. Set the Unicode Checks Active flag in the following dialog box

4. Save.

5. Activate the function group.

Regards,

Raymond

Read only

0 Likes
2,795

hi, I have set the Unicode Checks active and am getting inserted only one line into the table.

Regards

Marco

Read only

0 Likes
2,795

Did you check the key fields in the intenal table (also check for unique key indexes), are they different, else only one record mau be inserted, others are duplicate keys.

Try with the option ACCEPTING DUPLICATE KEYS just after INSERT statemzent

Regards,

Raymond

Read only

0 Likes
2,795

Hi,

You may be getting one entry because of duplicate records.. It will not insert dupliacte records for the same key field.. Check your internal table values for the key fields and then check the database values.. To avaoid going to dump for using duplicate entries you can use the addition.. accepting duplicate records with your insert statement...

Read only

0 Likes
2,795

hi please notice I have used the addition ACCEPTING DUPLICATE KEYS

INSERT ZSRM_ADDR FROM TABLE lt_addr_export ACCEPTING DUPLICATE KEYS

Regards

Marco

Read only

0 Likes
2,795

HI,

Try with modify statemnt.

modify ZSRM_ADDR FROM TABLE lt_addr_export .

Regards,

Nagaraj

Read only

Former Member
0 Likes
2,795

This message was moderated.