Code: Alles auswählen.
* read local buffer
IF i_no_local_buffer IS NOT INITIAL. "reread from database (reset buffer for partner)
DELETE gt_partner_local_buffer WHERE partner = i_partner OR partner_guid = i_partner_guid.
ELSE.
IF i_partner IS NOT INITIAL. "1st try partner NO
ASSIGN gt_partner_local_buffer[ partner = i_partner ] TO FIELD-SYMBOL(<lwa_local_buffer>). "inline declaration + table expression
ELSEIF i_partner_guid IS NOT INITIAL. "2nd try partner GUID
ASSIGN gt_partner_local_buffer[ partner_guid = i_partner_guid ] TO <lwa_local_buffer>. "table expression
ENDIF.
ENDIF.
IF <lwa_local_buffer> IS ASSIGNED.
"return data from local buffer
ewa_partner_data = <lwa_local_buffer>.
RETURN.
ELSE.
" read data from DB or via (Standard) methods/function modules
"...
"...
"(re)read data from database
CLEAR ewa_partner_data.
IF i_partner IS NOT INITIAL.
l_where = |partner = i_partner|.
ewa_partner_data-partner = i_partner.
ELSEIF i_partner_guid IS NOT INITIAL.
l_where = |partner_guid = i_partner_guid|.
ewa_partner_data-partner_guid = i_partner_guid.
ELSE.
"impossible! allready checked
ENDIF.
SELECT SINGLE partner_guid
partner
type
bpkind
name_org1
name_org2
name_last
name_first FROM but000 INTO ewa_partner_data WHERE (l_where).
* append data to local buffer
IF lines( gt_partner_local_buffer ) >= 5000. "self cleanup w/o explicit INIT function - eg. mass data processing
FREE gt_partner_local_buffer. "free buffer table - start rebuild at next access
ENDIF.
APPEND ewa_partner_data TO gt_partner_local_buffer.
ENDIF.
Code: Alles auswählen.
TYPES:
BEGIN OF gts_partner_buffer,
partner_guid TYPE bu_partner_guid,
partner TYPE bu_partner,
type TYPE bu_type,
bpkind TYPE bu_bpkind,
name_org1 TYPE bu_nameor1,
name_org2 TYPE bu_nameor2,
name_last TYPE bu_namep_l,
name_first TYPE bu_namep_f,
END OF gts_partner_buffer.
TYPES:
gtt_partner_buffer TYPE TABLE OF gts_partner_buffer.
Folgende Benutzer bedankten sich beim Autor bigld für den Beitrag:
foessleitnerj
Dann nimm doch eine doppelt indizierte Tabelle.bigld hat geschrieben:...Eine HASHED Table würde natürlich noch einiges mehr bringen, nur müsste ich mich in dem Beispiel dann entweder auf die Partnernummer oder die GUID beschränken, was beim Geschäftspartner ja bekanntlich nicht wirklich möglich ist.
Folgende Benutzer bedankten sich beim Autor black_adept für den Beitrag:
bigld