05-11-2010 4:52 AM
Dear Bosses,
I want to develop a report where in the first window material no and base unit will show.
After that if i double click on 'material no' then it will show the description on another window.
please help me solve the problem. And give me some helpful code.
Regards,
Zubaer
05-11-2010 5:46 AM
05-11-2010 4:54 AM
05-11-2010 5:02 AM
Hi,
You can use ALV technique to develop this kind of report.
- First, you show material number and Base unit
- Then, trigger user_command in ALV to call another list display relevant data select by line that you clicked on.
More about this you can search in forum, I think there are a lot of tutorial and examples.
Regards,
Thien
05-11-2010 5:37 AM
Hello,
Try this:
REPORT ztest_rep_him .
TABLES : mara.
TYPE-POOLS : slis.
DATA : BEGIN OF wlt_mara,
matnr LIKE mara-matnr,
mtart LIKE mara-mtart,
END OF wlt_mara.
DATA : lt_mara LIKE TABLE OF wlt_mara,
lt_fieldcat TYPE slis_t_fieldcat_alv,
wlt_fieldcat LIKE LINE OF lt_fieldcat,
lt_pstat TYPE slis_t_extab,
wlt_pstat LIKE LINE OF lt_pstat,
lt_top_header TYPE slis_t_listheader,
wlt_top_header LIKE LINE OF lt_top_header,
ls_layout TYPE slis_layout_alv,
lt_events TYPE slis_t_event,
wlt_events LIKE LINE OF lt_events.
SELECT-OPTIONS : s_matnr FOR mara-matnr.
START-OF-SELECTION.
SELECT matnr mtart INTO CORRESPONDING FIELDS OF TABLE
lt_mara FROM mara UP TO 10 ROWS WHERE matnr IN s_matnr.
END-OF-SELECTION.
PERFORM fill_layout.
PERFORM fill_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_HIM'
i_callback_user_command = 'USER_COMM'
i_callback_top_of_page = 'SET_TOP_OF_PAGE'
i_callback_html_top_of_page = 'SET_TOP_OF_PAGE'
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = ls_layout
it_fieldcat = lt_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_VARIANT = '/DEFAULT'
it_events = lt_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = lt_mara
EXCEPTIONS
program_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&----
*& Form FILL_FIELDCAT
&----
text
----
--> p1 text
<-- p2 text
----
FORM fill_fieldcat .
REFRESH lt_fieldcat.
CLEAR wlt_fieldcat.
wlt_fieldcat-fieldname = 'MATNR'.
wlt_fieldcat-tabname = 'MARA'.
wlt_fieldcat-outputlen = 18.
wlt_fieldcat-col_pos = 1.
wlt_fieldcat-seltext_m = 'Material'.
wlt_fieldcat-hotspot = 'X'.
wlt_fieldcat-edit = 'X'.
APPEND wlt_fieldcat TO lt_fieldcat.
CLEAR wlt_fieldcat.
wlt_fieldcat-fieldname = 'MTART'.
wlt_fieldcat-tabname = 'MARA'.
wlt_fieldcat-outputlen = 10.
wlt_fieldcat-col_pos = 2.
wlt_fieldcat-seltext_m = 'Matl Type'.
wlt_fieldcat-edit = 'X'.
APPEND wlt_fieldcat TO lt_fieldcat.
ENDFORM. " FILL_FIELDCAT
&----
*& Form set_pf_status
&----
text
----
-->LT_PSTAT text
----
FORM set_pf_him USING lt_pstat TYPE slis_t_extab.
SET PF-STATUS 'PF1'.
ENDFORM. "set_pf_status
&----
*& Form SET_TOP_OF_PAGE
&----
text
----
FORM set_top_of_page.
refresh lt_top_header.
CLEAR wlt_top_header.
wlt_top_header-typ = 'H'.
wlt_top_header-info = 'Test TOP OF PAGE'.
APPEND wlt_top_header TO lt_top_header.
CLEAR wlt_top_header.
wlt_top_header-typ = 'S'.
wlt_top_header-info = 'Test TOP OF PAGE number 2'.
APPEND wlt_top_header TO lt_top_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_top_header
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
.
ENDFORM. "SET_TOP_OF_PAGE
FORM user_comm USING p_ucomm TYPE sy-ucomm
p_selfield TYPE slis_selfield.
CASE p_ucomm.
WHEN '&IC1'.
*************code to call the new ALV.*************************
ENDCASE.
ENDFORM. "user_comm
05-11-2010 5:42 AM
Hello Dear,
If you want to do for single material then try like this::::
TYPES : BEGIN OF ty_mara,
matnr TYPE matnr,
meins TYPE meins,
END OF ty_mara.
DATA : ls_MARA TYPE ty_mara,
l_maktx TYPE MAKTX.
PARAMETER : P_matnr LIKE mara-MATNR.
CLEAR : ls_mara,
l_maktx.
AT LINE-SELECTION.
IF SY-LILLI eq 1.
SELECT MAKTX FROM makt INTO l_maktx WHERE
matnr = ls_mara-matnr.
IF l_maktx is NOT INITIAL.
WRITE : / 'Material text' , l_maktx.
ENDIF.
ENDSELECT.
ENDIF.
START-OF-SELECTION.
CONDENSE p_matnr.
SELECT MATNR MEINS FROM MARA into ls_mara
WHERE matnr = P_matnr.
IF sy-subrc eq 0.
FORMAT FRAMES HOTSPOT = 14.
WRITE : /10 'Material No. : ', ls_mara-matnr,
100 'Base Unit : ', ls_mara-meins.
FORMAT FRAMES OFF.
ENDIF.
ENDSELECT.
and if you want for multiple customer insted of Parameter use select option and instead of work area use internal table and display in ALV. and then write a user-command for ALV to display next list.
05-11-2010 5:46 AM
05-11-2010 6:42 AM
Please make sure you (re)search and try yourself before posting a thread.
Thread locked.
Thomas