2023 Jun 01 11:50 AM
Hi,
I am at my first experience with coding in SQ02
I have tried to add a custom field to an infoset to get the long texts of purchasing lines.
To do this I have followd this link: https://blogs.sap.com/2013/09/19/faq-long-texts-in-plant-maintenance/
Unfortunately I'm stuck since I get this error:
Field "THEAD–TDNAME" is unknown. It is neither in one of the specified
tables nor defined by a "DATA" statement. "DATA" statement.
Can you give help/advise on how to solve the issue?
Thanks in advance
hereafter my code:
CLEAR l_texts.
***************************************************
* Data definition for input parameters
***************************************************
data:
name LIKE thead–tdname,
spras like STXH–tdspras.
***************************************************
* Data definition for output
***************************************************
DATA BEGIN OF txtheader.
INCLUDE STRUCTURE thead.
DATA END OF txtheader.
DATA BEGIN OF txtlines OCCURS 15.
INCLUDE STRUCTURE tline.
DATA END OF txtlines.
***************************************************
* Getting parameter ‘name’ which in case of operation long text
* is combination of mandant, routing number and general counter
***************************************************
CONCATENATE ekpo–ebeln ekpo-ebelp
INTO name.
***************************************************
* Determining language which has been used for long text
* (assuming, that there is only one used #
***************************************************
Select single TDspras into spras from STXH where TDOBJECT = ‘EKPO’
AND TDID = ‘F03’ and TDNAME = name.
***************************************************
* Reading long text into internal table
***************************************************
CALL FUNCTION ‘READ_TEXT’
EXPORTING
client = sy–mandt
id = ‘F03’
language = SPRAS
name = name
object = ‘EKPO’
archive_handle = 0
* LOCAL_CAT = ‘ ‘
IMPORTING
header = txtheader
TABLES
lines = txtlines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy–subrc <> 0.
* Implement suitable error handling here
ENDIF.
***************************************************
* Concatenating long text rows from internal table
* into one, output field
***************************************************
LOOP AT txtlines.
CONCATENATE ltext txtlines–tdline INTO l_texts SEPARATED BY space.
ENDLOOP.
REFRESH txtlines.
2023 Jun 01 12:12 PM
As you use like, you reference should also be a variable of your program, so either
2023 Jun 01 11:51 AM
Hello Pietro,
Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers, as it provides tips for preparing questions that draw responses from our members.
Feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html as well, as that will also help you when preparing questions for the community.
Should you wish, you can revise your question by selecting Actions, then Edit.
Kind regards,
Anne
2023 Jun 01 12:12 PM
As you use like, you reference should also be a variable of your program, so either
2023 Jun 01 5:18 PM
Hi,
I am really a newbie on ABAP. I have tried but without success.
Would you be so kind to show me directly on the code how you would modify it to let it run properly?
It would be much appreciated
Thanks in advance
Pietro
2023 Jun 01 2:27 PM
Hi, I did a test in SQ02 and it looks like you copied/pasted the code in the link you gave.
But when I write the declaration myself, it works. Looking closer, I see that the "-" between THEAD and TDNAME is slightly longer in the copy/pasted version and is not recognized. Delete the "-" and write it directly with your keyboard. Normally it will work.
But verify all the other fields because I thinks they will have the same problem.
2023 Jun 01 7:56 PM
Please edit your question (Actions>Edit), select your code and press the button [CODE], which makes the code appear colored/indented, it'll be easier for people to look at it. Thanks!