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

Parantheses error on VALUE operator

Former Member
0 Likes
1,685

Hey everyone,

the following code gives me the error "Instead of "(", ")" was expected" for the second opening parentheses. Does anybody know why i get that error?

Thanks in advance!

DATA: GT_BATCH TYPE BDCDATA OCCURS 0 WITH HEADER LINE. 
GT_BATCH = VALUE #( ( PROGRAM = 'SAPMSVMA' DYNPRO = '100' DYNBEGIN = 'X' FNAM = 'VIEWNAME' FVAL = 'ZPP_SV_STOERUNG' ) ( FNAM = 'BDC_OKCODE' FVAL = 'UPD' )).
1 ACCEPTED SOLUTION
Read only

former_member736527
Active Participant
1,595

GT_BATCH in second line is being treated as a work area, since it has been declared as a header line.

Either declare GT_BATCH as below:

DATA: gt_batch TYPE STANDARD TABLE OF bdcdata.

Or use it as below (with square brackets):

GT_BATCH[] = VALUE#((PROGRAM='SAPMSVMA'DYNPRO='100' DYNBEGIN ='X' FNAM ='VIEWNAME' FVAL ='ZPP_SV_STOERUNG')( FNAM ='BDC_OKCODE' FVAL ='UPD')).
7 REPLIES 7
Read only

former_member736527
Active Participant
1,596

GT_BATCH in second line is being treated as a work area, since it has been declared as a header line.

Either declare GT_BATCH as below:

DATA: gt_batch TYPE STANDARD TABLE OF bdcdata.

Or use it as below (with square brackets):

GT_BATCH[] = VALUE#((PROGRAM='SAPMSVMA'DYNPRO='100' DYNBEGIN ='X' FNAM ='VIEWNAME' FVAL ='ZPP_SV_STOERUNG')( FNAM ='BDC_OKCODE' FVAL ='UPD')).
Read only

1,595

That's why internal tables work areas are deemed obsoleted. They can be really confusing as the same statement depending on context means two different variables.

Also I like to always put [] when dealing with table assignments. I do know it's superfluous but this way, I'm sure I refer to an internal table.

Read only

0 Likes
1,595

Agreed! Can't be too careful!

The square brackets also help with the readability of the code. I too use it more often than not!

Read only

1,595

I completely disagree. header tables are obsolete. The only place where header tables have to be used (and thus [ ] makes sense to indicate the table where necessary) is select options.

So long as you name your variables well, specifying that it's an internal table using [ ] is unnecessary and detracts from readability. E.g. users[ ] or user[ ] is less readable and understandable than the simple users.

In my view using square brackets goes against clean code principles. You can be too careful.

The OP should use Taha's first suggestion. It is the correct one.

Read only

0 Likes
1,595

Thanks a lot Taha, i feel like an idiot now.

I knew it was a simple problem, i just didn't see it...

Read only

0 Likes
1,595

It's not a simple problem. It's very difficult to train, to use modern code and stop using old habits of obsolete code. See how many people are still using procedural code.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,595
  1. OCCURS 0 is obsolete.
  2. WITH HEADER LINE is obsolete and error prone. (exactly the case of error you have)

Use:

DATA: gt_batch TYPE STANDARD TABLE OF bdcdata.

and that solves.