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: 

similar fields grouping in ALV

Former Member
0 Kudos
106

Hi Experts,

I want to display in ALV list in the following format

ship to party <space> sold to city <space> created on

sold to party <space> ship to city <space> changed on

-


<space> -


<space> -


458966 <space> <space>basel <space><space> 20.08.2007

4523633 <space> <space>Geneva <space> <space> 23.08.2007

How to get the output like this??pls help me with the solution.

Thanx in Advance and helpfull answers are surely rewarded.

FAROOK

1 ACCEPTED SOLUTION

Former Member
0 Kudos
71

hi

use hierarchial list display

REUSE_ALV_HIERSEQ_LIST_DISPLAY

4 REPLIES 4

Former Member
0 Kudos
72

hi

use hierarchial list display

REUSE_ALV_HIERSEQ_LIST_DISPLAY

0 Kudos
71

hi premalatha,

can u give me a sample code which serve the purpose??

thanx n regards,

farook

0 Kudos
71

hi check the following code...hope it serves ur requirement

TYPE-POOLS : SLIS.

&----


  • Table declarations

&----


TABLES : PBIM ,

PBED.

&----


  • SELECTION SCREEN DATA

&----


SELECTION-SCREEN SKIP 2.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS : S_MATNR FOR PBIM-MATNR,

S_WERKS FOR PBIM-WERKS,

S_BEDAE FOR PBIM-BEDAE,

S_PBDNR FOR PBIM-PBDNR.

PARAMETERS : P_VERSB LIKE PBIM-VERSB DEFAULT '00'.

SELECTION-SCREEN END OF BLOCK B1.

&----


  • INTERNAL TABLE DECLARATIONS

&----


DATA : BEGIN OF IT_PBIM OCCURS 1,

chk type c,

BDZEI LIKE PBIM-BDZEI,

MATNR(18), " LIKE PBIM-MATNR,

WERKS LIKE PBIM-WERKS,

BEDAE LIKE PBIM-BEDAE,

VERSB LIKE PBIM-VERSB,

PBDNR LIKE PBIM-PBDNR,

VERVS LIKE PBIM-VERVS,

PLNKZ LIKE PBIM-PLNKZ,

END OF IT_PBIM.

DATA : BEGIN OF IT_PBED OCCURS 1,

BDZEI LIKE PBED-BDZEI,

PDATU LIKE PBED-PDATU,

PLNMG LIKE PBED-PLNMG,

MEINS LIKE PBED-MEINS,

LAEDA LIKE PBED-LAEDA,

AENAM LIKE PBED-AENAM,

END OF IT_PBED.

DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.

data : IT_HEADER TYPE SLIS_TABNAME VALUE 'IT_PBIM',

IT_ITEM TYPE SLIS_TABNAME VALUE 'IT_PBED',

IT_KEYINFO TYPE SLIS_KEYINFO_ALV,

IT_LAYOUT TYPE SLIS_LAYOUT_ALV.

&----


  • START-OF-SELECTION

&----


PERFORM POPULATE_KEYINFO.

PERFORM POPULATE_PBIM.

PERFORM POPULATE_PBED.

PERFORM POPULATE_LAYOUT.

PERFORM POPULATE_FIELDCAT.

PERFORM DISPLAY_HS_LIST.

&----


*& Form DISPLAY_HS_LIST

&----


form DISPLAY_HS_LIST .

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

I_CALLBACK_PROGRAM = SY-CPROG

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

IS_LAYOUT = IT_LAYOUT

IT_FIELDCAT = IT_FIELDCAT[]

  • IT_EXCLUDING = IT_EXCLUDING

  • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

  • IT_SORT = IT_SORT

  • IT_FILTER = IT_FILTER

  • IS_SEL_HIDE = 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 = ' '

  • IS_VARIANT = IS_VARIANT

  • IT_EVENTS = IT_EVENTS

  • IT_EVENT_EXIT = IT_EVENT_EXIT

i_tabname_header = it_header

i_tabname_item = it_item

  • I_STRUCTURE_NAME_HEADER = I_STRUCTURE_NAME_HEADER

  • I_STRUCTURE_NAME_ITEM = I_STRUCTURE_NAME_ITEM

is_keyinfo = iT_keyinfo

  • IS_PRINT = IS_PRINT

  • IS_REPREP_ID = IS_REPREP_ID

  • I_BYPASSING_BUFFER = I_BYPASSING_BUFFER

  • I_BUFFER_ACTIVE = I_BUFFER_ACTIVE

  • IR_SALV_HIERSEQ_ADAPTER = IR_SALV_HIERSEQ_ADAPTER

  • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

  • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

TABLES

t_outtab_header = IT_PBIM

t_outtab_item = IT_PBED

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.

endform. " DISPLAY_HS_LIST

&----


*& Form POPULATE_FIELDCAT

&----


form POPULATE_FIELDCAT .

IT_FIELDCAT-FIELDNAME = 'BDZEI'.

IT_FIELDCAT-seltext_l = 'Reqpointer'.

IT_FIELDCAT-TABNAME = 'IT_PBIM'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'MATNR'.

IT_FIELDCAT-seltext_l = 'MaterialNumber'.

IT_FIELDCAT-TABNAME = 'IT_PBIM'.

*IT_FIELDCAT-lzero = 'X'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'WERKS'.

IT_FIELDCAT-seltext_l = 'Site'.

IT_FIELDCAT-TABNAME = 'IT_PBIM'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'BEDAE'.

IT_FIELDCAT-seltext_l = 'ReqType'.

IT_FIELDCAT-TABNAME = 'IT_PBIM'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'VERSB'.

IT_FIELDCAT-seltext_l = 'VersionNum'.

IT_FIELDCAT-TABNAME = 'IT_PBIM'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'PBDNR'.

IT_FIELDCAT-seltext_l = 'ReqNum'.

IT_FIELDCAT-TABNAME = 'IT_PBIM'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'VERVS'.

IT_FIELDCAT-seltext_l = 'ActiveVerIndicator'.

IT_FIELDCAT-TABNAME = 'IT_PBIM'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'PLNKZ'.

IT_FIELDCAT-seltext_l = 'PlanningIndi'.

IT_FIELDCAT-TABNAME = 'IT_PBIM'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'PDATU'.

IT_FIELDCAT-seltext_l = 'OrderFinishedDate'.

IT_FIELDCAT-TABNAME = 'IT_PBED'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'PLNMG'.

IT_FIELDCAT-seltext_l = 'OrderQuan'.

IT_FIELDCAT-TABNAME = 'IT_PBED'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'MEINS'.

IT_FIELDCAT-seltext_l = 'UnitofMeasure'.

IT_FIELDCAT-TABNAME = 'IT_PBED'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'LAEDA'.

IT_FIELDCAT-seltext_l = 'ChangeDate'.

IT_FIELDCAT-TABNAME = 'IT_PBED'.

APPEND IT_FIELDCAT.

IT_FIELDCAT-FIELDNAME = 'AENAM'.

IT_FIELDCAT-seltext_l = 'Userid'.

IT_FIELDCAT-TABNAME = 'IT_PBED'.

APPEND IT_FIELDCAT.

endform. " POPULATE_FIELDCAT

&----


*& Form POPULATE_KEYINFO

&----


form POPULATE_KEYINFO .

IT_KEYINFO-HEADER01 = 'BDZEI'.

IT_KEYINFO-ITEM01 = 'BDZEI'.

endform. " POPULATE_KEYINFO

&----


*& Form POPULATE_PBIM

&----


form POPULATE_PBIM .

SELECT BDZEI

MATNR

WERKS

BEDAE

VERSB

PBDNR

VERVS

PLNKZ

FROM PBIM

INTO CORRESPONDING FIELDS OF

TABLE IT_PBIM WHERE

MATNR IN S_MATNR AND

WERKS IN S_WERKS AND

BEDAE IN S_BEDAE AND

VERSB EQ P_VERSB AND

PBDNR IN S_PBDNR.

endform. " POPULATE_PBIM

&----


*& Form POPULATE_PBED

&----


form POPULATE_PBED .

IF IT_PBIM[] IS NOT INITIAL.

SELECT BDZEI

PDATU

PLNMG

MEINS

LAEDA

AENAM

FROM PBED

INTO TABLE IT_PBED

FOR ALL ENTRIES IN IT_PBIM

WHERE BDZEI EQ IT_PBIM-BDZEI.

ENDIF.

endform. " POPULATE_PBED

&----


*& Form POPULATE_LAYOUT

&----


form POPULATE_LAYOUT .

*IT_LAYOUT-EXPAND_ALL = 'X'.

IT_LAYOUT-ZEBRA = 'X'.

  • IT_LAYOUT-GROUP_CHANGE_EDIT = 'X'.

  • IT_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

  • IT_LAYOUT-ZEBRA = 'X'.

  • IT_LAYOUT-DETAIL_POPUP = 'X'.

  • IT_LAYOUT-GET_SELINFOS = 'X'.

  • IF IT_LAYOUT-EXPAND_ALL = 'X'.

IT_LAYOUT-EXPAND_FIELDNAME = 'CHK'.

  • ENDIF.

endform. " POPULATE_LAYOUT

0 Kudos
71

Hi,

This eg is very usefull eventhough it will not solve my issue.Thank you.here we can display header and corresponding item.in my case all are header fields within which the similar two fields are grouped as,

field1

field2

-


field1 value

field2 value

pls revert if u have any clue.

thanx,

farook