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

assign problem

Former Member
0 Likes
643

what is wrong of the declare of assign

tables : mard.

DATA: BEGIN OF imard OCCURS 0,

matnr LIKE mard-matnr,

lfgja LIKE mard-lfgja,

lfmon LIKE mard-lfmon,

labst LIKE mard-labst,

mdrue LIKE mard-mdrue,

s_stock like mard-labst,

e_stock like mard-labst,

END OF imard.

FIELD-SYMBOLS: <ls_mard> TYPE any.

SELECT matnr

lfgja

lfmon

labst

mdrue

FROM mard

INTO TABLE imard.

loop at imard ASSIGNING <ls_mard>.

if <ls_mard>-mdrue = space.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
578

your field symbol is a field while you loop on a structure.

this will solve your problem:

FIELD-SYMBOLS: <ls_mard> like line of imard.

Itay

4 REPLIES 4
Read only

Former Member
0 Likes
579

your field symbol is a field while you loop on a structure.

this will solve your problem:

FIELD-SYMBOLS: <ls_mard> like line of imard.

Itay

Read only

Former Member
0 Likes
578

Hi

Your field symbol should be type line of imard

FIELD-SYMBOLS: <ls_mard> LIKE LINE of imard.

Read only

Former Member
0 Likes
578

hi,

Check This form SAP Help.

I think This will Help U.

When you use LOOP AT itab, the header line of the internal table itab is used as the output area (this is only possible for tables with a header line). When you use LOOP AT itab INTO wa, the explicitly specified work area wa is used as the output area. In both cases, the current table line is copied into the output area.

To avoid the costs for the copy process, you can use the additions ASSIGNING <fs> and REFERENCE INTO dref. In both cases, the system directly processes the contents of the internal table. If you use the ASSIGNING addition, the field symbol <fs> points to the respective current line. If you use REFERENCE INTO dref, the reference of the current line is put into dref. Within the loop, neither the field symbol <fs> nor the reference dref must be processed.

If the table is empty, or if the additions prevent the system from choosing an entry, the output area (field symbol or the reference variable) remains unchanged. At the end of the loop, the output area displays (or the field symbol or the reference points to) the last entry selected.

Read only

Former Member
0 Likes
578

As you have declared the field symbols as type any it cannot identify the column you have specified.

You should do this.

FIELD-SYMBOLS: <ls_mard> like line of table imard.

Regards,

Ravi