Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

READ_TEXT is not working with in a Loop... Endloop properly.

if there are three records in a loop, it's always fetching long text for last 2 records.

below is the model code:

PARAMETERS: p_ordid TYPE afru-aufnr.
SELECT * FROM afru INTO TABLE it_afru
         WHERE aufnr = p_ordid AND
               ltxa1 <> '0'.
LOOP AT it_afru INTO ws_afru.
  CONCATENATE ws_afru-mandt ws_afru-rueck ws_afru-rmzhl INTO var_name.

  CALL FUNCTION 'READ_TEXT'
    EXPORTING
*     client                  = sy-mandt
      id                       = 'RMEL'
      language             sy-langu
      name                  = var_name
      object                 'AUFK'
    TABLES
      lines                   = tbl_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 EQ 0.

       LOOP AT tbl_lines.

       CONCATENATE tbl_lines-tdline tbl_com-tdline  INTO tbl_com-tdline.

       APPEND tbl_comm.

  ENDIF.

ENDLOOP.

Here in the loop. first time tbl_lines being fetched 3rd line long text of it_afru and then 2nd line long text and when it come for 3 record again it's fetchin last one.

please suggest me on this, i'm missing anything in exporting.

thanks.

ram

Not what you were looking for? View more on this topic or Ask a question