Application Development 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: 

Error while Appending a work-area in a table

Former Member
0 Kudos

Hi Experts,

Requirement :- I want to append a row in the the table but the work-area with which i am appendign the values is of different type than the target so i am getting error .

Code :- APPEND WA_SOURCE TO RESULT_PACKAGE

Error :- A line of RESULT_PACKAGE not mutually convertible in a Unicode program..........

Is there any way to append the one-by one values in the RESULT_PACKAGE fields.

As i cn't change the type of my source work-area.

Don't we have something like :-

Append Result_package

{

Result_package_field1 = wa-field1

Result_package_field2 = wa_field2.....

....

...

}

PLEASE HELP

Regards,

rg

Edited by: R G on Mar 26, 2009 10:34 AM

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

I can't change the Work-area type....

Can't we appened a line in any table by providing direct values??????

You DONOT have to change the TYPE of your Work Area. You create a new work area.

You can try something like this:

DATA:
WA_RESULT_PACKAGE LIKE LINE OF RESULT_PACKAGE.

MOVE CORRESPONDING WA_SOURCE TO WA_RESULT_PACKAGE.

APPEND WA_RESULT_PACKAGE TO RESULT_PACKAGE.
CLEAR WA_RESULT_PACKAGE.

Or Else,

DATA:
WA_RESULT_PACKAGE LIKE LINE OF RESULT_PACKAGE.

MOVE WA_SOURCE-F1 TO WA_RESULT_PACKAGE-F1.
MOVE WA_SOURCE-F2 TO WA_RESULT_PACKAGE-F2.
MOVE WA_SOURCE-F3 TO WA_RESULT_PACKAGE-F3.
.................

APPEND WA_RESULT_PACKAGE TO RESULT_PACKAGE.
CLEAR WA_RESULT_PACKAGE.

BR,

Suhas

Edited by: Suhas Saha on Mar 26, 2009 10:44 AM

8 REPLIES 8

Former Member
0 Kudos

Hi,

Use this:

MOVE-CORRESPONDING WA_SOURCE to RESULT_PACKAGE.
APPEND RESULT_PACKAGE.

Regards,

Shailaja

0 Kudos

Hi Shailaja ,

Thanks for the promt-reply .

but does move corresponding will overwrite on the existing data?

0 Kudos

Yes.

For clarity you can do the following:

Clear the target work area and then append.

clear wa_result_package.
move-corresponding wa_source to wa_result_package.
append wa_result_package to result_package.

OR

You can manually move the fields to the target.

wa_result_package-field1 = wa_source-field1.
wa_result_package-field2 = wa_source-field2.
and so on....
append wa_result_package to result_package.

Regards,

Shailaja

Former Member
0 Kudos

Try like this

1. create an work area wa_RESULT_PACKAGE of type RESULT_PACKAGE

2. Before append use MOVE-CORRESPONDING WA_SOURCE to wa_RESULT_PACKAGE

3 APPEND wa_RESULT_PACKAGE to RESULT_PACKAGE

Hope this helps...

0 Kudos

Hi Karan,

I can't change the Work-area type....

Can't we appened a line in any table by providing direct values??????

Former Member
0 Kudos

data wa like result_package.

move-corresponding wa_source to wa.

append wa to result_package.

Former Member
0 Kudos

Hi ,

Create aw orkarea for result_package .

say wa_package.move-corressponding wa_source to wa_package,

then a

append wa_package to lt_package.

Regards

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

I can't change the Work-area type....

Can't we appened a line in any table by providing direct values??????

You DONOT have to change the TYPE of your Work Area. You create a new work area.

You can try something like this:

DATA:
WA_RESULT_PACKAGE LIKE LINE OF RESULT_PACKAGE.

MOVE CORRESPONDING WA_SOURCE TO WA_RESULT_PACKAGE.

APPEND WA_RESULT_PACKAGE TO RESULT_PACKAGE.
CLEAR WA_RESULT_PACKAGE.

Or Else,

DATA:
WA_RESULT_PACKAGE LIKE LINE OF RESULT_PACKAGE.

MOVE WA_SOURCE-F1 TO WA_RESULT_PACKAGE-F1.
MOVE WA_SOURCE-F2 TO WA_RESULT_PACKAGE-F2.
MOVE WA_SOURCE-F3 TO WA_RESULT_PACKAGE-F3.
.................

APPEND WA_RESULT_PACKAGE TO RESULT_PACKAGE.
CLEAR WA_RESULT_PACKAGE.

BR,

Suhas

Edited by: Suhas Saha on Mar 26, 2009 10:44 AM