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

Updating client dependent database ztable from internal table

jitendra_it
Active Contributor
0 Likes
1,733

Hi All,

I am updating client dependent Ztable from a file. Program reads data file and populates them in internal table.


Internal table does not have client field so when using this internal table in MODIFY db FROM TABLE it is giving Unicode error.


Is there any other way than looping on first internal table then populating second internal table with client field in it and, update the db table from second internal table?

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,328

Read again online help/your course: Your structure always had to fulfill the prerequisites for open-sql work area (and that since a long long time) now with Unicode there are even more constaints.

As long as you don't use CLIENT SPECIFIED the system will use current client sy-mandt. Just add MANDT to your internal table, you can keep its value initial.

Regards,

Raymond

Hi All,

I am updating client dependent Ztable from a file. Program reads data file and populates them in internal table.


Internal table does not have client field so when using this internal table in MODIFY db FROM TABLE it is giving Unicode error.


Is there any other way than looping on first internal table then populating second internal table with client field in it and, update the db table from second internal table?

5 REPLIES 5
Read only

Former Member
0 Likes
1,328

Hi Jitendra,

Is there any problem to keep client field in internal table?

Thanks and Regards,

Pavan Kumar

Read only

0 Likes
1,328

Hi,

File will not have client data and i declared internal table same as file structure to upload data via method  cl_gui_frontend_services=>gui_upload.

Read only

0 Likes
1,328

Hi,

You can have one client field in both internal table and in uploading file(in file client field data can be blank) or you can use second internal table to update Z table.

Code given to copy internal table data to second internal table with client filed.

TYPES: BEGIN OF ty_itab,

kunnr  TYPE kunnr,

ernam  TYPE ernam,

END OF ty_itab.

TYPES: BEGIN OF ty_itab1,

mandt TYPE mandt,

kunnr  TYPE kunnr,

ernam  TYPE ernam,

END OF ty_itab1.

DATA: t_itab1 TYPE TABLE OF  ty_itab,

       w_itab1  TYPE  ty_itab,

       t_itab2 TYPE TABLE OF ty_itab1,

       w_itab2 TYPE ty_itab1.

LOOP AT t_itab1 INTO w_itab1.

   MOVE-CORRESPONDING w_itab1 TO w_itab2.

   w_itab2-mandt = sy-mandt.

   APPEND w_itab2 TO t_itab2.

ENDLOOP.

MODIFY ztable FROM TABLE t_itab2.


Thanks and Regards,

Pavan Kumar

Read only

former_member196331
Active Contributor
0 Likes
1,328

I hope you have to maintain the Exact structure In internal table.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,329

Read again online help/your course: Your structure always had to fulfill the prerequisites for open-sql work area (and that since a long long time) now with Unicode there are even more constaints.

As long as you don't use CLIENT SPECIFIED the system will use current client sy-mandt. Just add MANDT to your internal table, you can keep its value initial.

Regards,

Raymond