cancel
Showing results for 
Search instead for 
Did you mean: 

Add columns to CV04N report

Former Member
0 Kudos

HI all,

I wanna know if its possible to add custom columns to CV04N report. I need to add two columns an populate it with calculated data from other columns.

Regards.

Gregory.

Accepted Solutions (1)

Accepted Solutions (1)

former_member216702
Active Participant
0 Kudos

Hello,

A friend give a long time ago a way :

You must modify the badi if_ex_document_main01~after_search_data and

add field in structure FOUNDDRAW in using fonction 'DDIC_DATA_DESCRIPTION_SCAN'

wt_fieldinfo2 contain header of column

You must export the structure FOUNDDRAW at the end :

ls_structure-tabname = 'FOUNDDRAW'.

ls_structure-progname = 'SAPLSSN1'.

EXPORT t_fieldinfo2 FROM wt_fieldinfo2

TO MEMORY ID ls_structure.

Thierry

Former Member
0 Kudos

Hi, thx for ur answer.

I don't understand.

I have to add the fields to the structure FOUNDDRAW as append structure? or by executing the FM DDIC_DATA_DESCRIPTION_SCAN? How should I use this FM?

Is wt_fieldinfo2 the table into the FM DDIC_DATA_DESCRIPTION_SCAN parameters?

"You must export the structure FOUNDDRAW at the end" what is ls_structure?

Could you please post some example code?

Regards.

Gregory.

Former Member
0 Kudos

Hi, testing the BADI method IF_EX_DOCUMENT_MAIN01~AFTER_SEARCH_DATA I call the FM DDIC_DATA_DESCRIPTION_SCAN with the structure FOUNDDRAW as import parameter I_STRUCTURE and the report losses some columns as Document ID, Description, Version... Those columns are not shown and are not available for selection in layout modification function.

Could somebody tell me what's happening? It appears that this FM call modify the ALV layout.

Calling the FM with DRAW instead of FOUNDDRAW, the report shows all columns.

Regards.

Gregory.

Edited by: Gregory Mayorga on Jul 19, 2010 12:37 PM

former_member216702
Active Participant
0 Kudos

Hello Gregory,

In fact you use field of structure FOUNDDRAW that you have not to use.

You replace your information in this field and you eport the modify sturcute to standard SAP

For add new column, you must modify FOUNDDRAW

Try this

Thierry

TYPES ty_draw TYPE draw.

DATA str_draw TYPE ty_draw.

DATA wv_work(14) TYPE c.

DATA wv_row LIKE sy-tabix.

TYPE-POOLS slis.

DATA wt_fieldinfo TYPE STANDARD TABLE OF fieldinfo.

DATA wt_fieldinfo2 TYPE slis_t_fieldinfo2.

DATA ws_fieldinfo2 TYPE slis_fieldinfo2.

DATA: BEGIN OF ls_structure,

tabname TYPE dd02l-tabname,

progname TYPE sy-repid,

END OF ls_structure.

DEFINE upd_head.

if ws_fieldinfo2-fieldname = &1.

move &2 to ws_fieldinfo2-scrtext_l.

move &3 to ws_fieldinfo2-scrtext_m.

move &4 to ws_fieldinfo2-scrtext_s.

move &2 to ws_fieldinfo2-reptext.

modify wt_fieldinfo2 from ws_fieldinfo2.

endif.

END-OF-DEFINITION.

  • controle type de document = Z*

READ TABLE draw

WITH KEY dokar = 'Z*'

TRANSPORTING NO FIELDS.

IF sy-subrc NE 0.

EXIT.

ENDIF.

LOOP AT draw INTO str_draw.

wv_row = sy-tabix.

str_draw-res1 = 'TEST THIERRY RES1'.

str_draw-res2 = 'TEST THIERRY RES2'.

MODIFY draw FROM str_draw INDEX wv_row.

ENDLOOP.

CALL FUNCTION 'DDIC_DATA_DESCRIPTION_SCAN'

EXPORTING

i_structure = 'FOUNDDRAW'

i_context = 'X'

TABLES

t_fieldinfo = wt_fieldinfo

t_fieldinfo2 = wt_fieldinfo2

EXCEPTIONS

table_not_exists = 1

OTHERS = 2.

IF sy-subrc EQ 0.

LOOP AT wt_fieldinfo2 INTO ws_fieldinfo2.

upd_head 'RES1' 'TEXT_L' 'TEXT_M' 'TEXT_S'.

upd_head 'RES2' 'TEXT_L' 'TEXT_M' 'TEXT_L'.

ENDLOOP.

ls_structure-tabname = 'FOUNDDRAW'.

ls_structure-progname = 'SAPLSSN1'.

EXPORT t_fieldinfo2 FROM wt_fieldinfo2

TO MEMORY ID ls_structure.

ENDIF.

Edited by: Thierry RICARD on Jul 20, 2010 8:45 AM

Edited by: Thierry RICARD on Jul 20, 2010 8:46 AM

Former Member
0 Kudos

Hi Thierry,

Thx a lot for ur answer, it works fine!

Points granted.

Regards.

Gregory

Answers (0)