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

Syntax error..How to resolve this

Former Member
0 Likes
10,981

Hi all, I am getting error in the following code.

TABLES: lfa1,

adr6,

lfb1,

lfm1.

*&------- TYPES Declarations

TYPES: BEGIN OF it_lfa1 ,

lifnr TYPE lfa1-lifnr, "Account Number of Vendor or Creditor

ktokk TYPE lfa1-ktokk, "Vendor Account Group

anred TYPE lfa1-anred, "Title

name1 TYPE lfa1-name1, "Name1

sortl TYPE lfa1-sortl, "Sort Field

stras TYPE lfa1-stras, "House #, Street

pstlz TYPE lfa1-pstlz, "Postal Code

ort01 TYPE lfa1-ort01, "City

land1 TYPE lfa1-land1, "Country key

regio TYPE lfa1-regio, "Region(State, Province, Country)

telf1 TYPE lfa1-telf1, "First Telephone Number

telfx TYPE lfa1-telfx, "Fax Number

stenr TYPE lfa1-stenr, "Tax Number at Responsible Authority

akont TYPE lfb1-akont, "Reconciliation Account in General Ledger

zterm TYPE lfb1-zterm, "Terms of Payment Key

qsskz TYPE lfb1-qsskz, "Witholding Tax

zwels TYPE lfb1-zwels, "List of Payment Methods to be Considered

inco1 TYPE lfm1-inco1, "Incoterms (part 1)

inco2 TYPE lfm1-inco2, "Incoterms (part 2)

plifz type lfm1-plifz, "Planned delivery Time in Days

kraus TYPE lfa1-kraus, "Credit Info No

brsch TYPE lfa1-brsch, "Industry

END OF it_lfa1.

*&------- internal Table Declarations

DATA: itab TYPE TABLE OF it_lfa1.

*Internal Table for taking all fields of the above table in one line separated by ; .

DATA: BEGIN OF it_text OCCURS 0,

text(150),

END OF it_text.

*&------- Line Structure Declarations

DATA: wa TYPE it_lfa1.

START-OF-SELECTION.

*To fetch the data records from the tables.

SELECT alifnr aktokk aanred aname1

asortl astras apstlz aort01

aland1 aregio atelf1 atelfx

astenr bakont bzterm bqsskz

bzwels cinco1 c~inco2

c~plifz

akraus abrsch

FROM ( ( lfa1 AS a INNER JOIN lfb1 AS b ON alifnr = blifnr )

INNER JOIN lfm1 AS c ON blifnr = clifnr )

UP TO 15 ROWS

INTO corresponding fields of TABLE itab.

*Sort the internal table by lifnr.

IF NOT itab[] IS INITIAL.

SORT itab BY lifnr.

ENDIF.

*Concatenate all the fields of above internal table records in one line *separated by ; .

LOOP AT itab INTO wa.

CONCATENATE wa-lifnr wa-ktokk wa-anred wa-name1

wa-sortl wa-stras wa-pstlz wa-ort01

wa-land1 wa-regio wa-telf1 wa-telfx

wa-stenr wa-akont wa-zterm wa-qsskz

wa-zwels wa-inco1 wa-inco2

wa-plifz

wa-kraus wa-brsch

INTO it_text-text SEPARATED BY ';'.

APPEND it_text.

CLEAR it_text.

ENDLOOP.

When i execute the code i am getting error message like " WA-PLIFZ" must be a character type data object (C,N,D,T or STRING)

How to resolve this ?

THanks

Krupali

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,414
TABLES: lfa1,
adr6,
lfb1,
lfm1.

*&------- TYPES Declarations
TYPES: BEGIN OF it_lfa1 ,
lifnr TYPE lfa1-lifnr, "Account Number of Vendor or Creditor
ktokk TYPE lfa1-ktokk, "Vendor Account Group
anred TYPE lfa1-anred, "Title
name1 TYPE lfa1-name1,                                      "Name1
sortl TYPE lfa1-sortl, "Sort Field
stras TYPE lfa1-stras, "House #, Street
pstlz TYPE lfa1-pstlz, "Postal Code
ort01 TYPE lfa1-ort01, "City
land1 TYPE lfa1-land1, "Country key
regio TYPE lfa1-regio, "Region(State, Province, Country)
telf1 TYPE lfa1-telf1, "First Telephone Number
telfx TYPE lfa1-telfx, "Fax Number
stenr TYPE lfa1-stenr, "Tax Number at Responsible Authority
akont TYPE lfb1-akont, "Reconciliation Account in General Ledger
zterm TYPE lfb1-zterm, "Terms of Payment Key
qsskz TYPE lfb1-qsskz, "Witholding Tax
zwels TYPE lfb1-zwels, "List of Payment Methods to be Considered
inco1 TYPE lfm1-inco1, "Incoterms (part 1)
inco2 TYPE lfm1-inco2, "Incoterms (part 2)
plifz TYPE lfm1-plifz, "Planned delivery Time in Days
kraus TYPE lfa1-kraus, "Credit Info No
brsch TYPE lfa1-brsch, "Industry
END OF it_lfa1.

*&------- internal Table Declarations

DATA: itab TYPE TABLE OF it_lfa1.

*Internal Table for taking all fields of the above table in one line separated by ; .

DATA: BEGIN OF it_text OCCURS 0,
text(150),
END OF it_text.
*&------- Line Structure Declarations
DATA: wa TYPE it_lfa1.

START-OF-SELECTION.

*To fetch the data records from the tables.

  SELECT a~lifnr a~ktokk a~anred a~name1
  a~sortl a~stras a~pstlz a~ort01
  a~land1 a~regio a~telf1 a~telfx
  a~stenr b~akont b~zterm b~qsskz
  b~zwels c~inco1 c~inco2
  c~plifz
  a~kraus a~brsch
  FROM ( ( lfa1 AS a INNER JOIN lfb1 AS b ON a~lifnr = b~lifnr )
  INNER JOIN lfm1 AS c ON b~lifnr = c~lifnr )
  UP TO 15 ROWS
  INTO CORRESPONDING FIELDS OF TABLE itab.
*Sort the internal table by lifnr.

  IF NOT itab[] IS INITIAL.
    SORT itab BY lifnr.
  ENDIF.

*Concatenate all the fields of above internal table records in one line *separated by ; .
  DATA: w_plifz(3).
  LOOP AT itab INTO wa.
    w_plifz = wa-plifz.
    CONCATENATE wa-lifnr wa-ktokk wa-anred wa-name1
    wa-sortl wa-stras wa-pstlz wa-ort01
    wa-land1 wa-regio wa-telf1 wa-telfx
    wa-stenr wa-akont wa-zterm wa-qsskz
    wa-zwels wa-inco1 wa-inco2
    w_plifz
    wa-kraus wa-brsch

    INTO it_text-text SEPARATED BY ';'.
    APPEND it_text.
    CLEAR it_text.
  ENDLOOP.
12 REPLIES 12
Read only

bpawanchand
Active Contributor
0 Likes
4,414

Hi

When i execute the code i am getting error message like " WA-PLIFZ" must be a character type data object (C,N,D,T or STRING)

I hope it is not of character type you declare it as any one of teh specified data type then you can come across the problem.

Regards

Pavan

Read only

anversha_s
Active Contributor
0 Likes
4,414

Hi,

Only character variables can be concatenated.

So concatenation purpose move ur orginal variable to a char variable and concatenation.

Regards,

Anversha

Read only

Former Member
0 Likes
4,415
TABLES: lfa1,
adr6,
lfb1,
lfm1.

*&------- TYPES Declarations
TYPES: BEGIN OF it_lfa1 ,
lifnr TYPE lfa1-lifnr, "Account Number of Vendor or Creditor
ktokk TYPE lfa1-ktokk, "Vendor Account Group
anred TYPE lfa1-anred, "Title
name1 TYPE lfa1-name1,                                      "Name1
sortl TYPE lfa1-sortl, "Sort Field
stras TYPE lfa1-stras, "House #, Street
pstlz TYPE lfa1-pstlz, "Postal Code
ort01 TYPE lfa1-ort01, "City
land1 TYPE lfa1-land1, "Country key
regio TYPE lfa1-regio, "Region(State, Province, Country)
telf1 TYPE lfa1-telf1, "First Telephone Number
telfx TYPE lfa1-telfx, "Fax Number
stenr TYPE lfa1-stenr, "Tax Number at Responsible Authority
akont TYPE lfb1-akont, "Reconciliation Account in General Ledger
zterm TYPE lfb1-zterm, "Terms of Payment Key
qsskz TYPE lfb1-qsskz, "Witholding Tax
zwels TYPE lfb1-zwels, "List of Payment Methods to be Considered
inco1 TYPE lfm1-inco1, "Incoterms (part 1)
inco2 TYPE lfm1-inco2, "Incoterms (part 2)
plifz TYPE lfm1-plifz, "Planned delivery Time in Days
kraus TYPE lfa1-kraus, "Credit Info No
brsch TYPE lfa1-brsch, "Industry
END OF it_lfa1.

*&------- internal Table Declarations

DATA: itab TYPE TABLE OF it_lfa1.

*Internal Table for taking all fields of the above table in one line separated by ; .

DATA: BEGIN OF it_text OCCURS 0,
text(150),
END OF it_text.
*&------- Line Structure Declarations
DATA: wa TYPE it_lfa1.

START-OF-SELECTION.

*To fetch the data records from the tables.

  SELECT a~lifnr a~ktokk a~anred a~name1
  a~sortl a~stras a~pstlz a~ort01
  a~land1 a~regio a~telf1 a~telfx
  a~stenr b~akont b~zterm b~qsskz
  b~zwels c~inco1 c~inco2
  c~plifz
  a~kraus a~brsch
  FROM ( ( lfa1 AS a INNER JOIN lfb1 AS b ON a~lifnr = b~lifnr )
  INNER JOIN lfm1 AS c ON b~lifnr = c~lifnr )
  UP TO 15 ROWS
  INTO CORRESPONDING FIELDS OF TABLE itab.
*Sort the internal table by lifnr.

  IF NOT itab[] IS INITIAL.
    SORT itab BY lifnr.
  ENDIF.

*Concatenate all the fields of above internal table records in one line *separated by ; .
  DATA: w_plifz(3).
  LOOP AT itab INTO wa.
    w_plifz = wa-plifz.
    CONCATENATE wa-lifnr wa-ktokk wa-anred wa-name1
    wa-sortl wa-stras wa-pstlz wa-ort01
    wa-land1 wa-regio wa-telf1 wa-telfx
    wa-stenr wa-akont wa-zterm wa-qsskz
    wa-zwels wa-inco1 wa-inco2
    w_plifz
    wa-kraus wa-brsch

    INTO it_text-text SEPARATED BY ';'.
    APPEND it_text.
    CLEAR it_text.
  ENDLOOP.
Read only

0 Likes
4,414

Hi Vijay,

Thanks. Points hasbeen awarded.

Read only

bpawanchand
Active Contributor
0 Likes
4,414

HI

If you observe in the table LFM1 it is of type DECIMALs and in the concatenate statement you can only use variables of tyep CNDT that's y it is triggering a error.

Regards

Pavan

Read only

Former Member
0 Likes
4,414

Hi,

You can Use "CONCATENATE" on the fileds which are of type (C,N,D,T or STRING).

But PLIFZ is of type Decimal , so you are getting the error.

You can declare a temporary variable

DATA: w_temp type char3.

MOVE wa_plifz to w_temp.

Then use w_temp in CONCATENATE

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
4,414

Hello,

You are getting this error because you can not directly concatenate "DEC" type fields.

Try this :

data : lv_var(3) type c.

LOOP AT itab INTO wa.

lv_var = wa-plifz.

CONCATENATE wa-lifnr wa-ktokk wa-anred wa-name1

wa-sortl wa-stras wa-pstlz wa-ort01

wa-land1 wa-regio wa-telf1 wa-telfx

wa-stenr wa-akont wa-zterm wa-qsskz

wa-zwels wa-inco1 wa-inco2

lv_var

wa-kraus wa-brsch

INTO it_text-text SEPARATED BY ';'.

APPEND it_text.

CLEAR it_text.

clear lv_var.

ENDLOOP.

Regards,

Sandeep

Read only

Former Member
0 Likes
4,414

Hi,

We need to make 'WA-PLIFZ' as character type , which can be done by moving WA-PLIFZ into a local char varaible.

Chararcter variables can be concatenated,the WA-PLIFZ s DEC so we need to make it CHAR.

So do this way :

DATA: LV-PLIFZ(3) TYPE C.
.....
LOOP AT ITAB INTO WA.
WA-PLIFZ = LV-PLIFZ .
....

ENDLOOP.

hope this helps.

thanx,

dhanashri.

Edited by: Dhanashri Pawar on Aug 25, 2008 8:29 AM

Read only

Former Member
0 Likes
4,414

Hi,

U need to use character data type for CONCATENATE.

DATA :WA-PLIFZ(15),

Thanks,

Read only

Former Member
0 Likes
4,414

HI KR,

Please refer this code.

DATA: l_plifz(3) TYPE c.

LOOP AT itab INTO wa.

l_plifz = wa-plifz.

CONCATENATE wa-lifnr wa-ktokk wa-anred wa-name1

wa-sortl wa-stras wa-pstlz wa-ort01

wa-land1 wa-regio wa-telf1 wa-telfx

wa-stenr wa-akont wa-zterm wa-qsskz

wa-zwels wa-inco1 wa-inco2

l_plifz

wa-kraus wa-brsch

INTO it_text-text SEPARATED BY ';'.

APPEND it_text.

CLEAR it_text.

ENDLOOP.

Regards,

Ramkumar.K

Read only

anversha_s
Active Contributor
0 Likes
4,414

Hi,

most of the guys answered the question correctly..seems strange!!

~Anversha

Read only

0 Likes
4,414

>

> Hi,

>

> most of the guys answered the question correctly..seems strange!!

>

>

> ~Anversha

Any Starange Behaviour can be Reported and it will be dealed. You have abuse button ,you can use and report. I too just found some strange behavoiur yesterday i just reported.