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 in the code

Former Member
0 Kudos

Hi all

This code is giving me error as wa_it_file-brgew must be a charater-type data object.

can anybody give me solution.

CONCATENATE wa_it_file-matnr wa_it_file-maktx wa_it_file-msehi wa_it_file-brgew wa_it_file-volum wa_it_file-volum wa_it_file-wheel_width wa_it_file-wheel_diam

INTO v_data SEPARATED BY ','.

CONDENSE v_data NO-GAPS.

TRANSFER v_data TO v_filename.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

can anybody give me solution.

will reward points.

7 REPLIES 7

Former Member
0 Kudos

Hi,

with concatenate all fields must be of type char.

Cheers.

...Reward if useful.

Former Member
0 Kudos

can anybody give me solution.

will reward points.

0 Kudos

hi

in ur internal table or work area change type of all fields to CHAR with length same as all have in Data element .

like for quantity give as

BRGEW(16),

then try ur command .

CONCATENATE wa_it_file-matnr wa_it_file-maktx wa_it_file-msehi wa_it_file-brgew wa_it_file-volum wa_it_file-volum wa_it_file-wheel_width wa_it_file-wheel_diam

INTO v_data SEPARATED BY ','.

CONDENSE v_data NO-GAPS.

TRANSFER v_data TO v_filename.

reward if helpful.

0 Kudos

HI,

Concatenate is only concatenate charecter type data.

make all fields data type as C in internal table declaration.

than do concatenate.

By

Gupta

Former Member
0 Kudos

Hello all

thanx so much for ur wonderful replies

m getting this error only for fields

wa_it_file-brgew wa_it_file-volum. I tried to give there length but they are type domain i cannot assign length to them

can anybody give me other solution

Former Member
0 Kudos

Hi all

When I go AL11 and try to open the file. a error is coming as

"unable to display file." what can be the error.

Former Member
0 Kudos

In this code data is not comming in the work area and ultimately file is not getting open.

plz help anybody.

TYPES : BEGIN OF x_mtfile,

matnr TYPE matnr, "Material Number

maktx TYPE maktx, "Material description

prodesc(30) TYPE c, "Material description

salegrp(3) TYPE c, "

msehi TYPE msehi, "Text description of the UOM

brgew TYPE c, "

volum TYPE c, "

length(5) TYPE c, "

wheel_width TYPE zwid, "Wheel Width

wheel_diam TYPE zdiam, "Use diameter to get height

serial(1) TYPE c, "

palqty(10) TYPE c,

unipcar(5) TYPE c, "

unno(4) TYPE c, "

END OF x_mtfile.

*work area declaration for tables.

DATA : wa_mara TYPE MARA.

DATA : wa_makt TYPE MAKT.

DATA : wa_t006a TYPE T006A.

DATA : wa_zmmkaganplant TYPE zmmkaganplant.

*Table declaration for storing data.

DATA : it_file TYPE TABLE OF x_mtfile WITH HEADER LINE.

DATA : wa_it_file TYPE x_mtfile.

DATA : v_data type string.

DATA : v_filename type string.

*variable declaration.

DATA : v_werks type werks_d.

*Default filename.

DATA: v_filename1 LIKE rlgrap-filename VALUE '/interface/SYSID/OUTBOUND/KAGAN/'.

*File path.

CONCATENATE v_filename1 wmara-matnr '_' SY-DATUM '_' SY-UZEIT '.txt' INTO v_filename.

  • Get the default file name

REPLACE 'SYSID' WITH sy-sysid INTO v_filename.

CONDENSE v_filename NO-GAPS.

  • Open the file to read the material.

OPEN DATASET v_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT it_file INTO wa_it_file.

IF wmarc-werks IS NOT INITIAL AND wmarc-werks = wa_zmmkaganplant-werks.

IF SY-TCODE = 'MM01'.

IF STRLEN(wmara-matnr) > 15.

MESSAGE e000(zt) WITH 'Invalid material no.'

else.

wa_it_file-matnr = wmara-matnr.

wa_it_file-maktx = stext-maktx.

wa_it_file-msehi = wmara-meins.

wa_it_file-brgew = wmara-brgew.

wa_it_file-volum = wmara-volum.

wa_it_file-wheel_width = wmara-wheel_width.

wa_it_file-wheel_diam = wmara-wheel_diam.

APPEND wa_it_file TO it_file.

IF SY-TCODE = 'MM02'.

SELECT SINGLE

matnr

brgew

volum

wheel_width

wheel_diam

FROM MARA

INTO wa_mara

WHERE matnr = wmara-matnr.

SELECT SINGLE msehi FROM T006A INTO wa_t006a

WHERE msehi = wmara-meins

AND spras = sy-langu.

SELECT SINGLE maktx FROM MAKT INTO wa_makt

WHERE matnr = wmara-matnr.

IF wmara-matnr <> wa_mara-matnr

AND stext-maktx <> wa_makt-maktx

AND wmara-meins <> wa_t006a-msehi

AND wmara-brgew <> wa_mara-brgew

AND wmara-volum <> wa_mara-volum

AND wmara-wheel_width <> wa_mara-wheel_width

AND wmara-wheel_diam <> wa_mara-wheel_diam.

CONCATENATE wa_it_file-matnr wa_it_file-maktx wa_it_file-msehi wa_it_file-brgew wa_it_file-volum wa_it_file-wheel_width wa_it_file-wheel_diam

INTO v_data SEPARATED BY ','.

CONDENSE v_data NO-GAPS.

TRANSFER v_data TO v_filename.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

CLOSE DATASET v_filename.