Ahmet Cinar
Ahmet Cinar

Reputation: 11

Adding arbitrary field to a dynamic internal table?

I have one big select like this;

SELECT (lv_selection) FROM crms4d_serv_h
        INNER JOIN crm_jest ON crm_jest~objnr = crms4d_serv_h~header_guid
            AND crm_jest~inact = space
        INNER JOIN crms4c_stat_lc_t ON crms4c_stat_lc_t~stat_lifecycle = crms4d_serv_h~stat_lifecycle
            AND crms4c_stat_lc_t~language = sy-langu
        INNER JOIN crms4d_partner ON crms4d_partner~object_id = crms4d_serv_h~object_id
            AND partner_fct = lv_pfct_vendor
        INTO CORRESPONDING FIELDS OF TABLE <t_dyntable>
        WHERE process_type                     =  lv_warr_claim_ptype
              AND crms4d_serv_h~object_id      IN it_warranty_id
              AND posting_date                 IN it_datum
              AND sales_org                    IN it_sales_org
              AND service_org                  IN it_service_org
              AND crms4d_serv_h~stat_lifecycle IN lt_claimable_status
              AND partner_id                   =  iv_vendor
        ORDER BY crms4d_serv_h~object_id.

As you might have guessed lv_selection is dynamic and type of <t_dyntable> is INDEX TABLE.

What I want is basically add a new field to that t_dyntable and fill it from already existed internal table. Object_id is guaranteed to have in that lv_selection and my internal table has that new field and object id. So I want to fill that field with the condition lt_itab-object_id = t_dyntable-object_id (object ids in the lt_itab is same with t_dyntable). If it is not possible I am open to new approaches. Thanks for your help!

I have tried to use method cl_abap_typedescr=>describe_by_data( <t_dyntable>[ 1 ] ). But I couldn't manage to use it.

Upvotes: 0

Views: 164

Answers (0)

Related Questions