0
votes

Currently my program writes out the results but I was hoping I can output into an ALV List. Am I able to use the function reuse_alv_list_display?

Below is my code so far:

REPORT  Z_TRANSFORMER_TOOL_BATCH.

TABLES zfit_map_account.

TYPES: BEGIN OF t_account,
        saknr TYPE saknr,
        txt20 TYPE txt20,
        zznew TYPE new_saknr,
        ntx20 TYPE zntx20,
       END OF t_account.

DATA: gwa_account TYPE t_account.
DATA: gt_account TYPE TABLE OF t_account.

SELECT saknr txt20 zznew ntx20
FROM zfit_map_account
INTO gwa_account
WHERE zznew = '1010101998'.
APPEND gwa_account TO gt_account.
ENDSELECT.

Loop at gt_account INTO gwa_account.
  Write :/ gwa_account-saknr, gwa_account-txt20, gwa_account-zznew, gwa_account-ntx20.
ENDLOOP.
1
Why? What have you tried so far? Are you expecting standard selection screen functions (variants, ...) to work? - vwegert
@vwegert I have edited my response with the code I have so far. I want to put it into a ALV list since it's easier to view. - Michael
Your question with the code is a bit confusing. Your code does not have a selection screen. Investigate the classes in the packages of package SALV, it's the modern way of handling ALV. A good start would be example program SALV_DEMO_TABLE_SIMPLE. - Gert Beukema

1 Answers

1
votes

An easy way can be using the cl_salv_table class. You can just do something like this as a replacement of your entire loop section

DATA alv TYPE REF TO cl_salv_table.

TRY.
      cl_salv_table=>factory(
        IMPORTING
          r_salv_table = alv
        CHANGING
          t_table      = gt_account ).
    CATCH cx_salv_msg INTO message.
      " handle error
  ENDTRY.


alv->display( ).