Skip to Content
avatar image
Former Member

Merge 2 tables using PROVIDE

Dear gurus, I need to merge two internal tables according to BEGDA&ENDDA. I believe, the best way to do this is to use PROVIDE. But I am not completely understanding how to do this.

Here is my code, kindly help me to do the merge in the correct way.

Thanks in advance.

BEGIN OF ty_tab,
      plans TYPE plans,
      wbs   TYPE sobid,
      begda TYPE begda,
      endda TYPE endda,
  END OF ty_tab,

data: lt_tab1  type table of ty_tab,
      lt_tab2  type table of ty_tab,
      lt_merge type table of ty_tab.

data: ls_tab1  type ty_tab,
      ls_tab2  type ty_tab,
      ls_merge type ty_tab.

data: lv_flag1 type flag,
      lv_flag2 type flag.

*** Filling Data In Tables ***

                FROM lt_tab1 INTO ls_tab1 VALID lv_flag1
                BOUNDS begda AND endda
           FIELDS *
                FROM lt_tab2 INTO ls_tab2 VALID lv_flag2
                BOUNDS begda AND endda
           BETWEEN ls_tab1-begda AND ls_tab1-endda.

    IF lv_flag1 = abap_true AND lv_flag2 = abap_true.

      ls_merge-begda = ls_tab1-begda.
      ls_merge-endda = ls_tab1-endda.
      ls_merge-plans = ls_tab1-plans.
      ls_merge-wbs   = ls_tab1-wbs.

      APPEND ls_merge TO lt_merge.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers