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: 

ALV REPORT

Former Member
0 Kudos

Hi All,

This is portion of my code,

read table VT_FIELDCAT into wa_FIELDCAT with key fieldname = 'VALUE_BAL_LEFT'.

wa_fieldcat-coltext = 'Value Bal Left'.

modify VALUE_BAL_LEFT from wa_fieldcat.

But this giving some error ,

error desc : "The dat object "WA_FIELDCAT" does not have a component call "COLTEXT".

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

How is wa_FIELDCAT defined?

Regards,

Rich Heilman

0 Kudos

REPORT ZSAGAR_TASK2 LINE-SIZE 220 LINE-COUNT 36(3) NO STANDARD PAGE

HEADING.

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

  • TABLES DECLARATION

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

TABLES : VBAK,VBAP,VBEP,LIPS.

TYPE-POOLS : SLIS.

data: wa_fieldcat type slis_fieldcat_alv.

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

  • DATA DECLARATION

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

DATA: VT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: VALUE_SA_LINE(16) TYPE P DECIMALS 2,

BAL_LEFT(8) TYPE P DECIMALS 2,

VALUE_BAL_LEFT(13) TYPE P DECIMALS 2,

DELIVERY_PERCENT(9) TYPE P DECIMALS 2.

DATA : CUSTOMER(10) TYPE C VALUE 'CUSTOMER',

MATERIAL(18) TYPE C VALUE 'MATERIAL',

SCHED_AGREE(10) TYPE C VALUE 'SCHED_AGRE',

DATE(8) TYPE C VALUE 'DATE',

ORD_QUAN(13) TYPE C VALUE 'ORDER_QUAN',

VSL(12) TYPE C VALUE 'VAL_SA_LINE',

BAL_LEFT1(8) TYPE C VALUE 'BAL_LEFT',

VAL_BAL_LEFT(13) TYPE C VALUE 'VAL_BAL_LEFT',

DELIVERY_P(9) TYPE C VALUE 'DELIVER_%',

CURR(5) TYPE C VALUE 'CURR',

QUAN_DELIVERED(13) TYPE C VALUE 'Q_DELIVERED'.

DATA : BEGIN OF I_VBEP OCCURS 0,

VBELN LIKE VBEP-VBELN, "Sales Document

EDATU LIKE VBEP-EDATU, "Schedule line date

WMENG LIKE VBEP-WMENG, "Order quantity in sales units

END OF I_VBEP.

DATA : BEGIN OF I_VBAK OCCURS 0,

VBELN LIKE VBAK-VBELN , " Sales Document

KUNNR LIKE VBAK-KUNNR , " Sold-to party

WAERK LIKE VBAK-WAERK , " SD document currency

END OF I_VBAK.

DATA : BEGIN OF I_VBAP OCCURS 0,

VBELN LIKE VBAP-VBELN, "Sales Document

MATNR LIKE VBAP-MATNR, "Material Number

NETPR LIKE VBAP-NETPR, "Net price

END OF I_VBAP.

DATA : BEGIN OF I_LIPS OCCURS 0,

VGBEL LIKE LIPS-VGBEL , "Doc no. of the reference Document

LFIMG LIKE LIPS-LFIMG, "Actual quantity delivered

END OF I_LIPS.

DATA : BEGIN OF I_OUT OCCURS 0 ,

VBELN LIKE VBEP-VBELN,

EDATU LIKE VBEP-EDATU,

WMENG LIKE VBEP-WMENG,

KUNNR LIKE VBAK-KUNNR,

WAERK LIKE VBAK-WAERK,

MATNR LIKE VBAP-MATNR,

NETPR LIKE VBAP-NETPR,

LFIMG LIKE LIPS-LFIMG,

END OF I_OUT.

DATA : BEGIN OF I_OUT1 OCCURS 0 ,

KUNNR LIKE VBAK-KUNNR,

MATNR LIKE VBAP-MATNR,

VBELN LIKE VBEP-VBELN,

EDATU LIKE VBEP-EDATU,

WMENG LIKE VBEP-WMENG,

VALUE_SA_LINE LIKE VALUE_SA_LINE,

WAERK LIKE VBAK-WAERK,

LFIMG LIKE LIPS-LFIMG,

BAL_LEFT LIKE BAL_LEFT,

VALUE_BAL_LEFT LIKE VALUE_BAL_LEFT,

QUAN_DELIVERED LIKE QUAN_DELIVERED,

END OF I_OUT1.

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

*SELECTION SCREEN DECLARATION

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

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

SELECT-OPTIONS : S_KUNNR FOR VBAK-KUNNR .

SELECTION-SCREEN END OF BLOCK B1 .

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

  • TOP-OF-PAGE

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

TOP-OF-PAGE.

WRITE : /'DATE:' COLOR 1,SY-DATUM DD/MM/YYYY,45 'MIRACLE SOFTWARE'

COLOR 5, 75'USERID:' COLOR 3,SY-UNAME.

WRITE :/'TIME:' COLOR 4,(8) SY-UZEIT USING EDIT MASK '__:__:__',

75'PAGE:' COLOR 6,SY-PAGNO.

ULINE.

FORMAT INTENSIFIED ON.

WRITE : /2 CUSTOMER ,13 MATERIAL ,32 SCHED_AGREE ,43 DATE ,52 ORD_QUAN

,

66 VSL ,79 CURR ,85 QUAN_DELIVERED ,99 BAL_LEFT1 ,108 VAL_BAL_LEFT ,122

DELIVERY_P ,137 ' ' .

FORMAT INTENSIFIED OFF.

ULINE.

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

  • START-OF-SELECTION(POPULATION OF INTERNAL TABLE)

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

START-OF-SELECTION.

SELECT VBELN EDATU WMENG FROM VBEP INTO TABLE I_VBEP .

SELECT VBELN KUNNR WAERK FROM VBAK INTO TABLE I_VBAK FOR ALL ENTRIES IN

I_VBEP WHERE VBELN = I_VBEP-VBELN AND KUNNR IN S_KUNNR .

SELECT VBELN MATNR NETPR FROM VBAP INTO TABLE I_VBAP FOR ALL ENTRIES IN

I_VBEP

WHERE VBELN = I_VBEP-VBELN .

SELECT VGBEL LFIMG FROM LIPS INTO TABLE I_LIPS FOR ALL ENTRIES IN

I_VBEP

WHERE VGBEL = I_VBEP-VBELN .

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

  • PROCESSING OF INTERNAL TABLE

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

LOOP AT I_VBEP.

MOVE I_VBEP-VBELN TO I_OUT-VBELN.

MOVE I_VBEP-EDATU TO I_OUT-EDATU.

MOVE I_VBEP-WMENG TO I_OUT-WMENG.

READ TABLE I_VBAK WITH KEY VBELN = I_VBEP-VBELN.

MOVE I_VBAK-KUNNR TO I_OUT-KUNNR.

MOVE I_VBAK-WAERK TO I_OUT-WAERK.

READ TABLE I_VBAP WITH KEY VBELN = I_VBEP-VBELN.

MOVE I_VBAP-MATNR TO I_OUT-MATNR.

MOVE I_VBAP-netpr TO I_OUT-netpr.

READ TABLE I_LIPS WITH KEY VGBEL = I_VBEP-VBELN.

MOVE I_LIPS-LFIMG TO I_OUT-LFIMG.

APPEND I_OUT.

ENDLOOP.

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

*LOOP AT I_OUT .

LOOP AT I_OUT.

Value_SA_LINE = i_out-wmeng * i_out-netpr .

BAL_LEFT = I_OUT-WMENG - I_OUT-LFIMG.

IF BAL_LEFT > 0 .

VALUE_BAL_LEFT = BAL_LEFT * I_OUT-NETPR .

ELSE.

VALUE_BAL_LEFT = 0.

ENDIF.

IF I_OUT-WMENG <> 0 .

DELIVERY_PERCENT = I_OUT-LFIMG / I_OUT-WMENG .

ELSE .

DELIVERY_PERCENT = 0.

ENDIF.

READ TABLE I_OUT.

MOVE I_OUT-KUNNR TO I_OUT1-KUNNR.

MOVE I_OUT-MATNR TO I_OUT1-MATNR.

MOVE I_OUT-VBELN TO I_OUT1-VBELN.

MOVE I_OUT-EDATU TO I_OUT1-EDATU.

MOVE I_OUT-WMENG TO I_OUT1-WMENG.

move VALUE_SA_LINE to i_out1-VALUE_SA_LINE.

MOVE I_OUT-WAERK TO I_OUT1-WAERK.

MOVE I_OUT-LFIMG TO I_OUT1-LFIMG.

move BAL_LEFT to i_out1-BAL_LEFT.

move VALUE_BAL_LEFT to i_out1-VALUE_BAL_LEFT.

move QUAN_DELIVERED to i_out1-QUAN_DELIVERED.

APPEND I_OUT1.

ENDLOOP.

*read table VT_FIELDCAT into wa_FIELDCAT with key fieldname eq

*'BAL_LEFT'.

*

*wa_fieldcat-coltext = ' Bal Left'.

*modify VALUE_BAL_LEFT from wa_fieldcat.

*

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = SY-REPID

I_INTERNAL_TABNAME = 'I_OUT1'

I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = SY-REPID

CHANGING

CT_FIELDCAT = VT_FIELDCAT.

.

IF SY-SUBRC <> 0.

ENDIF.

read table VT_FIELDCAT into wa_FIELDCAT with key fieldname = 'VALUE_BAL_LEFT'.

wa_fieldcat-coltext = 'Value Bal Left'.

modify VALUE_BAL_LEFT from wa_fieldcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'SY_REPID '

I_CALLBACK_TOP_OF_PAGE = ' TOP_OF_PAGE'

IT_FIELDCAT = vt_fieldcat

I_SAVE = 'A'

TABLES

T_OUTTAB = I_OUT1.

.

IF SY-SUBRC <> 0.

ENDIF.

*WRITE : /2 I_OUT-KUNNR , 13 I_OUT-MATNR ,35 I_OUT-VBELN , 47

*I_OUT-EDATU , 602 I_OUT-WMENG , 80 VALUE_SA_LINE ,90 I_OUT-WAERK, 109

*I_OUT-LFIMG,124 BAL_LEFT ,139 VALUE_BAL_LEFT ,159 DELIVERY_PERCENT .

*ENDLOOP.

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

  • END-OF-PAGE

0 Kudos

do something like this, use append instead of modify

if u want to get column heading then use SELTEXT_L.. i dont think there is COLTEXT for the internal table u defined

X_FIELDCAT-FIELDNAME = 'LIFNR'.

X_FIELDCAT-TABNAME = 'IT_FINAL'.

X_FIELDCAT-SELTEXT_L = 'VENDOR'.

X_FIELDCAT-NO_ZERO = 'X'.

X_FIELDCAT-OUTPUTLEN = 10.

X_FIELDCAT-COL_POS = 1.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

rahulkavuri
Active Contributor
0 Kudos

take care that u declare like this

DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If you are using the FM based ALV, then you might want to try this.

data: wa_fieldcat type slis_fieldcat_alv.


read table VT_FIELDCAT into wa_FIELDCAT with key fieldname = 'VALUE_BAL_LEFT'.

wa_fieldcat-REPTEXT_DDIC = 'Value Bal Left'.
modify VALUE_BAL_LEFT from wa_fieldcat.

The reason for your error is due to the fact that COLTEXT is not a field in the fieldcat structure that you are using.

Regards,

Rich Heilman

Message was edited by:

Rich Heilman

rajasekhar_matukumalli3
Active Participant
0 Kudos

Hi

I dont think there is any attribute by 'COLTEXT'. U can use any one or all of of "SELTEXT_L" or "SELTEXT_M" or "SELTEXT_S" to specify your column heading.

Hope this solves your problem

Enjoy SAP

Rajasekhar