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

Work area problem

Former Member
0 Likes
592

Hi guys,

With the following code:

*Types

TYPES: BEGIN OF ty_zinfo,

string TYPE string,

END OF ty_zinfo.

TYPES:

BEGIN OF ty_zklant,

mandt TYPE mandt,

partner TYPE zpartner,

date TYPE zerdat,

desc TYPE zdescription,

END OF ty_zklant,

*Work area's

DATA: wa_info TYPE ty_zinfo,

wa_klant TYPE ty_zklant.

*Internal tables

DATA: it_klant TYPE TABLE OF ty_zklant WITH HEADER LINE,

it_info TYPE TABLE OF ty_zinfo WITH HEADER LINE,

*loop

LOOP AT it_info INTO wa_info.

SPLIT wa_info AT ',' INTO

wa_klant-mandt

wa_klant-partner

wa_klant-date

wa_klant-desc

APPEND wa_klant TO it_klant.

WRITE it_klant.

ENDLOOP.

Why am I getting the following error?:

"WA_INFO" must be a character-type data object (data type C, N, D, T or

STRING). field string).

When I change the work area to TYPE string it gives the following error:

+"WA_INFO" cannot be converted to the line type of "IT_INFO". +

What's happening?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
569

Hi

U need to indicate the field of the structure IT_INFO

LOOP AT it_info INTO wa_info.
*  SPLIT wa_info AT ',' INTO
  SPLIT wa_info-string AT ',' INTO
        wa_klant-mandt
        wa_klant-partner
        wa_klant-date
        wa_klant-desc.
  APPEND wa_klant TO it_klant.
ENDLOOP.

Max

4 REPLIES 4
Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
569

hi,

DATA : it_info TYPE TABLE OF string,   "---declare ur it_info as table of string
       wa_info TYPE string,

hope it solves ur issue

Thanks & Regards

Read only

Former Member
0 Likes
570

Hi

U need to indicate the field of the structure IT_INFO

LOOP AT it_info INTO wa_info.
*  SPLIT wa_info AT ',' INTO
  SPLIT wa_info-string AT ',' INTO
        wa_klant-mandt
        wa_klant-partner
        wa_klant-date
        wa_klant-desc.
  APPEND wa_klant TO it_klant.
ENDLOOP.

Max

Read only

Former Member
0 Likes
569

Hi Jeffrey,

Try below

*Types
TYPES: BEGIN OF ty_zinfo,
string TYPE string,
END OF ty_zinfo.

TYPES:
BEGIN OF ty_zklant,
mandt TYPE mandt,
partner TYPE zpartner,
date TYPE zerdat,
desc TYPE zdescription,
END OF ty_zklant,

data: it_zinfo type table of ty_zinfo,
DATA: wa_info like line of it_zinfo,   "look this

it works

Read only

Former Member
0 Likes
569

Thanks guys!