Skip to Content

Reading sales order header text

Hi,

I would like to output sales order header text in an ABAP query. I have coded the following for a field (ZTEXTDETAILS). On executing the ABAP query, the output is not showing any details on the text details field. May I know where I am making mistake? I am functional guy and hence not sure the completeness of the codes. If the text entered is more than 255 characters, is this an issue in ABAP query? (ABAP query column width is 255).

Help is appreciated.

TABLES:STXH.

DATA:

VBELN LIKE VBAK-VBELN,

TDNAME LIKE STXH-TDNAME,

MYLINE LIKE TLINE-TDLINE,

ZE18_LINE(1200) TYPE C.

DATA:BEGIN OF LINES OCCURS 0.

INCLUDE STRUCTURE TLINE.

DATA:END OF LINES.

DATA:BEGIN OF MYHEADER.

INCLUDE STRUCTURE THEAD.

DATA:END OF MYHEADER.

CLEAR ZTEXTDETAILS.

CLEAR TDNAME.

MOVE VBELN TO TDNAME.

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = 'ZE15'

LANGUAGE = SY-LANGU

NAME = TDNAME

OBJECT = 'VBBK'

IMPORTING

HEADER = MYHEADER

TABLES

LINES = LINES

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.

LOOP AT LINES.

MOVE LINES-TDLINE TO ZTEXTDETAILS. "myline.

ENDLOOP.

ENDIF.

Thank you,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 01, 2009 at 01:44 PM
    LOOP AT LINES.
     CONCATENATE  ZTEXTDETAILS LINES-TDLINE INTO ZTEXTDETAILS.
    ENDLOOP.
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 01, 2009 at 01:11 PM

    Dear Shiva,

    In your code you need to append wa to your field.

    e.g.

    LOOP AT LINES.

    MOVE LINES-TDLINE TO ZTEXTDETAILS. "myline.

    Append in internal table

    ENDLOOP.

    Regards,

    Vijay

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 01, 2009 at 01:20 PM
    
    "check ZTEXTDETAILS table contains only one field with lenght equla to LINES-TDLINE other wise 
    "move fails..
    
    LOOP AT LINES.
    MOVE LINES-TDLINE TO ZTEXTDETAILS. "myline.
    append ZTEXTDETAILS.        "add this
    ENDLOOP.
    

    Prabhu

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 01, 2009 at 01:14 PM

    Hi

    your code seems to be right, u shoul insert it in the VBAK node and assign ZTEXTDETAILS to a group.

    U need to optimize your code:

    LOOP AT LINES.
       MOVE LINES-TDLINE TO ZTEXTDETAILS. "myline.
    ENDLOOP.

    In this way only the last line of the text can be displayed, so it's a blank line you couldn't see any text.

    max

    Add comment
    10|10000 characters needed characters exceeded