Skip to Content
avatar image
Former Member

Insert entries in ABAP QUERY

Hi

I have an abap query with tables VBRK and VBRP.

The result is all of the items of VBRP.

I want to join this with the item texts, with function READ_TEXT.

How can I do that?

Thanks

Dora

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 01, 2015 at 07:59 AM

    now, I think it is easy to call FM and get the text. So could you please try this code,

    may it help you,


    REPORT zibo_pg_test99.

    TYPES: BEGIN OF ty_vbrp.
            INCLUDE STRUCTURE vbrp.
    TYPES: item_txt TYPE wcf_ust_description,
    END OF ty_vbrp.

    DATA lt_vbrp TYPE TABLE OF ty_vbrp.

    DATA lv_name TYPE tdobname.
    DATA lt_item_txt TYPE TABLE OF tline.
    DATA ls_item_txt TYPE tline.

    FIELD-SYMBOLS <ls_vbrp> TYPE ty_vbrp.

    DATA lr_alv TYPE REF TO cl_salv_table.

    START-OF-SELECTION.

      SELECT *
        INTO CORRESPONDING FIELDS OF TABLE lt_vbrp UP TO 10 ROWS
        FROM vbrp AS item
        INNER JOIN vbrk AS header
      ON header~vbeln = item~vbeln.


      LOOP AT  lt_vbrp ASSIGNING <ls_vbrp>.
        CONCATENATE <ls_vbrp>-vbeln <ls_vbrp>-posnr INTO lv_name.
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
            id       = '0001'
            language = sy-langu
            name     = lv_name
            object   = 'VBBP'
          TABLES
            lines    = lt_item_txt
          EXCEPTIONS
            id       = 1
            OTHERS   = 2.
        IF sy-subrc <> 0.
          CONTINUE.
        ENDIF.

        LOOP AT lt_item_txt INTO ls_item_txt.
          CONCATENATE  <ls_vbrp>-item_txt

              ls_item_txt-tdline INTO <ls_vbrp>-item_txt.
        ENDLOOP.

      ENDLOOP.
      cl_salv_table=>factory(
                    IMPORTING
                      r_salv_table   = lr_alv
                    CHANGING
                       t_table        = lt_vbrp  ).
      lr_alv->display( ).



    Regards

    Ebrahim


    6.jpg (74.5 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Nov 01, 2015 at 07:52 AM

    Hi

    so at first you can use the FM: Read_Text

    but you have to find out the following details:

    ID

    LANGUAGE

    NAME

    OBJECT

    how can you find them, so you have to do the following steps:

    call transaction: VF03


    This is the FM: Read_Text


    Call transaction: VF03 and select the item, then goto--> item--> item texts.



    ID : 0001

    LANGUAGE : E

    NAME : 0090005177000010 (Billing Document Number+Item Number)

    OBJECT : VBBP


    1.jpg (10.1 kB)
    2.jpg (52.0 kB)
    3.jpg (74.1 kB)
    4.jpg (70.9 kB)
    5.jpg (117.0 kB)
    Add comment
    10|10000 characters needed characters exceeded