‎2007 Sep 26 3:45 PM
Hi all,
I have done alv report using module pools.
i have created details button in the application tool bar.
after selecting one record and press on the details button i am not getting the exact record.
i am sending the code.
**************************
WHEN 'DETAIL'.
CALL METHOD w_grid->get_selected_rows
IMPORTING
et_index_rows = i_selected_rows.
CLEAR sy-pfkey.
SET PF-STATUS 'ALV1' IMMEDIATELY.
REFRESH int_detail.
CLEAR int_detail.
LOOP AT i_selected_rows INTO w_selected_rows.
LOOP AT INT_FINAL INTO W_FINAL .
LOOP AT INT_CATSDB1 INTO W_CATSDB1 where pernr = w_final-pernr.
AT END OF PERNR.
SKIP.
ENDAT.
IF W_CATSDB1-WORKDATE4(2) = P_MONTH OR W_CATSDB1-WORKDATE4(2) = P_PABRP.
W_DETAIL-PERNR = W_CATSDB1-PERNR.
W_DETAIL-PERNR = w_final-pernr.
W_DETAIL-ENAME = W_CATSDB1-ENAME.
W_DETAIL-DATE = W_CATSDB1-WORKDATE.
W_DETAIL-AWART = W_CATSDB1-AWART.
W_DETAIL-HOURS = W_CATSDB1-CATSHOURS.
MOVE W_DETAIL TO INT_DETAIL.
APPEND INT_DETAIL.
CLEAR INT_DETAIL.
ENDIF.
IF W_CATSDB1-WORKDATE+4(2) NE P_MONTH ." OR
W_CATSDB1-WORKDATE+4(2) NE P_PABRP.
CLEAR INT_DETAIL[].
ENDIF.
ENDLOOP.
ENDLOOP.
SORT INT_DETAIL BY DATE PERNR.
DELETE ADJACENT DUPLICATES FROM INT_DETAIL COMPARING DATE.
ENDLOOP.
LOOP AT i_selected_rows INTO w_selected_rows.
LOOP AT INT_FINAL INTO W_FINAL .
LOOP AT INT_CATSDB_OM INTO W_CATSDB_OM WHERE PERNR = W_FINAL-PERNR.
AT END OF PERNR.
SKIP.
ENDAT.
IF W_CATSDB_OM-WORKDATE4(2) <> P_MONTH OR W_CATSDB_OM-WORKDATE4(2) <> P_PABRP.
IF SY-SUBRC = 0.
IF W_DETAIL-DATE+4(2) = P_MONTH.
W_DETAIL-DATE+4(2) = P_PABRP.
CLEAR INT_DETAIL[].
ENDIF.
ENDIF.
W_DETAIL-PERNR = W_CATSDB_OM-PERNR.
W_DETAIL-ENAME = W_CATSDB_OM-ENAME.
W_DETAIL-DATE = W_CATSDB_OM-WORKDATE.
W_DETAIL-AWART = W_CATSDB_OM-AWART.
W_DETAIL-HOURS = W_CATSDB_OM-CATSHOURS.
MOVE W_DETAIL TO INT_DETAIL.
APPEND INT_DETAIL.
CLEAR INT_DETAIL.
SORT INT_DETAIL BY DATE PERNR.
DELETE ADJACENT DUPLICATES FROM INT_DETAIL COMPARING DATE.
ENDIF.
ENDLOOP.
endloop.
ENDLOOP.
after this i am calling the grid here.
can any one give the solution.
thanks and regards,
giri.
‎2007 Sep 26 3:53 PM
Well, what you need to do is loop at the I_SELECTED_ROWS table and then use the row index to read the specific line of your internal table which was passed to the ALV Grid.
LOOP AT i_selected_rows INTO w_selected_rows.
read table INT_FINAL INTO W_FINAL index w_selected_rows-index.
if sy-subrc = 0.
* Do Something.
endif.
endloop.Regards,
RIch Heilman
‎2007 Sep 26 3:53 PM
Well, what you need to do is loop at the I_SELECTED_ROWS table and then use the row index to read the specific line of your internal table which was passed to the ALV Grid.
LOOP AT i_selected_rows INTO w_selected_rows.
read table INT_FINAL INTO W_FINAL index w_selected_rows-index.
if sy-subrc = 0.
* Do Something.
endif.
endloop.Regards,
RIch Heilman