Skip to Content
0
Former Member
Apr 19, 2010 at 12:01 PM

How to merge the 2 field in alv gride display

24 Views

  • Tables for ALV display

DATA: it_fieldcat TYPE slis_t_fieldcat_alv,

wa_fieldcat TYPE slis_fieldcat_alv,

wa_layout TYPE slis_layout_alv,

it_exclude TYPE slis_t_extab,

wa_exclude TYPE slis_extab,

it_header TYPE STANDARD TABLE OF zqm_imir_hdr,

wa_header LIKE LINE OF it_header,

it_final TYPE STANDARD TABLE OF zqm_imir_itm,

wa_final LIKE LINE OF it_final,

it_vcode TYPE RANGE OF zqm_wtr_itm-vcode,

wa_vcode LIKE LINE OF it_vcode.

DEFINE m_fieldcat.

wa_fieldcat-fieldname = &1.

wa_fieldcat-tabname = &2.

wa_fieldcat-seltext_m = &3.

wa_fieldcat-outputlen = &4.

wa_fieldcat-col_pos = &5.

append wa_fieldcat to it_fieldcat.

clear wa_fieldcat.

END-OF-DEFINITION.

DEFINE m_vcode.

wa_vcode-option = &1.

wa_vcode-sign = &2.

wa_vcode-low = &3.

wa_vcode-high = ''.

append wa_vcode to it_vcode.

clear wa_vcode.

END-OF-DEFINITION.

START-OF-SELECTION.

PERFORM data_retrival.

PERFORM lead_time_calculation.

IF it_final[] IS NOT INITIAL.

PERFORM alv_display.

ENDIF.

  • Display ALV

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

is_layout = wa_layout

it_fieldcat = it_fieldcat

i_save = c_x

it_excluding = it_exclude

TABLES

t_outtab = IT_OUTPUT[]

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.

m_fieldcat: 'ZIMIRNO' 'IT_OUTPUT' text-003 21 0,

'PRUEFLOS' 'IT_OUTPUT' text-004 21 1,

'ZCRDAT' 'IT_OUTPUT' text-030 9 2,

'INITS' 'IT_OUTPUT' text-031 6 3,

'SPLIT' 'IT_OUTPUT' text-005 12 4,

'WERK' 'IT_OUTPUT' text-006 5 5,

'LOSMENGE' 'IT_OUTPUT' text-007 24 6,

'MENGENEINH' 'IT_OUTPUT' text-008 15 7,

'NAMEVEND' 'IT_OUTPUT' text-009 11 8,

*& Hypercare - 721600 - IMIR Changes - Start

  • 'KONT_PSPNR' 'IT_OUTPUT' text-023 15 7,

'POSID' 'IT_OUTPUT' text-023 15 9,

*& Hypercare - 721600 - IMIR Changes - End

'LTEX1' 'IT_OUTPUT' text-024 24 10,

'EBELN' 'IT_OUTPUT' text-010 26 11,

'MBLNR' 'IT_OUTPUT' text-011 24 12,

'ANZGEB' 'IT_OUTPUT' text-012 17 13,

'GEBEH' 'IT_OUTPUT' text-013 4 14,

'MATNR' 'IT_OUTPUT' text-014 18 15,

'TXZ01' 'IT_OUTPUT' text-015 128 16,

'SPECE' 'IT_OUTPUT' text-016 23 17,

'VCODE' 'IT_OUTPUT' text-017 24 18,

'TAGNO' 'IT_OUTPUT' text-018 10 19,

'HEATNO' 'IT_OUTPUT' text-019 11 20,

'IDCODE' 'IT_OUTPUT' text-020 7 21,

'TCNO' 'IT_OUTPUT' text-021 9 22,

'REMARKS' 'IT_OUTPUT' text-022 30 23,

'BUDAT' 'IT_OUTPUT' text-025 30 24,

'CPUTM' 'IT_OUTPUT' text-026 30 25,

'VDATUM' 'IT_OUTPUT' text-027 30 26,

'VEZEITERF' 'IT_OUTPUT' text-028 30 27,

  • 'ZLTIME' 'IT_OUTPUT' text-029 30 26,

'LEADTIME' 'IT_OUTPUT' text-029 30 28.

DATA : v_unit like T006-MSEHI VALUE 'HR',

v_FCALID like SCAL-FCALID,

v_zltim TYPE f,

v_zltime TYPE p LENGTH 8 DECIMALS 2.

SELECT SINGLE FABKL INTO v_FCALID FROM T001W WHERE WERKS = s_werks.

SELECT zcrdat INTO TABLE it_zqm_imir_hdr

from zqm_imir_hdr

FOR ALL ENTRIES IN it_final

where zcrdat EQ it_final-zcrdat.

SELECT mblnr mjahr budat cputm

INTO TABLE it_mkpf

from mkpf

FOR ALL ENTRIES IN it_final

where mblnr EQ it_final-mblnr

AND mjahr EQ it_final-mjahr.

SELECT prueflos vdatum vezeiterf

INTO TABLE it_qave

from qave

FOR ALL ENTRIES IN it_final

where prueflos EQ it_final-prueflos.

SORT it_mkpf BY mblnr mjahr.

SORT it_qave by prueflos.

SORT it_zqm_imir_hdr BY zcrdat.

LOOP AT it_final into wa_final.

CLEAR: wa_output,wa_mkpf,wa_qave,wa_zqm_imir_hdr.

MOVE-CORRESPONDING wa_final to wa_output.

.

READ TABLE it_zqm_imir_hdr INTO wa_zqm_imir_hdr WITH KEY zcrdat = wa_final-zcrdat

BINARY SEARCH.

READ TABLE it_mkpf INTO wa_mkpf WITH KEY mblnr = wa_final-mblnr

mjahr = wa_final-mjahr

BINARY SEARCH.

MOVE wa_zqm_imir_hdr-zcrdat TO wa_output-zcrdat.

.

MOVE wa_mkpf-budat TO wa_output-budat.

MOVE wa_mkpf-cputm TO wa_output-cputm.

READ TABLE it_qave INTO wa_qave WITH KEY prueflos = wa_final-PRUEFLOS

BINARY SEARCH.

MOVE wa_qave-vdatum TO wa_output-vdatum.

MOVE wa_qave-vezeiterf TO wa_output-vezeiterf.

LV_START_DATE = wa_zqm_imir_hdr-zcrdat.

LV_START_DATE = wa_mkpf-budat.

LV_START_TIME = wa_mkpf-cputm.

LV_END_TIME = wa_qave-vezeiterf.

LV_END_DATE = wa_qave-vdatum.

IF LV_START_DATE IS NOT INITIAL.

IF LV_END_DATE IS NOT INITIAL.

CALL FUNCTION 'SD_CALC_DURATION_FROM_DATETIME'

EXPORTING

i_date1 = LV_START_DATE

i_time1 = LV_START_TIME

i_date2 = LV_END_DATE

i_time2 = LV_END_TIME

IMPORTING

E_TDIFF = LV_DIFF

  • E_DATE2_EARLY = E_DATE2_EARLY

  • EXCEPTIONS

  • INVALID_DATETIME = 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.

eNDFORM.}

This is my code unable to merge the to tabs position is on 3rd and 4th.

need help ......

thanks,