Hi experts,
I have a problem storing data retrieved from an SQL Join Operation.
The context is about retrieving business partners from several marketing target groups that are used in a specific campaign in SAP CRM.
Tables used here:
CRMD_MKTTG_TG_H (Header Information: Which target groups are there --> contains a foreign key)
CRMD_MKTTG_TG_I (Items per Target Group, such as business partners)
Assume I got the right Targetgrp_GUID (foreign key -> Header) to acess this header information.
Here we declare a sample data structure to store the data in:
types: begin of lcl_bp_struc,
targetgrp_guid type cgpl_guid16,
targetgrp_id type CRMT_TARGETGRP_ID,
tg_bpguid type CGpl_guid16,
partner type bu_partner,
end of lcl_bp_struc.
data lcl_bp_tab type TABLE OF lcl_bp_struc.
I wrote a join operation to process on these two tables:
loop at lt_guid_list into ls_guid_list. //contains all relevant foreign keys to loop through different relevant target groups
SELECT header~guid items~BP_GUID //header~guid is the same as items~tg_guid = internal target group guid
into CORRESPONDING FIELDS OF table lcl_bp_tab (I know I could have named it more properly )
from CRMD_MKTTG_TG_H as header
join CRMD_MKTTG_TG_I as items
on header~guid = items~tg_guid
where header~set_guid = ls_guid_list-targetgrp_guid. //set_guid = foreign key
endloop.
To my oppinion, this operation is correct. I even get a result - unfortunately just 2 empty rows.
Why is this? I hope you guys can help out...
Best regards,
Paul