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

Field symbol is not assigning

DKanna
Explorer
0 Kudos
805

Here is my code and i've tied many steps still not assigning .what is the mistake in this.

TYPES: BEGIN OF gty_ekko,
ebeln TYPE ekko-ebeln,
bukrs TYPE ekko-bukrs,
bsart TYPE ekko-bsart,
aedat TYPE ekko-aedat,
END OF gty_ekko.

DATA: gt_ekko TYPE STANDARD TABLE OF gty_ekko.
FIELD-SYMBOLS: <fs_gs_ekko> like gt_ekko.

TYPES: BEGIN OF gty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
END OF gty_ekpo.

DATA: gt_ekpo TYPE STANDARD TABLE OF gty_ekpo.
FIELD-SYMBOLS:<fs_gs_ekpo> TYPE gty_ekpo.

TYPES: BEGIN OF gty_final,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
bsart TYPE ekko-bsart,
aedat TYPE ekko-aedat,
END OF gty_final.

DATA: gt_final TYPE STANDARD TABLE OF gty_final.
FIELD-SYMBOLS: <fs_gs_final> TYPE gty_final.

PARAMETERS p_ebeln TYPE ekpo-ebeln.

CLEAR gt_ekko.
SELECT ebeln
bukrs
bsart
aedat FROM ekko
INTO TABLE gt_ekko WHERE ebeln = '3000000008'.

IF gt_ekko[] IS NOT INITIAL.
CLEAR gt_ekpo.
SELECT ebeln
ebelp
matnr
menge
meins
netpr FROM ekpo
INTO TABLE gt_ekpo
FOR ALL ENTRIES IN gt_ekko
WHERE ebeln = gt_ekko-ebeln.
ELSE.

WRITE: 'No records'.
ENDIF.

SORT gt_ekko BY ebeln.

LOOP AT gt_ekpo ASSIGNING <fs_gs_ekpo>.

<fs_gs_final>-ebeln = <fs_gs_ekpo>-ebeln.
<fs_gs_final>-ebelp = <fs_gs_ekpo>-ebelp.
<fs_gs_final>-matnr = <fs_gs_ekpo>-matnr.
<fs_gs_final>-menge = <fs_gs_ekpo>-menge.
<fs_gs_final>-meins = <fs_gs_ekpo>-meins.
<fs_gs_final>-netpr = <fs_gs_ekpo>-netpr.

CLEAR <fs_gs_ekko>.
READ TABLE gt_ekko ASSIGNING <fs_gs_ekko>
WITH KEY ebeln = <fs_gs_ekpo>-ebeln BINARY SEARCH.
IF sy-subrc = 0.
<fs_gs_final>-bsart = <fs_gs_ekko>-bsart.
<fs_gs_final>-aedat = <fs_gs_ekko>-aedat.
ENDIF.

APPEND INITIAL LINE TO gt_final ASSIGNING <fs_gs_final>.
CLEAR: <fs_gs_final>, <fs_gs_ekpo>, <fs_gs_ekko>.


ENDLOOP.

LOOP AT gt_final ASSIGNING <fs_gs_final>.
WRITE: / <fs_gs_final>-ebeln, <fs_gs_final>-ebelp,
<fs_gs_final>-matnr, <fs_gs_final>-menge, <fs_gs_final>-meins,
<fs_gs_final>-netpr, <fs_gs_final>-bsart, <fs_gs_final>-aedat.

ENDLOOP.

5 REPLIES 5
Read only

former_member288834
Participant
457

Hi Dhanush,

Below is the code which is causing issue.

FIELD-SYMBOLS: <fs_gs_ekko> like gt_ekko.

It should be like below

FIELD-SYMBOLS: <fs_gs_ekko> type gty_ekko.

Regards

Guru Prasad.

Read only

457

Could you explain what the error is please?

Read only

SimoneMilesi
Active Contributor
457

You know, you should really explain which is your issue, which field symbol is not assigning (debug is your friend) and use the "CODE" button to post coding.

This one isn't, in my opinion, a question for the community, but just a matter of debug and code check.

Even more, your syntax check should be telling you which is the issue! Don't you get any error with it?!

Read only

Sandra_Rossi
Active Contributor
457

Please use the CODE button to format your code so that it's more user-friendly.

Read only

Sandra_Rossi
Active Contributor
457

Next time, please indicate all important elements (3 missing!):

  • that it's an issue with the syntax check,
  • that it gives the message "The row type of the table "GT_EKKO" is not compatible with field symbol type "<FS_GS_EKKO>"
  • that it's at the line "READ TABLE gt_ekko ASSIGNING <fs_gs_ekko>"