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: 

reuse alv hierseq list display pgm doubt

Former Member
0 Kudos
390

can anyone tell me s my coding s write or not becos in the report output i cannot view the line item details but it s gettign populated in the itab

REPORT ZTEST_1.

TABLES: KNB1,BSID.

*

TYPE-POOLS: SLIS.

*

*

*TYPES:BEGIN OF TYP_OUTPUT.

  • INCLUDE STRUCTURE ZRFPOSXEXT.

*TYPES:END OF TYP_OUTPUT.

TYPES:BEGIN OF TYP_BSEG,

bukrs like bsid-bukrs,

kunnr like bsid-kunnr,

zuonr like bsid-zuonr,

belnr like bsid-belnr,

bldat like bsid-bldat,

xblnr like bsid-xblnr,

blart like bsid-blart,

dmbtr like bsid-dmbtr,

aufnr like bsid-aufnr,

vbel2 like bsid-vbel2,

posn2 like bsid-posn2,

END OF TYP_BSEG.

TYPES:BEGIN OF TYP_VBRP,

VBELN LIKE VBRP-VBELN,

AUBEL LIKE VBRP-AUBEL,

AUPOS LIKE VBRP-AUPOS,

VKGRP LIKE VBRP-VKGRP,

TDNAME LIKE STXH-TDNAME,

TDLINE LIKE TLINE-TDLINE,

END OF TYP_VBRP.

data: wa_vbrp type typ_vbrp.

DATA:

*GT_HEADER_TABLE TYPE TYP_OUTPUT OCCURS 0 WITH HEADER LINE,

GT_ITEM_TABLE TYPE TYP_VBRP OCCURS 0 WITH HEADER LINE.

DATA: IT_BSEG TYPE TYP_BSEG OCCURS 0 WITH HEADER LINE.

  • Define fieldcatalog

DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

  • Callback program

DATA: G_REPID LIKE SY-REPID.

  • List layout description

DATA: GS_LAYOUT TYPE SLIS_LAYOUT_ALV.

  • Group order criterium

DATA: GS_KEYINFO TYPE SLIS_KEYINFO_ALV.

  • Layout *

    • Definition for field choice screen **

GS_LAYOUT-HEADER_TEXT = 'HEADER'.

GS_LAYOUT-ITEM_TEXT = 'ITEM'.

GS_LAYOUT-DEFAULT_ITEM = 'X'.

*

        • Initialization fieldcatalog ***

G_REPID = SY-REPID.

PERFORM FIELDCAT_INIT USING GT_FIELDCAT[].

*

        • Data selection ***

PERFORM SELECT_DATA.

*

        • Define keyinfo as sort group definition ***

CLEAR GS_KEYINFO.

GS_KEYINFO-HEADER01 = 'BELNR'. "idenify header and item

GS_KEYINFO-ITEM01 = 'VBELN'.

        • Call function to list display (hier-seq) ***

*

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = G_REPID

IS_LAYOUT = GS_LAYOUT

IT_FIELDCAT = GT_FIELDCAT[]

  • I_TABNAME_HEADER = 'GT_HEADER_TABLE'

I_TABNAME_HEADER = 'IT_BSEG'

I_TABNAME_ITEM = 'GT_ITEM_TABLE'

  • I_STRUCTURE_NAME_HEADER = <STRUCTURE_NAME_HEADER>

  • I_STRUCTURE_NAME_ITEM = <STRUCTURE_NAME_ITEM>

IS_KEYINFO = GS_KEYINFO

TABLES

  • T_OUTTAB_HEADER = GT_HEADER_TABLE

T_OUTTAB_HEADER = IT_BSEG

T_OUTTAB_ITEM = GT_ITEM_TABLE

EXCEPTIONS

PROGRAM_ERROR = 1.

        • FORMS ***

FORM FIELDCAT_INIT USING RT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

  • Deviations of group fields to be merged *

    • Initialize group field(s) of header table **

CLEAR LS_FIELDCAT.

ls_fieldcat-col_pos = 1.

LS_FIELDCAT-TABNAME = 'IT_BSEG'.

LS_FIELDCAT-FIELDNAME = 'BLART'.

LS_FIELDCAT-KEY = 'X'. " sets key field

LS_FIELDCAT-SELTEXT_M = 'DOC TYPE'.

LS_FIELDCAT-OUTPUTLEN = 2.

APPEND LS_FIELDCAT TO gt_fieldcat.

CLEAR LS_FIELDCAT.

ls_fieldcat-col_pos = 2.

LS_FIELDCAT-TABNAME = 'IT_BSEG'.

LS_FIELDCAT-FIELDNAME = 'BLDAT'.

LS_FIELDCAT-KEY = 'X'. " sets key field

LS_FIELDCAT-SELTEXT_M = 'DOC DATE'.

LS_FIELDCAT-OUTPUTLEN = 8.

APPEND LS_FIELDCAT TO gt_fieldcat.

CLEAR LS_FIELDCAT.

ls_fieldcat-col_pos = 3.

LS_FIELDCAT-TABNAME = 'IT_BSEG'.

LS_FIELDCAT-FIELDNAME = 'BELNR'.

LS_FIELDCAT-KEY = 'X'. " sets key field

LS_FIELDCAT-SELTEXT_M = 'ACC DOC NO'.

LS_FIELDCAT-OUTPUTLEN = 10.

APPEND LS_FIELDCAT TO gt_fieldcat.

CLEAR LS_FIELDCAT.

ls_fieldcat-col_pos = 4.

LS_FIELDCAT-TABNAME = 'IT_BSEG'.

LS_FIELDCAT-FIELDNAME = 'XBLNR'.

LS_FIELDCAT-KEY = 'X'. " sets key field

LS_FIELDCAT-SELTEXT_M = 'REFERENCE'.

LS_FIELDCAT-OUTPUTLEN = 16.

APPEND LS_FIELDCAT TO gt_fieldcat.

CLEAR LS_FIELDCAT.

ls_fieldcat-col_pos = 5.

LS_FIELDCAT-TABNAME = 'IT_BSEG'.

LS_FIELDCAT-FIELDNAME = 'ZUONR'.

LS_FIELDCAT-KEY = 'X'. " sets key field

LS_FIELDCAT-SELTEXT_M = 'ASSGNMENT NO'.

LS_FIELDCAT-OUTPUTLEN = 19.

APPEND LS_FIELDCAT TO gt_fieldcat.

CLEAR LS_FIELDCAT.

ls_fieldcat-col_pos = 6.

LS_FIELDCAT-TABNAME = 'IT_BSEG'.

LS_FIELDCAT-FIELDNAME = 'DMBTR'.

LS_FIELDCAT-KEY = 'X'. " sets key field

LS_FIELDCAT-SELTEXT_M = 'AMT N LOC CURR'.

LS_FIELDCAT-OUTPUTLEN = 13.

APPEND LS_FIELDCAT TO gt_fieldcat.

    • Initialize keyfield(s) of item table **

CLEAR LS_FIELDCAT.

ls_fieldcat-col_pos = 7.

LS_FIELDCAT-TABNAME = 'GT_ITEM_TABLE'.

LS_FIELDCAT-FIELDNAME = 'AUPOS'.

LS_FIELDCAT-TECH = 'X'. " sets technical field

LS_FIELDCAT-SELTEXT_M = 'LINE ITEM'.

LS_FIELDCAT-OUTPUTLEN = 6.

APPEND LS_FIELDCAT TO gt_fieldcat.

CLEAR LS_FIELDCAT.

ls_fieldcat-col_pos = 8.

LS_FIELDCAT-TABNAME = 'GT_ITEM_TABLE'.

LS_FIELDCAT-FIELDNAME = 'TDLINE'.

LS_FIELDCAT-TECH = 'X'. " sets technical field

LS_FIELDCAT-SELTEXT_M = 'OI NOTES'.

LS_FIELDCAT-OUTPUTLEN = 132.

APPEND LS_FIELDCAT TO gt_fieldcat.

    • Hidden field(s) of tables (header and/or item) **

  • CLEAR LS_FIELDCAT.

    • ls_fieldcat-tabname = '<header/item_table_name>'.

  • LS_FIELDCAT-FIELDNAME = '<GROUP_FIELD_NAME>'.

  • LS_FIELDCAT-NO_OUT = 'X'. "sets hidden field

  • APPEND LS_FIELDCAT TO RT_FIELDCAT.

ENDFORM. "fieldcat_init

----


FORM SELECT_DATA.

data: begin of wa_olino,

tdname like stxh-tdname,

tdline like tline-tdline,

end of wa_olino.

data: it_olino like wa_olino occurs 0 with header line.

data: begin of wa_stxh,

tdname like stxh-tdname,

end of wa_stxh.

data: it_stxh like wa_stxh occurs 0 with header line.

data: begin of wa_lines.

include structure ztline.

data: end of wa_lines.

data: IT_LINES LIKE wa_lines OCCURS 0 WITH HEADER LINE.

select bukrs kunnr zuonr belnr bldat xblnr blart dmbtr aufnr vbel2

posn2

from bsid

into table it_bseg

where kunnr in so_wlkun

and bukrs in so_wlbuk.

select vbeln aubel aupos vkgrp

from vbrp

into table gt_item_table

for all entries in it_bseg

where vbeln = it_bseg-belnr.

sort gt_item_table by aubel aupos.

loop at gt_item_table into wa_vbrp.

concatenate wa_vbrp-aubel wa_vbrp-aupos into wa_olino-tdname.

wa_vbrp-tdname = wa_olino-tdname.

modify gt_item_table from wa_vbrp.

append wa_olino to it_olino.

endloop.

select tdname from stxh into corresponding fields of table it_stxh

for all entries in it_olino

where tdobject = 'VBBP'

and tdname = it_olino-tdname

and tdid = '0002'

and tdspras = 'EN'.

data: j type i,k_lines type i..

sort it_stxh by tdname.

*sort it_output by tdname.

describe table GT_ITEM_TABLE lines k_lines.

*loop at it_output into wa_output. "where blart = '1Z'.

loop at gt_item_table into wa_vbrp.

loop at it_stxh where tdname = wa_vbrp-tdname.

read table it_stxh.

CALL FUNCTION 'ZREAD_TEXT_1'

EXPORTING

  • CLIENT = SY-MANDT

ID = '0002'

LANGUAGE = SY-LANGU

NAME = IT_STXH-tdname

OBJECT = 'VBBP'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = IT_LINES

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

.

*data: I type i.

if sy-subrc = 0.

loop at it_lines.

it_lines-tdname = wa_vbrp-tdname.

modify it_lines. "from wa_lines.

endloop.

loop at it_lines.

*i = sy-tfill.

wa_vbrp-tdline = it_lines.

if sy-tabix = 1.

modify gt_item_table from wa_vbrp.

else.

append wa_vbrp to gt_item_table.

endif.

clear it_lines-tdline.

endloop.

endif.

endloop.

if sy-tabix = k_lines.

exit.

endif.

*

endloop.

*

sort it_olino by tdname.

ENDFORM. " select_data

2 REPLIES 2

Former Member
0 Kudos
88

> GS_KEYINFO-HEADER01 = 'BELNR'. "idenify header and item

> GS_KEYINFO-ITEM01 = 'VBELN'.

hi

the keyinfo tat ur passing is entirely wrong...i think you hav misunderstood de concept of Hierarchial Sequential ALV...its like say for example if im goin 2 display the sales order using reuse alv hierseq list i would be using the following keyinfo

wa_keyinfo-header01 = 'VBELN'.

wa_keyinfo-item01 = 'VBELN'.

Thanks & Regards

Balasubramanian S

Former Member
0 Kudos
88

Hi,

Go thru the following Example program. It can solve ur problem..

&----


*& Report : ZASSG_ALV_JAYARAM3

*& Title : Hierarchical sequential ALV report

*& Author :

*& Created on : *& Request :

*& Desription : Generates a Hierarchial sequental ALV report to list

  • out Billing details.

&----


*& Modification Log

&----


*& Mod # Author Date Requested by

*& Reason for Change

&----


*& 00 #

*&

&----


REPORT ZASSG_ALV_JAYARAM3 NO STANDARD PAGE HEADING

LINE-SIZE 132

LINE-COUNT 64

MESSAGE-ID Z00.

*..Type Definitions for ALV Report

TYPE-POOLS SLIS.

----


  • Table/Structure declarations. *

----


TABLES : VBRK, " Billing: Header Data

VBRP, " Billing: Item Data

T001, " Comapny Codes

TVKOT, " Sales Organizations: Texts

MAKT. " Material Descriiptions

----


*.. Internal Tables declaration *

----


*----- Internal table to store billing docs which are not cancelled

DATA : BEGIN OF IT_VBRK OCCURS 0,

VBELN LIKE VBRK-VBELN, " Billing document

WAERK LIKE VBRK-WAERK, " SD document currency

VKORG LIKE VBRK-VKORG, " Sales organization

VTEXT LIKE TVKOT-VTEXT, " Sales organization text

FKDAT LIKE VBRK-FKDAT, " Billing date

BUKRS LIKE VBRK-BUKRS, " Company Code

BUTXT LIKE T001-BUTXT, " Company Code text

NETWR LIKE VBRK-NETWR, " Net value in document currency

END OF IT_VBRK.

*-----Internal table to stroe ITEM DETAILS

DATA: BEGIN OF IT_VBRP OCCURS 0,

VBELN2 LIKE VBRP-VBELN, " Billing document

POSNR LIKE VBRP-POSNR, " Billing item

FKIMG LIKE VBRP-FKIMG, " Actual billed quantity

VRKME LIKE VBRP-VRKME, " Sales unit

NETWR LIKE VBRP-NETWR, " Net value of the billing item

MATNR LIKE VBRP-MATNR, " Material number

ARKTX LIKE VBRP-ARKTX, " Short text for sales order item

END OF IT_VBRP.

----


  • Variable / Flag Declerations *

----


DATA : FG_COLOR VALUE ' ', " FLAG TO CHANGE THE COLOR OF THE RECORD

FG_NO_DATA VALUE ' '. " FLAG TO CHECK THE DATA

DATA : V_REPID TYPE SYREPID.

----


  • ALV Type declaration *

----


DATA : IT_FIELDCAT TYPE STANDARD TABLE OF

SLIS_FIELDCAT_ALV WITH HEADER LINE.

DATA : IT_SORT TYPE SLIS_T_SORTINFO_ALV,

WA_SORT TYPE SLIS_SORTINFO_ALV.

DATA : IT_EVENT TYPE SLIS_T_EVENT,

WA_EVENT LIKE LINE OF IT_EVENT.

DATA : IT_HEADINGS TYPE STANDARD TABLE OF

SLIS_LISTHEADER WITH HEADER LINE.

DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA : WA_KEYINFO TYPE SLIS_KEYINFO_ALV.

----


  • Selection Screen. *

----


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

SELECT-OPTIONS : S_VBELN FOR VBRK-VBELN, " Billing doc no

S_FKDAT FOR VBRK-FKDAT OBLIGATORY, " Billing date

S_MATNR FOR VBRP-MATNR. " Material no

SELECTION-SCREEN END OF BLOCK B1.

----


  • Event:Initialization *

----


INITIALIZATION.

V_REPID = SY-REPID.

S_FKDAT-LOW = SY-DATUM - 200.

S_FKDAT-HIGH = SY-DATUM.

APPEND S_FKDAT.

----


  • AT Selection Screen. *

----


AT SELECTION-SCREEN.

PERFORM VALIDATE_VBELN.

PERFORM VALIDATE_MATNR.

----


  • Event: Start-of-Selection *

----


START-OF-SELECTION.

PERFORM GET_VBRK_DATA.

PERFORM GET_VBRP_DATA.

----


  • Event: End-of-Selection *

----


END-OF-SELECTION.

PERFORM GET_EVENTS.

PERFORM FIELDCATALOG.

PERFORM LIST_DISPLAY.

//////////////////////////////////////////////////////////////////////

*

  • FORM DEFINITIONS *

*

*//////////////////////////////////////////////////////////////////////

&----


*& Form list_display

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM LIST_DISPLAY.

WA_LAYOUT-INFO_FIELDNAME = 'COLOR'.

WA_LAYOUT-TOTALS_TEXT = 'GRAND TOTAL'.

WA_LAYOUT-ZEBRA = 'X'.

WA_LAYOUT-KEY_HOTSPOT = 'X'.

WA_KEYINFO-HEADER01 = 'VBELN'.

WA_KEYINFO-ITEM01 = 'VBELN2'.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

I_CALLBACK_PROGRAM = V_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

IS_LAYOUT = WA_LAYOUT

IT_FIELDCAT = IT_FIELDCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

IT_SORT = 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 = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

I_TABNAME_HEADER = 'IT_VBRK'

I_TABNAME_ITEM = 'IT_VBRP'

  • I_STRUCTURE_NAME_HEADER =

  • I_STRUCTURE_NAME_ITEM =

IS_KEYINFO = WA_KEYINFO

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB_HEADER = IT_VBRK

T_OUTTAB_ITEM = IT_VBRP

  • 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. " list_display

&----


*& Form fieldcatalog

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FIELDCATALOG.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = V_REPID

I_INTERNAL_TABNAME = 'IT_VBRK'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = V_REPID

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = IT_FIELDCAT[]

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

*..Changing the fieldcatlog as required

LOOP AT IT_FIELDCAT.

CASE IT_FIELDCAT-FIELDNAME.

WHEN 'VBELN'.

IT_FIELDCAT-SELTEXT_L = 'Billing doc no'.

IT_FIELDCAT-SELTEXT_M = 'Bill No'.

IT_FIELDCAT-SELTEXT_S = 'Bill'.

IT_FIELDCAT-OUTPUTLEN = '15'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

OUTPUTLEN

WHERE FIELDNAME = 'VBELN'.

WHEN 'WAERK'.

IT_FIELDCAT-SELTEXT_L = 'SD document Currency'.

IT_FIELDCAT-SELTEXT_M = 'Document Currency'.

IT_FIELDCAT-SELTEXT_S = 'Currency'.

IT_FIELDCAT-OUTPUTLEN = '15'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

WHERE FIELDNAME = 'WAERK'.

WHEN 'VKORG'.

IT_FIELDCAT-SELTEXT_L = 'Sales Organisation'.

IT_FIELDCAT-SELTEXT_M = 'Sales Org'.

IT_FIELDCAT-SELTEXT_S = 'S,Org'.

IT_FIELDCAT-OUTPUTLEN = '15'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

WHERE FIELDNAME = 'VKORG'.

WHEN 'VTEXT'.

IT_FIELDCAT-SELTEXT_L = 'Sales Organisation Name'.

IT_FIELDCAT-SELTEXT_M = 'Sales Org Text'.

IT_FIELDCAT-SELTEXT_S = 'S,Org'.

IT_FIELDCAT-OUTPUTLEN = '30'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

WHERE FIELDNAME = 'VTEXT'.

WHEN 'FKDAT'.

IT_FIELDCAT-SELTEXT_L = 'Billing Date'.

IT_FIELDCAT-SELTEXT_M = 'Bill.Date'.

IT_FIELDCAT-SELTEXT_S = 'BDate'.

IT_FIELDCAT-OUTPUTLEN = '15'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

WHERE FIELDNAME = 'FKDAT'.

WHEN 'BUKRS'.

IT_FIELDCAT-SELTEXT_L = 'Company Code'.

IT_FIELDCAT-SELTEXT_M = 'Company'.

IT_FIELDCAT-SELTEXT_S = 'Comp'.

IT_FIELDCAT-OUTPUTLEN = '15'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

WHERE FIELDNAME = 'BUKRS'.

WHEN 'BUTXT'.

IT_FIELDCAT-SELTEXT_L = 'Company Name'.

IT_FIELDCAT-SELTEXT_M = 'Comp Text'.

IT_FIELDCAT-SELTEXT_S = 'Comp'.

IT_FIELDCAT-OUTPUTLEN = '25'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

WHERE FIELDNAME = 'BUTXT'.

WHEN 'NETWR'.

IT_FIELDCAT-SELTEXT_L = 'Net value in docu currency'.

IT_FIELDCAT-SELTEXT_M = 'Net value in currency'.

IT_FIELDCAT-SELTEXT_S = 'Net Value'.

IT_FIELDCAT-OUTPUTLEN = '20'.

IT_FIELDCAT-DO_SUM = 'X'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

DO_SUM

WHERE FIELDNAME = 'NETWR'.

ENDCASE.

ENDLOOP.

PERFORM FIELDCAT_SECLIST.

ENDFORM. " fieldcatalog

&----


*& Form sort_tab

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM SORT_TAB.

CLEAR WA_SORT.

WA_SORT-FIELDNAME = 'VBELN'.

WA_SORT-SPOS = '1'.

WA_SORT-UP = 'X'.

WA_SORT-SUBTOT = 'X'.

APPEND WA_SORT TO IT_SORT.

ENDFORM. " sort_tab

&----


*& Form get_events

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_EVENTS.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 1

IMPORTING

ET_EVENTS = IT_EVENT

EXCEPTIONS

LIST_TYPE_WRONG = 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.

READ TABLE IT_EVENT INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

WA_EVENT-FORM = 'DISPLAY_HEADER'.

MODIFY IT_EVENT FROM WA_EVENT INDEX SY-TABIX.

ENDFORM. " get_events

&----


*& Form DISPLAY_HEADER

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISPLAY_HEADER.

WRITE : /3 'Date : ',

10 SY-DATUM USING EDIT MASK '__/__/____',

35 'Intelligroup Asia Pvt. Ltd',

80 'Time : ',

90 SY-UZEIT,

/3 'User : ',

10 SY-UNAME,

30 SY-TITLE,

80 'Page : ',

90 SY-PAGNO.

ENDFORM. " DISPLAY_HEADER

&----


*& Form VALIDATE_VBELN

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_VBELN.

  • Validating Billing doc no

SELECT VBELN

INTO VBRK-VBELN

UP TO 1 ROWS

FROM VBRK

WHERE VBELN IN S_VBELN.

ENDSELECT.

IF SY-SUBRC NE 0.

MESSAGE E010. " Invalid billing doc no

ENDIF.

ENDFORM. " VALIDATE_VBELN

&----


*& Form VALIDATE_MATNR

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_MATNR.

  • Validating material no

SELECT MATNR

INTO VBRP-MATNR

UP TO 1 ROWS

FROM VBRP

WHERE MATNR IN S_MATNR.

ENDSELECT.

IF SY-SUBRC NE 0.

MESSAGE E018. " Invalid material number

ENDIF.

ENDFORM. " VALIDATE_MATNR

&----


*& Form GET_VBRK_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_VBRK_DATA.

  • To get Billing doc detials based on selections

SELECT V~VBELN

V~WAERK

V~VKORG

V~FKDAT

V~BUKRS

V~NETWR

T~VTEXT

C~BUTXT

INTO CORRESPONDING FIELDS OF TABLE IT_VBRK

FROM VBRK AS V

INNER JOIN VBRP AS P

ON VVBELN = PVBELN

INNER JOIN TVKOT AS T

ON VVKORG = TVKORG

INNER JOIN T001 AS C

ON VBUKRS = CBUKRS

WHERE V~VBELN IN S_VBELN

AND V~FKDAT IN S_FKDAT

AND P~MATNR IN S_MATNR.

SORT IT_VBRK.

DELETE ADJACENT DUPLICATES FROM IT_VBRK COMPARING VBELN.

IF SY-SUBRC NE 0.

FG_NO_DATA = 'X'.

ENDIF.

ENDFORM. " GET_VBRK_DATA

&----


*& Form GENERATE_SECLIST

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GENERATE_SECLIST USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN '&IC1'. "DOUBLE CLICK

READ TABLE IT_VBRK INDEX RS_SELFIELD-TABINDEX.

ENDCASE.

ENDFORM. " GENERATE_SECLIST

&----


*& Form FIELDCAT_SECLIST

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FIELDCAT_SECLIST.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = V_REPID

I_INTERNAL_TABNAME = 'IT_VBRP'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = V_REPID

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = IT_FIELDCAT[]

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

*..Changing the fieldcatlog as required

LOOP AT IT_FIELDCAT.

CASE IT_FIELDCAT-FIELDNAME.

WHEN 'VBELN2'.

IT_FIELDCAT-NO_OUT = 'X'.

IT_FIELDCAT-KEY = SPACE.

MODIFY IT_FIELDCAT TRANSPORTING NO_OUT

KEY

WHERE FIELDNAME = 'VBELN2'.

WHEN 'POSNR'.

IT_FIELDCAT-SELTEXT_L = 'Billing Iem no'.

IT_FIELDCAT-SELTEXT_M = 'Bill Item No'.

IT_FIELDCAT-SELTEXT_S = 'Item No'.

IT_FIELDCAT-OUTPUTLEN = '15'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

OUTPUTLEN

WHERE FIELDNAME = 'POSNR'.

WHEN 'FKIMG'.

IT_FIELDCAT-SELTEXT_L = 'Actual billed quantity'.

IT_FIELDCAT-SELTEXT_M = 'Billed Quantity'.

IT_FIELDCAT-SELTEXT_S = 'Bill.Qty'.

IT_FIELDCAT-OUTPUTLEN = '15'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

WHERE FIELDNAME = 'FKIMG'.

WHEN 'VRKME'.

IT_FIELDCAT-SELTEXT_L = 'Sales Unit'.

IT_FIELDCAT-SELTEXT_M = 'Sale unit'.

IT_FIELDCAT-SELTEXT_S = 'S.Unit'.

IT_FIELDCAT-OUTPUTLEN = '15'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

WHERE FIELDNAME = 'VRKME'.

WHEN 'NETWR'.

IT_FIELDCAT-SELTEXT_L = 'Net value in docu currency'.

IT_FIELDCAT-SELTEXT_M = 'Net value in currency'.

IT_FIELDCAT-SELTEXT_S = 'Net Value'.

IT_FIELDCAT-OUTPUTLEN = '20'.

IT_FIELDCAT-DO_SUM = 'X'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

DO_SUM

WHERE FIELDNAME = 'NETWR'.

WHEN 'MATNR'.

IT_FIELDCAT-SELTEXT_L = 'Material Number'.

IT_FIELDCAT-SELTEXT_M = 'Mat. Number'.

IT_FIELDCAT-SELTEXT_S = 'Mat. No'.

IT_FIELDCAT-OUTPUTLEN = '30'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

WHERE FIELDNAME = 'MATNR'.

WHEN 'ARKTX'.

IT_FIELDCAT-SELTEXT_L = 'Text for sales order item'.

IT_FIELDCAT-SELTEXT_M = 'Sale Order Text'.

IT_FIELDCAT-SELTEXT_S = 'SO Item text'.

IT_FIELDCAT-OUTPUTLEN = '30'.

MODIFY IT_FIELDCAT TRANSPORTING SELTEXT_L

SELTEXT_M

SELTEXT_S

WHERE FIELDNAME = 'ARKTX'.

ENDCASE.

ENDLOOP.

ENDFORM. " FIELDCAT_SECLIST

&----


*& Form GET_VBRP_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_VBRP_DATA.

SELECT VBELN

POSNR

FKIMG

VRKME

NETWR

MATNR

ARKTX

INTO TABLE IT_VBRP

FROM VBRP

FOR ALL ENTRIES IN IT_VBRK

WHERE VBELN EQ IT_VBRK-VBELN.

ENDFORM. " GET_VBRP_DATA