‎2021 Mar 25 12:58 PM
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' )).
‎2021 Mar 25 1:13 PM
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')).
‎2021 Mar 25 1:13 PM
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')).
‎2021 Mar 25 1:53 PM
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.
‎2021 Mar 25 3:12 PM
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!
‎2021 Mar 25 4:25 PM
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.
‎2021 Mar 26 10:39 AM
Thanks a lot Taha, i feel like an idiot now.
I knew it was a simple problem, i just didn't see it...
‎2021 Mar 26 2:37 PM
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.
‎2021 Mar 25 8:35 PM
Use:
DATA: gt_batch TYPE STANDARD TABLE OF bdcdata.and that solves.