Hi every one i have an issue while passing the data alv.
I have the itabfinal as output table. Now after passing the itabfinal into cl_slvTable i am able to see the only last record in my ALV.
Code for your reference:
TABLES: hrp1000,hrp1001.
TYPE-POOLS slis.
select-options: otype for hrp1000-otype,
objid for hrp1000-objid.
PARAMETERS:date1 TYPE dats DEFAULT sy-datum.
DATA : acct1 type ref to ZHRP1001.
DATA: itab TYPE STANDARD TABLE OF hrp1000,
wa LIKE LINE OF itab.
data: itabfinal TYPE TABLE OF hrp1001 ,
wa_final LIKE LINE OF itabfinal,
gr_table TYPE REF TO cl_salv_table.
START-OF-SELECTION.
create object acct1.
refresh itab.
select * from hrp1000 into table itab where otype in otype and objid in objid and begda <= date1 and endda >= date1.
clear wa.
loop at itab into wa.
CALL METHOD acct1->getdata
EXPORTING
otype = wa-otype
objid = wa-objid
date1 = date1
IMPORTING
itab = itabfinal.
.
*LOOP AT itabfinal into wa_final .
*write: / wa_final-otype, / wa_final-OBJID , / wa_final-begda, / wa_final-endda, / wa_final-sclas , / wa_final-sobid , / wa_final-relat, / wa_final-plvar.
*skip 1.
*
*ENDLOOP.
ENDLOOP.
end-of-selection.
try.
CALL METHOD cl_salv_table=>factory
* EXPORTING
* list_display = IF_SALV_C_BOOL_SAP=>TRUE
* r_container =
* container_name =
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = ITABFINAL.
endtry.
gr_table->display( ).
Inside Method Getdata Import parameters are "otype ,objid,date1" and export is ITAB.
Code inside the method GETDATA:
method GETDATA.
select otype objid begda endda sclas sobid relat plvar from hrp1001 into corresponding fields of table itab where otype eq otype and objid eq objid and begda <= date1 and endda >= date1.
endmethod.
so finally while passing the Itabfinal into The CL_SALV_TABLE to ALV i am getting the last instance in alv.
For example if i give the input as below :
I am getting the values only from OBJID:50000052 as below: