Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

regarding interactive alv using module pool using methods

Former Member
0 Likes
410

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.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
368

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

1 REPLY 1
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
369

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