‎2014 May 08 12:45 PM
Hi Experts,
I have a method that I need to get the values of itab and put it into my main page so that I can use the itab outside the method.
Is it possible for me to do that ? The result of my it_logs should be outside the method.
ZTWEAKED_APPRAISAL_MIGRATION
START-OF-SELECTION.
CALL METHOD: o_upload->display_logs.
(I need to have the values of IT_LOGS here to the the following code..
LOOP AT it_logs INTO wa_logs.
wa_report_log-zrow = wa_logs-zrow.
wa_report_log-message = wa_logs-zmessage.
wa_report_log-status = wa_logs-zstatus.
wa_report_log-changedby = wa_logs-zchangedby.
wa_report_log-changeddate = wa_logs-zchangeddate.
APPEND wa_report_log TO it_report_log.
ENDLOOP.
)
END-OF-SELECTION.
ZTWKHR_APPSAL_MIGRATION_MTD_V3
METHOD display_logs.
DATA: go_alv TYPE REF TO cl_salv_table,
lx_msg TYPE REF TO cx_salv_msg,
lo_events TYPE REF TO cl_salv_events_table,
o_functions TYPE REF TO cl_salv_functions_list. " Object to set PF status.
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = go_alv
CHANGING
t_table = it_logs.
CATCH cx_salv_msg INTO lx_msg.
MESSAGE lx_msg TYPE 'E'.
RETURN.
ENDTRY.
* Get ALV functions
o_functions = go_alv->get_functions( ).
* Set ALV default functions
o_functions->set_default( value = abap_true ).
* Set ALV export function
o_functions->set_export_localfile( value = abap_true ).
* Set ALV print function
o_functions->set_print( value = abap_true ).
* CALL METHOD go_alv->display. "asc
ENDMETHOD. "display_logs
‎2014 May 08 12:56 PM
Hello, from you description the origin of the variable it_logs is not clear. In the case it is variable of the class (ZTWKHR_APPSAL_MIGRATION_MTD_V3?) just set it's visibility to public, then you should be able to access the variable of the class from outside like this
LOOP AT o_upload->it_logs INTO wa_logs.
Br
Bohuslav
‎2014 May 08 1:04 PM
Hi,
Thanks for the response.
ZTWEAKED_APPRAISAL_MIGRATION is my main.
ZTWKHR_APPSAL_MIGRATION_MTD_V3 IS an INCLUDE in my Main Screen.
INCLUDE ZTWKHR_APPSAL_MIGRATION_TOP_V3.
INCLUDE ZTWKHR_APPSAL_MIGRATION_MTD_V3.
INCLUDE ZTWKHR_APPSAL_MIGRATION_SCR_V3.
‎2014 May 08 1:07 PM
Ok, but - where and how do you have your it_logs variable defined?
‎2014 May 09 1:01 AM
Hi,
It is define inside ZTWKHR_APPSAL_MIGRATION_TOP_V3.
CLASS lcl_upload DEFINITION FINAL
PUBLIC SECTION.
TYPES: BEGIN OF typ_logs,
ZROW TYPE ZLOGS_UPLOAD_APPRAISAL-ZROW,
ZMESSAGE TYPE ZLOGS_UPLOAD_APPRAISAL-ZMESSAGE,
ZSTATUS TYPE ZLOGS_UPLOAD_APPRAISAL-ZSTATUS,
ZCHANGEDBY TYPE ZLOGS_UPLOAD_APPRAISAL-ZCHANGEDBY,
ZCHANGEDDATE TYPE ZLOGS_UPLOAD_APPRAISAL-ZCHANGEDDATE,
END OF typ_logs,
DATA: it_logs TYPE TABLE OF typ_logs, "asc
wa_logs LIKE LINE OF it_logs. "asc
.
‎2014 May 09 6:29 AM
Hi, since you have the it_logs variable defined in public section of your class, you are able to access it exactly in the way I have already mentioned even outside the class, doesn't it work?... i.e. from include ZTWEAKED_APPRAISAL_MIGRATION
DATA: wa_logs like line of o_upload->it_logs.
LOOP AT o_upload->it_logs INTO wa_logs.
... " the instance o_upload has to be known and created of course
Br
Bohuslav
‎2014 May 08 1:05 PM
Define it_logs in Top include. So, that method display_logs can access it.