Application Development 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: 

solve my query " Header and Item data"

Former Member
0 Kudos

Hi friends i have a query

) these are the following fields which i want to display in a output . Header data contains following fields:

*structure declaration for Header data.

matnr like mseg-matnr, "material number

BISMT LIKE MARA-BISMT, "OLD MATERIAL NUMBER

MAKTX LIKE MAKT-MAKTX,

werks like mseg-werks, "plant

NAME1 LIKE T001W-NAME1, "PLANT NAME

.

and Item data contains the following fields:

*structure declaration for Item data.

TYPES:begin of ty_tab6,

lgort like mseg-lgort, "storage location

bwart like mseg-bwart, "movement type

mblnr like mkpf-mblnr, "number of material document

charg like mseg-charg, "batch number

SERNR LIKE OBJK-SERNR, "Serial number

zeile like mseg-zeile, "Item in material document

budat like mkpf-budat, "posting date inthe document

erfmg like mseg-erfmg, "quantity in unit of entry

erfme like mseg-erfme, "unit of entry

BTEXT LIKE T156T-BTEXT, "TRANSACTION DESCRIPTION

for this i have declared 2 internal tables

T_MAT_DATA_HEADER type standard table of ty_tab5,

wa_mat_data_header type ty_tab5,

T_MAT_DATA_ITEM type standard table of ty_tab6,

wa_mat_data_item type ty_tab6.

and i have to use "REUSE_ALV_HIERSEQ_LIST_DISPLAY” function module to display the output

<b>"Now my query is how i move data in T_MAT_DATA_HEADER and T_MAT_DATA_ITEM from Structured define above so that i can pass these tables in function module to display the output.</b>

Thanks

Points will be awarded

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Y dont you user REUSE_ALV_HIERSEQ_LIST_DISPLAY

This will gve the header data & item data in correct output.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = REPID

  • i_structure_name = 'IMREP_MSEG'

I_CALLBACK_PF_STATUS_SET = 'STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND_STD' "n498742

IS_LAYOUT = LAYOUT

IT_FIELDCAT = FIELDCAT[]

  • IT_EXCLUDING =

  • it_special_groups = gruppen[]

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

I_DEFAULT = 'X'

I_SAVE = 'A'

IS_VARIANT = VARIANTE

IT_EVENTS = G_T_EVENT[] "n498742

  • IT_EVENT_EXIT =

I_TABNAME_HEADER = 'HEADER'

I_TABNAME_ITEM = 'BESTAND'

IS_KEYINFO = KEYINFO

IS_PRINT = PRINT

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

TABLES

T_OUTTAB_HEADER = HEADER

T_OUTTAB_ITEM = BESTAND "n498742

EXCEPTIONS "n498742

PROGRAM_ERROR = 1 "n498742

OTHERS = 2. "n498742

"n498742

  • - process exception from ALV "n498742

IF SY-SUBRC <> 0. "n498742

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO "n498742

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. "n498742

ENDIF. "n498742

3 REPLIES 3

Former Member
0 Kudos

Y dont you user REUSE_ALV_HIERSEQ_LIST_DISPLAY

This will gve the header data & item data in correct output.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = REPID

  • i_structure_name = 'IMREP_MSEG'

I_CALLBACK_PF_STATUS_SET = 'STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND_STD' "n498742

IS_LAYOUT = LAYOUT

IT_FIELDCAT = FIELDCAT[]

  • IT_EXCLUDING =

  • it_special_groups = gruppen[]

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

I_DEFAULT = 'X'

I_SAVE = 'A'

IS_VARIANT = VARIANTE

IT_EVENTS = G_T_EVENT[] "n498742

  • IT_EVENT_EXIT =

I_TABNAME_HEADER = 'HEADER'

I_TABNAME_ITEM = 'BESTAND'

IS_KEYINFO = KEYINFO

IS_PRINT = PRINT

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

TABLES

T_OUTTAB_HEADER = HEADER

T_OUTTAB_ITEM = BESTAND "n498742

EXCEPTIONS "n498742

PROGRAM_ERROR = 1 "n498742

OTHERS = 2. "n498742

"n498742

  • - process exception from ALV "n498742

IF SY-SUBRC <> 0. "n498742

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO "n498742

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. "n498742

ENDIF. "n498742

raymond_giuseppi
Active Contributor
0 Kudos

FIrst build the fieldscat, manually or using

  DATA: ls_fieldcat TYPE slis_fieldcat_alv.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            i_internal_tabname = v_items_itable
       CHANGING
            ct_fieldcat        = gt_fieldcat.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            i_internal_tabname = T_MAT_DATA_HEADER
       CHANGING
            ct_fieldcat        = gt_fieldcat.

Then you fill the key structure which link header and detail

  gs_keyinfo-header01 = 'BISMT'.
  gs_keyinfo-item01  = 'BISMT'. " You need to have header keys in detail structure
  gs_keyinfo-item02 = 'MBLNR'.

Then display the ALV

  CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
      i_interface_check              = 'I'
      i_callback_program             = gv_repid
*      i_callback_pf_status_set       = 
*      i_callback_user_command        = 
      is_layout                      = gs_layout
      it_fieldcat                    = gt_fieldcat
*     i_default                      = ' '
      i_save                         = 'A'
      i_tabname_header               ='T_MAT_DATA_HEADER'
      i_tabname_item                 = 'T_MAT_DATA_ITEM'
*      i_structure_name_header        = 
*      i_structure_name_item          = 
      is_keyinfo                     = gs_keyinfo
      i_bypassing_buffer             = 'X'
    TABLES
      t_outtab_header                = T_MAT_DATA_HEADER
      t_outtab_item                  = T_MAT_DATA_ITEM
    EXCEPTIONS
      program_error                  = 1
      OTHERS                         = 2.

Former Member
0 Kudos

thanks my question is answered