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

Problem with a very deep structure

ekekakos
Participant
0 Likes
1,460

I have a very deep structure that is:

TYPES: BEGIN OF ty_header,
         version TYPE string,
       END OF ty_header.
TYPES: BEGIN OF ty_company_info,
         comptin      TYPE string,
         fydateend    TYPE string,
         bookcateg    TYPE numc2,
         acccodemaskg TYPE string,
         acccodemaska TYPE string,
         acccodemaskt TYPE string,
         chartcode    TYPE string,
         chartdescr   TYPE string,
       END OF ty_company_info.

TYPES: BEGIN OF ty_relations,
         acc     TYPE char14,
         reltype TYPE numc2,
       END OF ty_relations,
       tt_relations TYPE TABLE OF ty_relations WITH EMPTY KEY.

TYPES: BEGIN OF ty_accounts,
         acc                 TYPE string,
         descr               TYPE string,
         cat                 TYPE i,
         acckind             TYPE string,
         relations           TYPE tt_relations,
         vatcat              TYPE numc2,
         vatprc              TYPE p,
         vatexemptreason     TYPE string,
         busacttype          TYPE numc2,
         tradetype           TYPE numc2,
         offactcode          TYPE string,
         isdeduction         TYPE char1,
         deductionoffcodedet TYPE string,
         deductionoffcode    TYPE string,
         stampdutyoffcode    TYPE string,
         taxoffcode          TYPE string,
         extrataxoffcode     TYPE string,
         deductvattype       TYPE numc2,
       END OF ty_accounts,
       tt_accounts TYPE TABLE OF ty_accounts WITH EMPTY KEY.

TYPES: BEGIN OF ty_adata,
         companyinfo TYPE ty_company_info,
         accounts    TYPE tt_accounts,
       END OF ty_adata,
       tt_adata TYPE TABLE OF ty_adata WITH EMPTY KEY.


TYPES: BEGIN OF ty_accledg,
         header TYPE ty_header,
         data   TYPE tt_adata,
       END OF ty_accledg.
DATA: str_accledg         TYPE   ty_accledg.

when I am trying to do the below

APPEND VALUE #( acc = '01' descr = 'Elias test' cat = 11 ) TO str_accledg-data-accounts.

The error is ""STR_ACCLEDG-DATA" is a table without a header line and therefore does not have a component called "ACCOUNTS"."

What is wrong?

Thanks

1 ACCEPTED SOLUTION
Read only

BiberM
Contributor
1,358

Hi,

str_accledg-data is of type tt_adata, so a table.

So:

str_accledg = VALUE #( 
  Data = VALUE #( (    "table with one line
    Accounts = VALUE #( (  "table with one line
      acc = '01'
      descr = 'Elias test'
      cat = 11
    ) )
  ) )
).
4 REPLIES 4
Read only

BiberM
Contributor
1,359

Hi,

str_accledg-data is of type tt_adata, so a table.

So:

str_accledg = VALUE #( 
  Data = VALUE #( (    "table with one line
    Accounts = VALUE #( (  "table with one line
      acc = '01'
      descr = 'Elias test'
      cat = 11
    ) )
  ) )
).
Read only

matt
Active Contributor
0 Likes
1,358

That was my thought. Get the brackets right. Or do it classically and then figure it out.

Read only

ekekakos
Participant
0 Likes
1,358

The str_accledg is a structure.

The data is a table.

The companyinfo is a structure

The account is a table and

the relations is a table.

Why I need a header for str_accledg.

Thanks

Read only

elmarmvogt
Explorer
0 Likes
1,358

Try to say ... TYPE STANDARD TABLE OF...