Application Development 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: 

Getting an error in Smartforms while creating internal table. (using deep table)

Former Member
0 Kudos

Hi,

I am getting a typical error ". expected after PODATA-HEADERTXT".

Here PODATA is internal table and HEADERTXT is a field which is also an internal table. The loop is from PODATA-HEADERTXT into WA_HEADERTXT. (Italicised text added by moderator for clarity)

For better understanding please see the snapshot.

What I know is there is no period to be put in internal table passing values while in forms.

I did try to search on net for this type of error but I did not find any solution.

Please help. Hope to get some solution.

Thanks in advance for your time and efforts.

Best regards,

M.A.M

Message was edited by: Matthew Billingham - clarified that it is a deep table

23 REPLIES 23

Jelena
Active Contributor
0 Kudos

Instead of PODATA-HEADERTXT put just PODATA there. That field is for the internal table name (as in LOOP command).

0 Kudos

Also use a work area of same structure than table, some WAHEADER, in the INTO parameter, not the single required field, and use a WAHEADER-HEADERTEXT as field name in the following nodes.

Hint: Just think at the LOOP AT itab INTO warea statement...

Regards,

Raymond

Former Member
0 Kudos

Thanks Jelena for your response,

I forgot to mention that it is deep structure so I have to declare it as PODATA-headertxt though headertxt itself is a structure in the main structure podata.

So I have to declare it as podata-headertxt. Hope I have cleared the point here. Please do look into this.

Best regards,

M.A.M

Former Member
0 Kudos

Thanks Raymond for your response,

I am using the work area of the same structure, As mentioned in previous reply that it is deep structure. Yes I have declared the syntax as you can see in the attachment on my original question.

Please do look into this for further solution.

Best regards,

M.A.M

matt
Active Contributor
0 Kudos

I think Raymond has it right. You have to

LOOP AT PODATA into PODATA_LINE.

             LOOP AT PODATA_LINE-HEADERTXT into HEADER_LINE.

....

Former Member
0 Kudos

Thanks Matthew for your response.

I am doing as you mentioned still that error is there. If you see the attachment you will understand that syntax is correct. But not able to understand that error ". expected after podata-headertxt".

Note:  It is showing in form not in program.

Best regards,

M.A.M

matt
Active Contributor
0 Kudos

My previous post had an error in it. Please recheck. My previous post was made based on looking at your attachment. Nowhere do you loop through PODATA first.

You are not looping through PODATA into a workarea. Without presenting each line in PODATA to a workarea, you cannot access the deep table.

PODATA-HEADERTXT is syntactically incorrect.

Former Member
0 Kudos

Hi Matthew,

As mentioned I tried just with main internal table with loop. But the same error is still there.

For details please see the snapshot.

matt
Active Contributor
0 Kudos

Right. So you have PO_DATA and WA_PODATA both with the same type ZPO_DATA. You are aware that if they're the same type there's no way you can possibly loop over one into the other?

Are you completely new at ABAP? This kind of stuff is covered in the training.

Former Member
0 Kudos

To pass the values we should have the same structure. This was working fine before with the same syntax in my previous company and it is running successfully and it is live which I am declaring it here. But right now it is giving this type of error.

matt
Active Contributor
0 Kudos

To pass the values we should have the same structure. Nonsense. The table must be a table. The work area must be a line of a table. They absolutely 100% totally cannot under any circumstances be the same type. Not ever. Not in ABAP. Not in any version of ABAP, past present or future. Never.


This was working fine before with the same syntax in my previous company. I seriously doubt it. In ABAP

A type B.

WA type B.

LOOP AT A into WA.

is not syntactically correct (and never has been), unless B is an internal table with header line, which are obsolete and shouldn't be used anyway.


Now,

A type B.

WA line line of B.

LOOP AT A into WA.

will work if B is a table type.

And

A type TABLE OF B.

WA type B.


LOOP AT A into WA.

Will also work.


You are getting syntax errors because what you have programmed is syntactically incorrect. I've identified one place that is absolutely and clearly incorrect. So instead of insisting that what you've written is correct, why not correctly define your data and fix your issue?

Former Member
0 Kudos

Thanks a lot for your time and support. I will look again as you mentioned and come back to update.

Best regards,

Chintu6august
Contributor
0 Kudos

Hi,

you are looping an internal table so you have to write PODATA instead of PODATA-HEADERTXT, because HEADERTXT is a field not an deep structure.

thank you!!

0 Kudos

Thanks Adi for your response,

I forgot to mention that it is deep structure so I have to declare it as PODATA-headertxt though headertxt itself is a structure in the main structure podata.

I have declared the syntax as you can see in the attachment on my original question. Please do look into this.

Best regards,

M.A.M

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

If you want a sample of using deep structure there is one right here:

                  

Note that there is no code in the form.( separation of concerns (SoC))

Regards.

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

IMHO you need to post the structure of your deep structure.  

Regards.

0 Kudos

Hi Eltan,

Thanks for your response. I'll try to look into your link.

For the second post I didn't get exactly what you mentioned. I have declared deep structure in a loop as a normal structure. Later I tried with normal structure in a loop still the same error exists. See my errors snapshot which I post in reply to Mr. Matthew. Still for better understanding I am attaching snapshot of my deep structure.

0 Kudos

Hi,

I do not see any table type here.

Nested tables looks like this

Clicking on WER_DEEP_ITEM_LEVEL2_TTY give you:

clicking on WER_DEEP_ITEM_LEVEL2_STY give you

Note the in cotrast to

Regards.

0 Kudos

Hi,

Do you have something like this ?

Click on WER_DEEP_ITEM_HEADER_STY give you:

And we can see HISTORY table

 

In this case a loop will be on

WER_DEEP_ITEM_LEVEL1_STY-HEADER-HISTORY

              

Regards.

0 Kudos

Hi Eltan,

You mean to say I need to declare that deep structure as table not as structure as shown in snapshots.If I am getting wrong please feel free to correct. Thanks a lot for your support.

Best regards,

M.A.M

0 Kudos

Hi,

Yes if you want to have multiple ITEMS within structure ZPO_DATA .

Have another look at

http://scn.sap.com/community/abap/blog/2013/10/15/deeper-dive-into-deep-structure--part-2

See how the data is declared:

If I test GET_IT_SCARR_1

I get

if I click on the Alitalia IT_SPFLI_1 I get This way we can create hierarchy data :

This way we can create hierarchy data.

Regards.

0 Kudos

Hi,

Also check structure:

WER_DEEP_ITEM_LEVEL1_STY

Regards.

Jelena
Active Contributor
0 Kudos

Mohammad, take a look at the standard Smartform for billing documents LB_BIL_INVOICE. It uses type LBBIL_INVOICE in the interface. It's a good example of how to use deep structures with tables and all.

I do agree with Matthew though - there seems to be lack of understanding of some basic concepts here, you might want to educate yourself further on this. While I agree that deep structures in forms can be confusing, it is not that complex as to require SCN help. (You won't find any questions from me on this and I had just a few months of ABAP experience when I was given the invoice form to work on.)

Just look at the example and try to get a good understanding. It'll help you going forward.