Application Development and Automation 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: 
Read only

abap

Former Member
0 Likes
438

1.H many breakpoints to set the report?

2.what are the testcases?

3.In Alv functionmodules what is the parameter of sum ?

4.what is the diff between paragraph format and Character format?

5.What is Color field inAlv?

4 REPLIES 4
Read only

Former Member
0 Likes
418

max of 30 break point.

Here test cases are different variants in sap terminology.

u will be checking program for different cases.

For summing in alv in field catalog use as below

NET PRICE IN PURCHASING DOCUMENT

CLEAR lf_fieldcat.

lf_fieldcat-fieldname = 'NETPR'.

lf_fieldcat-ref_tabname = 'EKPO'.

lf_fieldcat-ref_fieldname = 'NETPR'.

lf_fieldcat-cfieldname = 'WAERS'.

<b> lf_fieldcat-do_sum = 'X'.</b>

APPEND lf_fieldcat TO lt_fieldcat.

Paragraph formats specifies font, tabs etc.

character format specifies font, and character format for specific over rides paragraphs.

Color :

field parameter is used to highlight certain field with chosen colors.

Value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off ,'1'=on).

'X' = column is colored with the default column highlight color.

'Cxyz' = column is colored with a coded color:

- C: Color (coding must begin with C)

- X: color number

- Y: bold

- Z: inverse

Read only

Former Member
0 Likes
418

1) maximum 30 breakpoints we can set

2)Testcases are nothing but some testdata fro which we need to check our object

Repository information system

->program library

here you can find all packages/programs/...

in the system

3)check link

https://www.sdn.sap.com/irj/sdn/forums

4) paragraph format is used to assign perticuler text fromat to paragraph and it you want to assign some format only fro some words/charectors you will assign Character format

5)In field catelog we can set color field for ALV whci will show that field with diffrent color

gs_fcat-emphasize = 'C110'.

Rewards if useful...............

Minal

Read only

Former Member
0 Likes
418

Example for color

X_FIELDCAT-COL_POS = 5.

X_FIELDCAT-FIELDNAME = 'EBELN'.

X_FIELDCAT-TABNAME = 'I_TAB'.

X_FIELDCAT-SELTEXT_M = 'Purchase Order'.

  • X_FIELDCAT-OUTPUTLEN = 14.

  • The field will be colored differently(Cxyz)

<b> x_fieldcat-emphasize = 'C511'.</b>

  • Initially the field will be hidden

x_fieldcat-no_out = 'X'.

append X_fieldcat TO I_FIELDCAT.

clear x_fieldcat.

Read only

Former Member
0 Likes
418

Hi

<b>1.H many breakpoints to set the report?</b>

Ans) as many as you want

<b>2.what are the testcases?</b>

Ans) its like an testdata where you will test the object based on diff cases

<b>3.In Alv functionmodules what is the parameter of sum ?</b>

Ans) for this refer this program

you can find very clearly

&----


*& Report ZALV_SUM

*&

&----


*&

*&

&----


REPORT ZALV_SUM.

TABLES: ekko.

type-pools: slis. "ALV Declarations

*Data Declaration

*----


TYPES: BEGIN OF t_vbap,

vbeln TYPE vbap-vbeln,

matnr TYPE vbap-matnr,

netwr TYPE vbap-netwr,

waerk TYPE vbap-waerk,

END OF t_vbap.

DATA: it_vbap TYPE STANDARD TABLE OF t_vbap INITIAL SIZE 0,

wa_vbap TYPE t_vbap.

*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.

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

*Start-of-selection.

START-OF-SELECTION.

perform data_retrieval.

perform build_fieldcatalog.

perform build_layout.

perform display_alv_report.

&----


*& Form BUILD_FIELDCATALOG

&----


  • Build Fieldcatalog for ALV Report

----


form build_fieldcatalog.

fieldcatalog-fieldname = 'VBELN'.

fieldcatalog-seltext_m = 'Sales Order'.

fieldcatalog-col_pos = 0.

fieldcatalog-outputlen = 10.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MATNR'.

fieldcatalog-seltext_m = 'Material Number'.

fieldcatalog-col_pos = 4.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'NETWR'.

fieldcatalog-seltext_m = 'Net Price'.

fieldcatalog-col_pos = 7.

fieldcatalog-outputlen = 15.

<b>fieldcatalog-do_sum = 'X'. </b> "Display column total

fieldcatalog-cfieldname = 'WAERK'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'WAERK'.

fieldcatalog-seltext_m = 'Price Curr'.

fieldcatalog-col_pos = 8.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

endform. " BUILD_FIELDCATALOG

&----


*& Form BUILD_LAYOUT

&----


  • Build layout for ALV grid report

----


form build_layout.

gd_layout-no_input = 'X'.

gd_layout-colwidth_optimize = 'X'.

gd_layout-totals_text = 'Totals'(201).

  • gd_layout-totals_only = 'X'.

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

  • "click(press f2)

  • gd_layout-zebra = 'X'.

  • gd_layout-group_change_edit = 'X'.

  • gd_layout-header_text = 'helllllo'.

endform. " BUILD_LAYOUT

&----


*& Form DISPLAY_ALV_REPORT

&----


  • Display report using ALV grid

----


form display_alv_report.

gd_repid = sy-repid.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

  • i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM

  • i_callback_user_command = 'USER_COMMAND'

  • i_grid_title = outtext

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

  • it_special_groups = gd_tabgroup

  • IT_EVENTS = GT_XEVENTS

i_save = 'X'

  • is_variant = z_template

tables

t_outtab = it_vbap

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 DATA_RETRIEVAL

&----


  • Retrieve data form EKPO table and populate itab it_ekko

----


form data_retrieval.

select vbeln matnr netwr waerk

up to 50 rows

from vbap

into table it_vbap.

endform. " DATA_RETRIEVAL

<b>4.what is the diff between paragraph format and Character format?</b>

Ans) Within an output area one can use static or dynamic tables to display data or text in lines, columns. To further structure and format text and data , paragraph and character formats are used.

When you migrate a form, the general form attributes, as well as the layout information including the pages and windows and their attributes and positions are copied unchanged. However, the definition of paragraph and character formats s lost.

<b>5.What is Color field inAlv?</b>

Ans) see t his program to understand color in ALV

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

  • Use of colours in ALV grid (cell, line and column) *

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

  • Table

tables : mara.

  • Type

types : begin of ty_mara,

matnr like mara-matnr,

matkl like mara-matkl,

counter(4) type n,

free_text(15) type c,

color_line(4) type c, " Line color

color_cell type lvc_t_scol, " Cell color

end of ty_mara.

  • Structures

data : wa_mara type ty_mara,

wa_fieldcat type lvc_s_fcat,

is_layout type lvc_s_layo,

wa_color type lvc_s_scol.

  • Internal table

data : it_mara type standard table of ty_mara,

it_fieldcat type standard table of lvc_s_fcat,

it_color type table of lvc_s_scol.

  • Variables

data : okcode like sy-ucomm,

w_alv_grid type ref to cl_gui_alv_grid,

w_docking_container type ref to cl_gui_docking_container.

parameters : p_column as checkbox,

p_line as checkbox,

p_cell as checkbox.

at selection-screen output.

perform get_data.

perform fill_catalog.

if w_docking_container is initial.

perform create_objects.

endif.

&----


*& Form create_objects

&----


form create_objects.

create object w_docking_container

exporting

ratio = 60

exceptions

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5

others = 6.

create object w_alv_grid

exporting

i_parent = w_docking_container.

  • Field that identify color line in internal table

move 'COLOR_LINE' to is_layout-info_fname.

  • Field that identify cell color in inetrnal table

move 'COLOR_CELL' to is_layout-ctab_fname.

call method w_alv_grid->set_table_for_first_display

exporting

is_layout = is_layout

changing

it_outtab = it_mara

it_fieldcatalog = it_fieldcat

exceptions

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

others = 4.

endform.

&----


*& Form get_data

&----


form get_data.

select * from mara up to 5 rows.

clear : wa_mara-color_line, wa_mara-color_cell.

move-corresponding mara to wa_mara.

add 1 to wa_mara-counter.

move 'Blabla' to wa_mara-free_text.

if wa_mara-counter = '0002'

and p_line = 'X'.

  • Color line

move 'C410' to wa_mara-color_line.

elseif wa_mara-counter = '0004'

and p_cell = 'X'.

  • Color cell

move 'FREE_TEXT' to wa_color-fname.

move '6' to wa_color-color-col.

move '1' to wa_color-color-int.

move '1' to wa_color-color-inv.

append wa_color to it_color.

wa_mara-color_cell[] = it_color[].

endif.

append wa_mara to it_mara.

endselect.

endform.

&----


*& Form fill_catalog

&----


form fill_catalog.

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

  • Colour code : *

  • Colour is a 4-char field where : *

  • - 1st char = C (color property) *

  • - 2nd char = color code (from 0 to 7) *

  • 0 = background color *

  • 1 = blue *

  • 2 = gray *

  • 3 = yellow *

  • 4 = blue/gray *

  • 5 = green *

  • 6 = red *

  • 7 = orange *

  • - 3rd char = intensified (0=off, 1=on) *

  • - 4th char = inverse display (0=off, 1=on) *

  • *

  • Colour overwriting priority : *

  • 1. Line *

  • 2. Cell *

  • 3. Column *

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

data : w_position type i value '1'.

clear wa_fieldcat.

move w_position to wa_fieldcat-col_pos.

move 'MATNR' to wa_fieldcat-fieldname.

move 'MARA' to wa_fieldcat-ref_table.

move 'MATNR' to wa_fieldcat-ref_field.

append wa_fieldcat to it_fieldcat.

add 1 to w_position.

clear wa_fieldcat.

move w_position to wa_fieldcat-col_pos.

move 'MATKL' to wa_fieldcat-fieldname.

move 'MARA' to wa_fieldcat-ref_table.

move 'MATKL' to wa_fieldcat-ref_field.

  • Color column

if p_column = 'X'.

move 'C610' to wa_fieldcat-emphasize.

endif.

append wa_fieldcat to it_fieldcat.

add 1 to w_position.

clear wa_fieldcat.

move w_position to wa_fieldcat-col_pos.

move 'COUNTER' to wa_fieldcat-fieldname.

move 'N' to wa_fieldcat-inttype.

move '4' to wa_fieldcat-intlen.

move 'Counter' to wa_fieldcat-coltext.

append wa_fieldcat to it_fieldcat.

add 1 to w_position.

clear wa_fieldcat.

move w_position to wa_fieldcat-col_pos.

move 'FREE_TEXT' to wa_fieldcat-fieldname.

move 'C' to wa_fieldcat-inttype.

move '20' to wa_fieldcat-intlen.

move 'Text' to wa_fieldcat-coltext.

append wa_fieldcat to it_fieldcat.

endform.

<b>reward if usefull</b>