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

Field Length Error while using READ_TEXT FM

anurag_singh16
Participant
643

Hi All,

I am getting an exception CX_SY_DYN_CALL_ILLEGAL_TYPE in my custom program when I call FM READ_TEXT to read the note from an Invoice Document.

I have declared variables with the same data types but dump is saying that the length is different. How?


Below is the code used by me:


DATA:
	gv_key      TYPE tdobname, 
	gv_gjahr(4) TYPE c,
	wa_line     TYPE tline,  
	it_line     TYPE TABLE OF tline.

    gv_gjahr = <fs_blck>-gjahr.
    gv_belnr = <fs_blck>-belnr.
    CONCATENATE gv_belnr gv_gjahr INTO gv_key.

    CALL FUNCTION 'READ_TEXT'
      EXPORTING
*       CLIENT                  = SY-MANDT
        id                      = '0001'
        language                = 'E'
        name                    = gv_key
        object                  = 'RBKP'
*       ARCHIVE_HANDLE          = 0
*       LOCAL_CAT               = ' '
*       IMPORTING
*       HEADER                  =
*       OLD_LINE_COUNTER        =
      TABLES
        lines                   = it_line
      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.

    IF it_line IS NOT INITIAL.
      LOOP AT it_line INTO wa_line.
        CONCATENATE <fs_blck>-note wa_line-tdline INTO <fs_blck>-note.
        CLEAR: wa_line-tdline.
      ENDLOOP.
    ENDIF.

1 ACCEPTED SOLUTION
Read only

roberto_forti
Contributor
0 Kudos
425

Hi Anurag, Can you attache abap dump ? Thanks

5 REPLIES 5
Read only

roberto_forti
Contributor
0 Kudos
426

Hi Anurag, Can you attache abap dump ? Thanks

Read only

425

Hi Santos,


PFB the screenshot for the dump.

Regards,
Anurag

Read only

0 Kudos
425

Hi Anurag, following correct ABAP statements example to figuring it out. Let me know!

 DATA: lt_lines  TYPE STANDARD TABLE OF tline,
       lw_lines  TYPE tline,
       lv_id     TYPE tdid,     "Text ID
       lv_object TYPE tdobject
       lv_name   TYPE tdobname. "Name
...
  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      client                  = sy-mandt
      id                      = lv_id
      language                = sy-langu
      name                    = lv_name
      object                  = lv_object
    TABLES
      lines                   = lt_lines[]
...

Regards

Read only

425

Thanks Santos.

It worked now.

Regards,
Anurag

Read only

0 Kudos
425

Hi Anurag, Great, accept and close question, please! Thanks