Frank
Frank

Reputation: 183

Passing the data from the structure into the table

I am trying to pass data from a work area to a table. The idea is that I have declared the elements from the Screen Painter as data from a structure, e.g. The field with the name Banks would be as gs_zfr_bn-bankl, where the structure would be declared in the report as gs_zfr_bn TYPE zfr_bn, where zfr_bn is an global table.

Now I am trying to create a form which would serve to pass the data from the structure to the table, where the form would be activated from the event of pressing a button in the selection screen. I have been trying to create a code for that, however I am having an error. The code to pass the data is shown as follows:

DATA: gt_zfr_bn TYPE TABLE OF zfr_bn.

LOOP AT gt_zfr_bn INTO gs_zfr_bn.
  APPEND LINES OF gs_zfr_bn TO gt_zfr_bn.
ENDLOOP.

The error is that gs_zfr_bn is not an internal table and the append would not work.

Is there any way to pass the data from the structure into the table gt_zfr_bn, be that hard coded or via an method?

Thank you all in advance!

Upvotes: 0

Views: 3024

Answers (2)

József Szikszai
József Szikszai

Reputation: 5071

Just use APPEND without the LINES OF:

  APPEND gs_zfr_bn TO gt_zfr_bn.

(APPEND LINES OF ... this would append the lines of one internal table to another.)

Upvotes: 1

mkysoft
mkysoft

Reputation: 5758

You mention that you already using gs_zfr_bn structure in screen paint. So you don't need to re-declare it. Just append structure to itab.

APPEND gs_zfr_bn TO gt_zfr_bn.

Upvotes: 2

Related Questions