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

Table without a header line within a deep structure

Former Member
0 Likes
2,507

Hie All.

I would like to reference a field within a deep structure but i get this error:

"INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM" is a table without a header

line and therefore has no component called "HH".

The code is below:

REPORT  ZIMRA_TEST2.

DATA: PROXY TYPE REF TO ZTMSCO_ZIMRA_IMS_PROCESS_FISCA .

DATA: OUTPUT type ZTMSZIMRA_SUBMIT_INVOICES_SOAP.

DATA: INPUT type ZTMSZIMRA_SUBMIT_INVOICES_SOA1.

 

INPUT-INVOICE-BPN = 'TEST'.

INPUT-INVOICE-CODE = 'LINEITEM'.

INPUT-INVOICE-MACNUM = '172.16.0.50'.

INPUT-INVOICE-DECSTARTDATE = '2016-06-22'.

INPUT-INVOICE-DECENDDATE = '2016-06-22'.

INPUT-INVOICE-DETSTARTDATE = '2016-06-22'.

INPUT-INVOICE-DETENDDATE = '2016-06-22'.

INPUT-INVOICE-CPY = '1'.

INPUT-INVOICE-IND = '1'.

INPUT-INVOICE-INVOICES-RECORD-ITYPE = '1112'.

INPUT-INVOICE-INVOICES-RECORD-ICODE = 'LINEITEM'.


INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM- HH = '1'.

This is how the structure looks like:

I tried to borrow the idea from the thread https://scn.sap.com/thread/1690727 as follows:

DATA: warea TYPE  ZTMSARRAY_OF_INVOICEINVOICESRE.

READ TABLE INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM INTO warea INDEX 1.


warea-HH = '1'.


I get not syntax error, but the field INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM-HH doesn't insert anything in the database. It remains blank.


Regards,


Joseph.

1 ACCEPTED SOLUTION
Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
1,629

As message says:

"INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM" is a table.

So you need to work with it as with table (internal table). It seems you want to insert (or read?) one line and fill value of HH field in that line?

You can simply do it with basic ABAP statements - APPEND/INSERT, READ TABLE ... ASSIGNING / READ TABLE + MODIFY....

Your code example with "warea" does not checks if there really is any line on index 1. And if does exist, you would need to MODIFY table with warea you have changed after READ TABLE.

-- Tomas --

Hie All.

I would like to reference a field within a deep structure but i get this error:

"INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM" is a table without a header

line and therefore has no component called "HH".

The code is below:

REPORT  ZIMRA_TEST2.

DATA: PROXY TYPE REF TO ZTMSCO_ZIMRA_IMS_PROCESS_FISCA .

DATA: OUTPUT type ZTMSZIMRA_SUBMIT_INVOICES_SOAP.

DATA: INPUT type ZTMSZIMRA_SUBMIT_INVOICES_SOA1.

 

INPUT-INVOICE-BPN = 'TEST'.

INPUT-INVOICE-CODE = 'LINEITEM'.

INPUT-INVOICE-MACNUM = '172.16.0.50'.

INPUT-INVOICE-DECSTARTDATE = '2016-06-22'.

INPUT-INVOICE-DECENDDATE = '2016-06-22'.

INPUT-INVOICE-DETSTARTDATE = '2016-06-22'.

INPUT-INVOICE-DETENDDATE = '2016-06-22'.

INPUT-INVOICE-CPY = '1'.

INPUT-INVOICE-IND = '1'.

INPUT-INVOICE-INVOICES-RECORD-ITYPE = '1112'.

INPUT-INVOICE-INVOICES-RECORD-ICODE = 'LINEITEM'.


INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM- HH = '1'.

This is how the structure looks like:

I tried to borrow the idea from the thread https://scn.sap.com/thread/1690727 as follows:

DATA: warea TYPE  ZTMSARRAY_OF_INVOICEINVOICESRE.

READ TABLE INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM INTO warea INDEX 1.


warea-HH = '1'.


I get not syntax error, but the field INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM-HH doesn't insert anything in the database. It remains blank.


Regards,


Joseph.

3 REPLIES 3
Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
1,630

As message says:

"INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM" is a table.

So you need to work with it as with table (internal table). It seems you want to insert (or read?) one line and fill value of HH field in that line?

You can simply do it with basic ABAP statements - APPEND/INSERT, READ TABLE ... ASSIGNING / READ TABLE + MODIFY....

Your code example with "warea" does not checks if there really is any line on index 1. And if does exist, you would need to MODIFY table with warea you have changed after READ TABLE.

-- Tomas --
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,629

Replace the INTO work area by an ASSIGNING <field symbol> so you wont have to later MODIFY the record from the work area.

Regards,

Raymond

Read only

Former Member
0 Likes
1,629

thanks. i used APPEND and it worked fine.

  warea-HH = '1'.

   warea-ITEMCODE = '1'.

   warea-ITEMNAME1 = 'test1'.

   warea-ITEMNAME2 = 'test2'.

   warea-QTY = '1'.

   warea-PRICE = '100'.

   warea-AMT = '100'.

   warea-TAX = '15'.

   warea-TAXR = '15'.

APPEND warea TO INPUT-INVOICE-INVOICES-RECORD-ITEMS-ITEM.


Regards,