Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

report problem

hi experts,

m workin on one report but it is not fetchin the data..m not getin where the problem is..m sendin u full code..plz do the necessary changes

&----


*& Report ZSD_R_BROKERDETAIL *

*& *

&----


*& *

*& *

&----


REPORT ZSD_R_BROKERDETAIL .

TYPE-POOLS: SLIS.

*******************Table Declaration*********************************

*Table Decleration

TABLES : KNA1,VBPA,VBRK,VBRP,KONV.

***********************************************************************

*ALV data declarations

DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,

GD_LAYOUT TYPE SLIS_LAYOUT_ALV,

GD_REPID LIKE SY-REPID.

  • Data declaration for EVENT and PRINT PARAMETER.

DATA: GT_EVENTS TYPE SLIS_T_EVENT,

GD_PRNTPARAMS TYPE SLIS_PRINT_ALV.

  • data declaration for sorting.

DATA : IT_SORTCAT TYPE SLIS_SORTINFO_ALV OCCURS 1,

WA_SORT LIKE LINE OF IT_SORTCAT.

DATA : I_LIST_COMMENTS TYPE SLIS_T_LISTHEADER.

DATA: V_REPID LIKE SY-REPID.

V_REPID = SY-REPID.

DATA : I_LISTHEADER TYPE SLIS_T_LISTHEADER,

W_LISTHEADER LIKE LINE OF I_LISTHEADER.

DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, "ALV Catalog Table

GS_FIELDCAT TYPE SLIS_FIELDCAT_ALV. "ALV Catalog Structure

************************************************************************

*Input Parameter Decleration for selection

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

SELECT-OPTIONS : P_DATE FOR VBRK-FKDAT,

P_LIFNR FOR VBPA-LIFNR .

SELECTION-SCREEN: END OF BLOCK B1 .

*Internal Table Decleration

DATA: BEGIN OF I_FINAL OCCURS 0,

LIFNR LIKE VBPA-LIFNR,

PARVW LIKE VBPA-PARVW,

VBELN LIKE VBPA-VBELN,

POSNR LIKE VBRP-POSNR,

ADRNR LIKE VBPA-ADRNR,

VBTYP LIKE VBRK-VBTYP,

VKORG LIKE VBRK-VKORG,

VTWEG LIKE VBRK-VTWEG,

KNUMV LIKE VBRK-KNUMV,

FKDAT LIKE VBRK-FKDAT,

KUNRG LIKE VBRK-KUNRG,

KUNAG LIKE VBRK-KUNAG,

NETWR LIKE VBRK-NETWR,

ARKTX LIKE VBRP-ARKTX,

KPOSN LIKE KONV-KPOSN,

KAPPL LIKE KONV-KAPPL,

KAWRT LIKE KONV-KAWRT,

KWERT LIKE KONV-KWERT,

KBETR LIKE KONV-KBETR,

WAERS LIKE KONV-WAERS,

KKURS LIKE KONV-KKURS,

KMEIN LIKE KONV-KMEIN,

NAME1 LIKE KNA1-NAME1,

NAME2 LIKE KNA1-NAME1,

NAME3 LIKE KNA1-NAME1,

END OF I_FINAL.

DATA : IND TYPE I,

IND1 TYPE I.

***************************************************************************

START-OF-SELECTION.

*********************************Data Fetching*************************

SELECT VBPALIFNR VBPAPARVW VBPAVBELN VBPAADRNR VBRKVBTYP VBRKVKORG

VBRKVTWEG VBRKKNUMV VBRKFKDAT VBRKKUNRG VBRKKUNAG VBRKNETWR

  • KONVKPOSN KONVKAPPL KONVKAWRT KONVKBETR KONVWAERS KONVKKURS

VBRPPOSNR VBRPARKTX INTO CORRESPONDING FIELDS OF TABLE I_FINAL

FROM VBPA INNER JOIN VBRK

ON ( VBPAVBELN = VBRKVBELN )

INNER JOIN VBRP

ON ( VBRKVBELN = VBRPVBELN )

  • INNER JOIN MARC

  • ON ( MAKTMATNR = MARCMATNR )

  • INNER JOIN MARA

  • ON ( MARCMATNR = MARAMATNR )

WHERE VBRK~FKDAT IN P_DATE AND

VBPA~PARVW EQ 'ZB' .

LOOP AT I_FINAL.

IND = SY-TABIX.

SELECT KPOSN KAPPL KAWRT KBETR WAERS KKURS KMEIN KWERT

FROM KONV INTO CORRESPONDING FIELDS OF I_FINAL

WHERE KNUMV EQ I_FINAL-KNUMV AND

KPOSN EQ I_FINAL-POSNR AND

KBETR NE '0.0' AND

KSCHL IN ('ZBR%' , 'ZBRW' , 'ZNB%' , 'ZNBW').

  • KSCHL EQ 'ZBR2'.

ENDSELECT.

SELECT SINGLE NAME1 INTO I_FINAL-NAME1 FROM LFA1

WHERE LIFNR EQ I_FINAL-LIFNR.

SELECT SINGLE NAME1 INTO I_FINAL-NAME2 FROM KNA1

WHERE KUNNR EQ I_FINAL-KUNRG.

SELECT SINGLE NAME1 INTO I_FINAL-NAME3 FROM KNA1

WHERE KUNNR EQ I_FINAL-KUNAG.

MODIFY I_FINAL INDEX IND.

ENDLOOP.

LOOP AT I_FINAL.

IND = SY-TABIX.

IF I_FINAL-KAWRT IS INITIAL.

DELETE I_FINAL INDEX IND.

  • MODIFY I_FINAL INDEX IND.

ENDIF.

ENDLOOP.

***************Display of Data*************************

PERFORM TOP_OF_PAGE.

PERFORM BUILD_LAYOUT.

PERFORM DISPLAY_ALV_REPORT.

&----


*& Form build_layout

&----


FORM BUILD_LAYOUT .

GD_LAYOUT-NO_INPUT = 'X'.

GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

GD_LAYOUT-TOTALS_TEXT = 'Totals'(201).

  • Set layout field for row attributes(i.e. color)

GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.

  • gd_layout-totals_only = 'X'.

  • gd_layout-f2code = 'DISP'. "Sets fcode for

*when double

  • "click(press f2)*

  • gd_layout-group_change_edit = 'X'.

  • gd_layout-header_text = ''.

GD_LAYOUT-WINDOW_TITLEBAR = 'Broker Detail Report'.

ENDFORM. " build_layout

&----


*& Form display_alv_report

&----


FORM DISPLAY_ALV_REPORT .

GD_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = GD_REPID

IS_LAYOUT = GD_LAYOUT

I_CALLBACK_TOP_OF_PAGE = 'TOPOFPAGE1'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

  • i_callback_pf_status_set = 'SET_PF_STATUS'

  • it_event = gt_events

  • is_print = gd_prntparams

IT_FIELDCAT = FIELDCATALOG[]

  • it_sort = it_sortcat

I_SAVE = 'X'

TABLES

T_OUTTAB = I_FINAL[]

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_alv_report

&----


*& Form TOP_OF_PAGE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM TOP_OF_PAGE .

PERFORM CAT_BUILD USING 'NAME1' 'BROKER NAME' 1.

PERFORM CAT_BUILD USING 'VBELN' 'INVOICE NO' 2.

PERFORM CAT_BUILD USING 'NAME2' 'CUSTOMER' 3.

PERFORM CAT_BUILD USING 'NAME3' 'PAYER' 4.

PERFORM CAT_BUILD USING 'ARKTX' 'ITEM' 5.

PERFORM CAT_BUILD USING 'KAWRT' 'ITEM VALUE' 6.

PERFORM CAT_BUILD USING 'KWERT' 'BROKAGE' 7.

PERFORM CAT_BUILD USING 'POSNR' 'ITEM NO' 8.

ENDFORM. " TOP_OF_PAGE

&----


*& Form cat_build

&----


  • text

----


  • -->P_0639 text

  • -->P_0640 text

----


FORM CAT_BUILD USING VALUE(P1)

VALUE(P2)

VALUE(P3) TYPE I.

FIELDCATALOG-FIELDNAME = P1.

FIELDCATALOG-SELTEXT_M = P2.

FIELDCATALOG-COL_POS = P3.

FIELDCATALOG-OUTPUTLEN = 20.

APPEND FIELDCATALOG TO FIELDCATALOG.

CLEAR FIELDCATALOG.

CLEAR : P1, P2, P3.

ENDFORM. " cat_build

&----


*& Form topofpage1

&----


  • text

----


FORM TOPOFPAGE1.

CLEAR :W_LISTHEADER,

I_LISTHEADER.

DATA : DATEPD(10) TYPE C.

  • W_LISTHEADER-TYP = 'S'.

  • W_LISTHEADER-KEY = 'Date'.

  • CONCATENATE P_DATE-LOW ' ' INTO W_LISTHEADER-INFO.

  • CONCATENATE W_LISTHEADER-INFO ' to ' P_DATE-HIGH INTO W_LISTHEADER-INFO.

*

  • APPEND W_LISTHEADER TO I_LISTHEADER.

  • CLEAR W_LISTHEADER.

*

DATA : DATE(2),

MONTH(2),

YEAR(4),

DATE2(10).

DATE = P_DATE-LOW+6(2).

MONTH = P_DATE-LOW+4(2).

YEAR = P_DATE-LOW+0(4).

CONCATENATE DATE '.' MONTH '.' YEAR INTO DATE2.

  • date = P_DATE-LOW .

  • date1 = P_DATE-HIGH.

CONCATENATE DATE2 ' ' INTO W_LISTHEADER-INFO.

DATE = P_DATE-HIGH+6(2).

MONTH = P_DATE-HIGH+4(2).

YEAR = P_DATE-HIGH+0(4).

CONCATENATE DATE '.' MONTH '.' YEAR INTO DATE2.

CONCATENATE W_LISTHEADER-INFO ' to ' DATE2 INTO W_LISTHEADER-INFO.

*IF not P_DATE IS INITIAL.

APPEND W_LISTHEADER TO I_LISTHEADER.

  • endif.

CLEAR W_LISTHEADER.

if p_date is initial.

W_LISTHEADER-TYP = 'S'.

W_LISTHEADER-KEY = 'Run Date'.

WRITE SY-DATUM TO DATEPD.

W_LISTHEADER-INFO = DATEPD.

APPEND W_LISTHEADER TO I_LISTHEADER.

endif.

CLEAR W_LISTHEADER.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = I_LISTHEADER.

  • I_LOGO = 'ZKRBL_LOGO'.

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

**select-options s_categ for zcst-zcatg.

**select-options s_plant for zcst-zwerks.

ENDFORM.

&----


*& Form DISPLAY_DOC

&----


FORM USER_COMMAND USING G_UCOMM LIKE SY-UCOMM

G_SELFIELD TYPE SLIS_SELFIELD.

*break-point.

IF G_UCOMM = '&IC1'.

*break-point.

IF G_SELFIELD-SEL_TAB_FIELD = '1-VBELN'.

READ TABLE I_FINAL WITH KEY VBELN = G_SELFIELD-VALUE.

SET PARAMETER ID 'VF' FIELD I_FINAL-VBELN.

CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN..

ENDIF.

ENDIF.

ENDFORM. "user_command_l

END-OF-SELECTION.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question