I did immoderate debugging and I stock my solution. I anticipation I volition assistance somenone successful the future.
As I wrote before, ALV lists are managed by people /SCMB/CL_BASE.
At the opening the method CREATE_ALV is called wherever tract catalogue is build. Here we tin find the operation sanction wherever we request to adhd lawsuit fields:
We tin adhd lawsuit fields to this operation utilizing append structure:
In adjacent step, we indispensable capable this tract with data. We bash this successful method CONVERT_DATA_FOR_ALV. I created an implicit enhancement:
The method is cosmopolitan and it works connected generic types truthful I needed to make my ain structures and usage MOVE-CORRESPONDING to transportation information from and to generic variables. We indispensable cheque the operation sanction which is successful tract MS_CREATE_DATA-ASPECT. Data for ALV is in interior array <lt_alv>. The logic of the enhancement:
DATA: BEGIN OF ls_zz_hlp,huident TYPE /scwm/s_asp_todlv_od_avstkdlv-huident,
zz_stack_id TYPE /scwm/s_asp_todlv_od_avstkdlv-zz_stack_id,
END OF ls_zz_hlp.
DATA: lt_zz_hlp LIKE TABLE OF ls_zz_hlp.
DATA: lt_zz_huhdr LIKE TABLE OF ls_zz_hlp.
IF ms_create_data-aspect = '/SCWM/S_ASP_TODLV_OD_AVSTKDLV'.
MOVE-CORRESPONDING: <lt_alv> TO lt_zz_hlp.
IF lt_zz_hlp IS NOT INITIAL.
SELECT huident zz_stack_id
INTO TABLE lt_zz_huhdr
FROM /scwm/huhdr
FOR ALL ENTRIES IN lt_zz_hlp
WHERE huident = lt_zz_hlp-huident.
ENDIF.
LOOP AT <lt_alv> ASSIGNING <ls_alv>.
MOVE-CORRESPONDING <ls_alv> TO ls_zz_hlp.
READ TABLE lt_zz_huhdr ASSIGNING FIELD-SYMBOL(<ls_zz_huhdr>) WITH KEY huident = ls_zz_hlp-huident.
IF sy-subrc = 0.
MOVE-CORRESPONDING <ls_zz_huhdr> TO <ls_alv>.
ENDIF.
ENDLOOP.
ENDIF.
Aa the result, we person a caller file filled with data:
This solution volition enactment with different database similar Other Stock etc.