2016 Mar 19 4:58 PM
Hi,
I am writing this small code in ABAP editor. I am facing a syntactical error of Filed Type 'I' does not permit a sub field access.
Please explain this error type and also explain how to clear this error.
Please is my program( Just trying to write system date).
DATA: POS TYPE I VALUE 5,
LEN TYPE I VALUE 25.
WRITE AT/ POS(LEN) '********'.
SKIP.
WRITE AT: POS 'DATE', 20 SY-DATUM,
POS 'TIME', 20-SY-UZEIT.
ULINE AT/POS(LEN)
Regards
Shafali Jain
2016 Mar 19 6:03 PM
which line the error is raised? Definitely wrog is 20-SY-UZEIT
you may check Positioning WRITE Output on the List - BC - ABAP Programming - SAP Library
Regards Clemens
2016 Mar 19 8:09 PM
Hi Shafali Jain,
Use the below code.
DATA: POS TYPE I VALUE 5,
LEN TYPE I VALUE 25.
WRITE AT : POS(LEN)'**************************'.
NEW-LINE.
WRITE AT : POS 'DATE', 20 SY-DATUM.
NEW-LINE.
WRITE AT : POS 'TIME', 20 SY-UZEIT.
NEW-LINE.
WRITE AT : POS(LEN) SY-ULINE.
2016 Mar 23 1:09 PM
2016 Mar 23 1:26 PM
Point of order.
The question has not been answered - some one has just given you code that works. You will never learn this way.
I type fields are integer fields and internally they are not held as digits but as binary codes. As a simple example a number from 0 to 65535 can be defined using a 2 byte code where (dependant on what type of processor you are using) you multiply the 2nd character by 256 and add the first.
Similarly Packed BCD's are represented by hex characters representing the values 0 to 9. Floting Point numbers contain a mantissa and an exponent. In all these cases to split them in any way would yield meaningless results.
In reference to your code, as it stands in your original post, the error is not the error quoted but 'Field "AT/" is unknown.
Please try to be correct when you are posting information since incorrect information can waste peoples time.
Rich
2016 Mar 23 2:05 PM
Hi Richard,
I am really sorry. I have just started learning SAP ABAP and with that lots of questions/queries arises.
I am sorry for putting incomplete information.
I will try not to do so again.
Regards
Shafali Jain
2016 Mar 23 2:18 PM
Shafali,
You only learn by doing things yourself. You asked a specific question: 'Please explain this error type' with reference to your 'Type I subfield access' error.
Not one of the people answered this question. Instead they concentrated on the second part of your post which was far easier to answer. Even then they did not explain what they had done - just posted a code listing.
Do you know exactly what was wrong with your code ?
You are just learning. Please don't learn by rote - it does you no good. There is a good site which gives you pointers to asking questions and getting answers:
http://www.catb.org/esr/faqs/smart-questions.html.
Have a good read, and if you cannot see why code works or why it appears different then always ask. And if you still have unanswered questions, re-iterate them in the same thread.
Rich
2016 Mar 23 2:23 PM
Richard,
Thanks for guiding me.
I'll try to fix the code and also consult the site you have provided and if still faces some issue will update in a proper format.
Thanks.
Shafali
2016 Mar 23 2:26 PM