03-27-2007 12:23 PM
1) what is the difference between 'update' & 'modify' statements?
2)what are workbench requests & customizing requests?
3)in ALV reports ,i want to get each row with different colour?how to get it?
please reply.
03-27-2007 12:27 PM
Hi Srinivas
If a record is already there in the table, Update will change the values with the new values, but if a record is already not there in the table nothing will happen.
But for modify if a reocrd is already there in the table it will modify the record, if the record is not there it willl inser a new record.
For programs, tables,etc we create requests which are the workbench requests.
Customizing requests are created by functional people i.e for customization using spro, etc.
Hope this helps.
Britto
03-27-2007 12:29 PM
Hi,
1) Update will only update the record in teh database table ,depending upon the condition u specified in the updata command.
it will fail if the record does not exists in the table..mean to say it wil return Sy-subrc as zero then.
2) Modify - will do an update if record exists otherwise it wil create a new record in db table if record does not exists.
Press F1 in ur code on Update or MOdify ,u will find more on tht
Requests:
Changes to cross-client Customizing objects and to Repository objects are recorded in Workbench requests
In workbench request .... it can be programs (repository objects) and cross client data (ie not specific to one client).
Changes to client-specific Customizing objects are recorded in Customizing requests.
Customer customized data designed for a specific client is transported to another client using customizing request. Most of the cases these requests are something like changing values in tables (that too client specific).
ALV Grid Colors:
-
If you are using the function module ALV grid, then this example will help.
report zrich_0004
no standard page heading.
type-pools slis.
data: fieldcat type slis_t_fieldcat_alv.
data: begin of imara occurs 0,
matnr type mara-matnr,
mtart type mara-mtart,
maktx type makt-maktx,
color_line(4) type c,
tcolor type slis_t_specialcol_alv, "cell
end of imara.
data: xcolor type slis_specialcol_alv.
start-of-selection.
perform get_data.
perform write_report.
************************************************************************
Get_Data
************************************************************************
form get_data.
imara-matnr = 'ABC'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for ABC'.
append imara.
imara-matnr = 'DEF'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for DEF'.
append imara.
imara-matnr = 'GHI'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for GHI'.
append imara.
loop at imara.
if sy-tabix = 1.
imara-color_line = 'C410'. " color line
endif.
if sy-tabix = 2. "color CELL
clear xcolor.
xcolor-fieldname = 'MTART'.
xcolor-color-col = '3'.
xcolor-color-int = '1'. "Intensified on/off
xcolor-color-inv = '0'.
append xcolor to imara-tcolor.
endif.
modify imara.
endloop.
endform.
************************************************************************
WRITE_REPORT
************************************************************************
form write_report.
data: layout type slis_layout_alv.
layout-coltab_fieldname = 'TCOLOR'.
layout-info_fieldname = 'COLOR_LINE'.
perform build_field_catalog.
CALL ABAP LIST VIEWER (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
is_layout = layout
it_fieldcat = fieldcat
tables
t_outtab = imara.
endform.
************************************************************************
BUILD_FIELD_CATALOG
************************************************************************
form build_field_catalog.
data: fc_tmp type slis_t_fieldcat_alv with header line.
clear: fieldcat. refresh: fieldcat.
clear: fc_tmp.
fc_tmp-reptext_ddic = 'Material Number'.
fc_tmp-fieldname = 'MATNR'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '18'.
append fc_tmp to fieldcat.
clear: fc_tmp.
fc_tmp-reptext_ddic = 'Material Type'.
fc_tmp-fieldname = 'MTART'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '4'.
append fc_tmp to fieldcat.
clear: fc_tmp.
fc_tmp-reptext_ddic = 'Material'.
fc_tmp-fieldname = 'MAKTX'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '40'.
fc_tmp-emphasize = 'C610'. " color column
append fc_tmp to fieldcat.
endform.
Regards,
Ram
Message was edited by:
Ram Mohan Naidu Thammineni
03-27-2007 12:33 PM
Changing Lines
The Open SQL statement for changing data in a database table is:
UPDATE <target> <lines>.
It allows you to change one or more lines in the database table <target>. You can only change lines in an ABAP Dictionary view if it only contains fields from one table, and its maintenance status is defined as Read and change. You may specify the database table <target> either statically or dynamically.
Specifying a Database Table
To specify the database table statically, enter the following for <target>:
UPDATE <dbtab> [CLIENT SPECIFIED] <lines>.
where <dbtab> is the name of a database table defined in the ABAP Dictionary.
To specify the database table dynamically, enter the following for <target>:
UPDATE (<name>) [CLIENT SPECIFIED] <lines>.
where the field <name> contains the name of a database table defined in the ABAP Dictionary.
You can use the CLIENT SPECIFIED addition to disable automatic client handling.
Changing Lines Column by Column
To change certain columns in the database table, use the following:
UPDATE <target> SET <set1> <set 2> ... [WHERE <cond>].
The WHERE clause determines the lines that are changed. If you do not specify a WHERE clause, all lines are changed. The expressions <set i > are three different SET statements that determine the columns to be changed, and how they are to be changed:
Message was edited by:
sunil kumar