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

Former Member
0 Likes
1,996

Dear SDN Members,

This is my declaration part

TYPES : BEGIN OF LT_FINAL,

START_DATE TYPE DATS,

END_DATE TYPE DATS,

DELNR TYPE /SAPAPO/OM_DELNR,

END OF LT_FINAL.

DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL.

In this statement -


MOVE <LT_ORDMAPS>-DELNR TO GT_FINAL-DELNR.

I am getting error ' gt_final is a table without header & no component called DELNR '

How to solve this ?

Thanx in Advance.

Regards,

Johnn.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,865

Hi,

declare it in this way ..

DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL <b>WITH HEADER LINE</b>.

REgards,

Santosh

19 REPLIES 19
Read only

Former Member
0 Likes
1,865

Hi,

Change your internal table declaration like this.

TYPES : BEGIN OF LT_FINAL,

START_DATE TYPE DATS,

END_DATE TYPE DATS,

DELNR TYPE /SAPAPO/OM_DELNR,

END OF LT_FINAL

<b>DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL with header line</b>.

Hope this helps.

Read only

Former Member
0 Likes
1,866

Hi,

declare it in this way ..

DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL <b>WITH HEADER LINE</b>.

REgards,

Santosh

Read only

0 Likes
1,865

Now the error is 'Field gt_final is unknown but there is field lt_final '

Read only

0 Likes
1,865

Hi Johnn

or u use

TYPES : BEGIN OF LT_FINAL,

START_DATE TYPE DATS,

END_DATE TYPE DATS,

DELNR TYPE /SAPAPO/OM_DELNR,

END OF LT_FINAL.

DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL <b>WITH HEADER LINE</b>.

MOVE <LT_ORDMAPS>-DELNR TO GT_FINAL-DELNR.

or:

TYPES : BEGIN OF LT_FINAL,

START_DATE TYPE DATS,

END_DATE TYPE DATS,

DELNR TYPE /SAPAPO/OM_DELNR,

END OF LT_FINAL.

<b>DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL.

DATA: WA_FINAL TYPE LT_FINAL.

MOVE <LT_ORDMAPS>-DELNR TO WA_FINAL-DELNR.

APPEND WA_FINAL TO GT_FINAL.</b>

max

Read only

Former Member
0 Likes
1,865

Here your gt_final is a table without a header line.So you have to explicitly declare a work area for this operation.

data :

wa_final type lt_final.

MOVE <LT_ORDMAPS>-DELNR TO wa_FINAL-DELNR.

append wa_final-delnr to gt_final.

Read only

Former Member
0 Likes
1,865

Hi

Define like this-

TYPES : BEGIN OF lt_final,

start_date TYPE dats,

end_date TYPE dats,

delnr TYPE /sapapo/om_delnr,

END OF lt_final.

DATA : gt_final TYPE STANDARD TABLE OF lt_final WITH HEADER LINE.

Hope this helps u.

Regards,

Seema.

Read only

Former Member
0 Likes
1,865

hi john abraham!

when did u left modeling,

any way,try this,

TYPES : BEGIN OF LT_FINAL,

START_DATE TYPE DATS,

END_DATE TYPE DATS,

DELNR TYPE /SAPAPO/OM_DELNR,

END OF LT_FINAL.

DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL,

WA_GT_FINAL TYPE LT_FINAL.

bye,

kcc

Read only

Former Member
0 Likes
1,865

hi Johnn,

The statement-

DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL.

creates a table without a header line(a struture).

You can declare an implicit structure ie the header line

DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL with header line.

<b>Or</b> you can declare an explicit structure of type

data : x_final type lt_final.

MOVE <LT_ORDMAPS>-DELNR TO X_FINAL-DELNR.

Regards,

Richa

Read only

Former Member
0 Likes
1,865

Hi,

TYPES : BEGIN OF LT_FINAL,

START_DATE TYPE DATS,

END_DATE TYPE DATS,

DELNR TYPE /SAPAPO/OM_DELNR,

END OF LT_FINAL.

<b>DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL occurs 0 with header line.</b>

Regards

amole

Read only

Former Member
0 Likes
1,865

You can do as told by others

or

declare workarea

data : <b>wa_FINAL</b> type lt_final.

MOVE <LT_ORDMAPS>-DELNR TO <b>WA_FINAL</b>-DELNR.

Read only

0 Likes
1,865

Declaration part

TYPES : BEGIN OF LT_FINAL,

NAME TYPE /SAPAPO/CRES_NAME,

START_DATE TYPE DATS,

END_DATE TYPE DATS,

DELNR TYPE /SAPAPO/OM_DELNR,

QUANTITY TYPE /SAPAPO/OM_GESAMT_MENGE,

END OF LT_FINAL.

DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL.

DATA : WA_FINAL TYPE LT_FINAL.

Code part

LOOP AT LT_ORDMAPS ASSIGNING <LT_ORDMAPS>. " WHERE ORDID = LT_ORDMAPS-ORDID.

READ TABLE LT_OUTPUT ASSIGNING <LT_OUTPUT> WITH KEY ORDERID = <LT_ORDMAPS>-ORDID.

IF SY-SUBRC = 0.

MOVE <LT_ORDMAPS>-DELNR TO WA_FINAL-DELNR.

MOVE <LT_OUTPUT>-QUANTITY TO WA_FINAL-QUANTITY.

MOVE P_RES TO WA_FINAL-NAME.

MOVE P_START TO WA_FINAL-START_DATE.

MOVE P_END TO WA_FINAL-END_DATE.

APPEND WA_FINAL TO GT_FINAL.

ENDIF.

ENDLOOP.

Error : field wa_final is unknown, but known field is lt_final.

Read only

0 Likes
1,865

your cde looks good , double click on the error and find out the line no where u r getting the error

chk this

REPORT ZSPELL.

TYPES : BEGIN OF LT_FINAL,
NAME TYPE NAME1,
START_DATE TYPE DATS,
END_DATE TYPE DATS,
DELNR TYPE NAME2,
QUANTITY TYPE MATNR,
END OF LT_FINAL.

DATA : GT_FINAL TYPE STANDARD TABLE OF LT_FINAL.

DATA : WA_FINAL TYPE LT_FINAL.

MOVE 'xyz' TO WA_FINAL-NAME.
APPEND WA_FINAL TO GT_FINAL.

Read only

0 Likes
1,865

Error in this line

MOVE <LT_ORDMAPS>-DELNR TO WA_FINAL-DELNR

Read only

0 Likes
1,865

Hi

I've tried your code and worked fine: have u sure you've defined WA_FINAL before the statament MOVE <LT_ORDMAPS>-DELNR TO WA_FINAL-DELNR? or where have you defined it?

Max

Read only

0 Likes
1,865

Hai,

The declaration part is in Top Include.

Read only

0 Likes
1,865

did you activated that INCLUDE program ? please check.

Read only

0 Likes
1,865

Hi

It'll be stupid...but have you actived all includes?

Max

Read only

0 Likes
1,865

hi,

i think it is giving the error it does not find the definition of the work area in the activate code. Check if you have activate the includes in your program.

Regards,

Richa.

Read only

0 Likes
1,865

Even Top include is activated.

while activating the main program it gives a process Error like ' field wa_final is unknown, but known field is lt_final'

But i gave 'activate anyway' & got the requirement now

Is there any problem in giving activate anyway ?

Thanks for ur support.