CS5 Update Record behaior deletes the record
Hello
I am having an issue that I just cant seem to understand or resolve.
I am using the CS5 Update Record Server Bahavior to update the user table for a website, but instead if updating the record, it deletes the entire record.
I look at the SQL and it is definately an Update, so I dont see how it deleting the entire record.
What I did:
Passed in record ID through querystring to get the filtered recordset
Created update form for dynamic data (the corrent data is filling form from recoredset)
Created hidden field to hold ID
Clicked the Update Record Server Behavior and matched form variables to appropriate DB fields
Set it to go to page to list all users
Saved page
Run on local server (php/MySQL)
When I edit the user data in the update form and click submit, the record is deleted.
* I checked the MySQL DB and the entire recored has been deleted
Anyone have a clue on why this is happening?
Here's the code from the page:
<?php require_once('../Connections/localconn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "updateuser")) {
$updateSQL = sprintf("UPDATE users SET fname=%s, lname=%s, uname=%s, password=%s, ulevel=%s WHERE id=%s",
GetSQLValueString($_POST['fname'], "text"),
GetSQLValueString($_POST['lname'], "text"),
GetSQLValueString($_POST['uname'], "text"),
GetSQLValueString($_POST['pword'], "text"),
GetSQLValueString($_POST['ulevel'], "int"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_localconn, $localconn);
$Result1 = mysql_query($updateSQL, $localconn) or die(mysql_error());
$updateGoTo = "users.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $updateGoTo));
$colname_Recordset_users = "-1";
if (isset($_GET['id'])) {
$colname_Recordset_users = $_GET['id'];
mysql_select_db($database_localconn, $localconn);
$query_Recordset_users = sprintf("SELECT * FROM users WHERE id = %s", GetSQLValueString($colname_Recordset_users, "int"));
$Recordset_users = mysql_query($query_Recordset_users, $localconn) or die(mysql_error());
$row_Recordset_users = mysql_fetch_assoc($Recordset_users);
$totalRows_Recordset_users = mysql_num_rows($Recordset_users);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title</title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW">
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
</head>
<body>
<div id="wrap">
<div id="top"></div>
<div id="content">
<div class="header">
<h1><a href="#">FENA </a></h1>
<h2>Content Management System (CMS)</h2>
</div>
<div class="breadcrumbs">
<a href="#">Home</a> · Edit User
</div>
<div class="middle">
<h2>Edit User - <?php echo $row_Recordset_users['lname']; ?>, <?php echo $row_Recordset_users['fname']; ?></h2>
<form method="POST" action="<?php echo $editFormAction; ?>" name="updateuser">
<table>
<tr>
<td>Last Name</td>
<td><input name="lname" type="text" value="<?php echo $row_Recordset_users['lname']; ?>" /></td>
</tr>
<tr>
<td>First Name</td>
<td><input name="fname" type="text" value="<?php echo $row_Recordset_users['fname']; ?>" /></td>
</tr>
<tr>
<td>Username</td>
<td><input name="uname" type="text" value="<?php echo $row_Recordset_users['uname']; ?>" /></td>
</tr>
<tr>
<td>Password</td>
<td><input name="pword" type="text" value="<?php echo $row_Recordset_users['password']; ?>" /></td>
</tr>
<tr>
<td>User Level</td>
<td>
<select name="ulevel">
<option value="<?php echo $row_Recordset_users['ulevel']; ?>"><?php echo $row_Recordset_users['ulevel']; ?></option>
<option value="1">Admin</option>
<option value="2">Editor</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="right"><input name="id" type="hidden" value="<?php echo $row_Recordset_users['id']; ?>" /><input name="submit" type="submit" value="Submit" /></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="updateuser" />
</form>
</div>
<div class="right">
<h2>Navigation</h2>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="users.php">Users</a></li>
<li><a href="users_add.php">Add User</a></li>
</ul>
</div>
<div id="clear"></div>
</div>
<div id="bottom"></div>
</div>
<div id="footer">
Developed by Me
</div>
</body>
</html>
<?php
mysql_free_result($Recordset_users);
?>
Hi Paul,
I am actually try to a create a submit a process and have it to update the DB.
Thanks,
Han
Similar Messages
-
HOW to delete the records in CO1P?
Hi all:
When i close the PO,i find the PO have CO1P records.However ,the PO has been settled. Then how can i delete the records in CO1P for this PO.Dear,
CO1P:
Normally the Goods Movement errors are updated in Table AFFW - Goods Movements with Errors from Confirmations and in transaction COGI.
If the table is locked during background using update control for the confirmation then the errors are recorded in CO1P.
COFC:
Used for Reprocessing of errors in confirmation related to actual cost calculations.
Please run CORUPROC Program.
Please check this link also for further help
http://help.sap.com/saphelp_46c/helpdata/en/e3/7cd32396f611d1b5a60000e8359890/frameset.htm
Regards,
R.Brahmankar -
How to refresh after delete the records in ALV report ?
Hi Friends,
How to refresh after delete the records in ALV report.
I am deleting records in ALV report .
After successful delete the screen should refresh.
u201C Deleted records should not appear in the screen u201C.
Please guide me.
Regards,
SubashHi subhash,
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
WHEN 'BACK'.
Refresh the internal table from the ALV grid
PERFORM update_alv_tab.
ENDFORM. "user_command
FORM update_alv_tab .
DATA : e_grid TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = e_grid.
CALL METHOD e_grid->check_changed_data.
"update_alv_tab
CALL METHOD e_grid->refresh_table_display.
ENDFORM. " UPDATE_ALV_TAB
Then see in Debug mode is it updating or not..
Please confirm .
And please paste the code if you can.
Regards. -
How to delete the record of saved HRA Details...
Hi Experts,
I have put the details of HRA Correctly.But while updating HRA In 0008 Infotype i wrongly updated the wagetype,How should i change the Wagetype.
When i m trying to delete it is showing RECORD CAN NOT BE DELETED (TIME CONSTRAINT 1).
How can delete the record.
Thanking u .
SaiHi
Hope doing well ........ No need to delete any infotype but u can go to PA30 and in change mode their u can delete the wagetype which is wrongly entered
Rajeshk -
How to delete the records with routine Z_AFRP4_DELETE as note [418584|
Hello Gurus,
I don't want to transfer data into HR and want to delete the records in table AFRP4 to business complete the Maintenance Orders
Component version- EHP7 for SAP ERP 6.0
Component-EA-APPL
Release-617
how can I delete these records
Thanks fro Help
AMHello All,
I found the solution, I copied the code in correction instruction number 0000282352 and create the report as programme Z_AFRP4_DELETEand the executed
*$*$----------------------------------------------------------------$*$*
*$ Correction Inst. 0120061532 0000282352 $*
*$--------------------------------------------------------------------$*
*$ Valid for : $*
*$ Software Component SAP_APPL SAP Application $*
*$ Release 40B All Support Package Levels $*
*$ Release 45B All Support Package Levels $*
*$ Release 46B All Support Package Levels $*
*$ Release 46C All Support Package Levels $*
*$ Release 470 All Support Package Levels $*
*$ Release 500 All Support Package Levels $*
*$ Release 600 All Support Package Levels $*
*$ Release 602 All Support Package Levels $*
*$ Release 603 All Support Package Levels $*
*$ Release 604 All Support Package Levels $*
*$ Release 605 All Support Package Levels $*
*$ Release 606 All Support Package Levels $*
*$--------------------------------------------------------------------$*
*$ Changes/Objects Not Contained in Standard SAP System $*
*$*$----------------------------------------------------------------$*$*
*& Object REPS Z_AFRP4_DELETE
*& Object Header PROG Z_AFRP4_DELETE
*& REPORT Z_AFRP4_DELETE
REPORT Z_AFRP4_DELETE .
* This report deletes confirmation records from table AFRP4 that are
* not longer needed. Run it without update flag first !!
tables: afrp4.
data: lt_afrp4 like afrp4 occurs 0,
ls_afrp4 like afrp4.
selection-screen begin of block order with frame.
select-options: zorders for afrp4-aufnr. "order number
selection-screen end of block order.
parameters: update as checkbox.
select * from afrp4 into table lt_afrp4
where aufnr in zorders.
if lt_afrp4[] is initial.
format color col_normal.
write: 'No HR confirmation background records read.'.
exit.
endif.
format color col_heading.
write: /5 'Order', 25 'Confirmation', 45 'Counter'.
skip. uline. skip.
* show corrections
loop at lt_afrp4 into ls_afrp4.
format color col_normal.
write: /5 ls_afrp4-aufnr, 25 ls_afrp4-rueck, 45 ls_afrp4-rmzhl.
endloop.
* update on data base table
if not update is initial.
skip. uline. skip.
delete afrp4 from table lt_afrp4.
if sy-subrc is initial.
format color col_positive.
write: 'HR-records deleted successfull'.
else.
format color col_negative.
write: 'Error when trying to update data base table AFRP4.'.
endif.
endif. -
Hi Gurus,
Am able to insert , update records in EXCEL sheet using JDBC. But am unable to delete the record from EXCEL sheet. Please give me the solution how to delete the record from EXCEL sheet
Thanks in Advance
RaviThe excel odbc driver (which has nothing to do with java) doesn't do that. See "Excel Driver Limitations" in the following....
http://support.microsoft.com/kb/178717 -
Comparing two internal tables and deleting the record not present in second
Hi All,
I have a internal table itaba with PERNR as primary key and various other columns (1000 records) and table B with PERNR as primary key and 800 records.
Now what is the best way to compare these two and delete the record from table A when its corresponding record is not present in table B?
Thanks and Regards,
MohanHI SIR
u trained us in accenture
Hi all
when ever m running this session in SM35 , M getting error as :
"LEAVE TO TRANSACTION" MARA-BISMT is not allow
in batch input
REPORT YASEC_BDC_NIK_SESSION
no standard page heading
message-id zmm
line-count 65
line-size 150.
tables : mara.
*Top includr program
INCLUDE YNEW_MAIN_TOP.
*include yasec_bdc_nik_session_top.
***********selection screen *******************
selection-screen begin of block b1 with frame title text-001.
selection-screen skip.
PARAMETERS: p_ifile(128) TYPE c .
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: rad1 TYPE c RADIOBUTTON GROUP 1 USER-COMMAND gr1,
rad2 TYPE c RADIOBUTTON GROUP 1 .
SELECTION-SCREEN SKIP.
PARAMETERS: p_sess TYPE c.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK b1.
Subroutine call***************************
INCLUDE YNEW_MAIN_F01.
*include yasec_bdc_nik_session_f01.
*********At selection event triggered *************
at selection-screen on value-request for p_ifile.
To get F4 help for the input file path
PERFORM f_f4_input_file.
AT SELECTION-SCREEN ON p_ifile.
To validate and upload the input file
PERFORM f_load_file.
AT SELECTION-SCREEN ON p_sess.
To validate the Number of Sessions field
IF rad2 IS NOT INITIAL AND sy-ucomm EQ c_onli.
PERFORM f_check_sessions.
ENDIF.
***********Start of selection *******************
start-of-selection.
*To process BDC
PERFORM f_process_bdc.
TOP OF PAGE
TOP-OF-PAGE.
Writes the report heading and for displaying line number.
PERFORM f_report_header.
TYPES : BEGIN OF t_final,
matnr(50) TYPE c,
bismt(18) type c,
end of t_final.
TYPES: BEGIN OF t_fdata,
data(256) TYPE c,
END OF t_fdata.
TYPES: BEGIN OF t_error,
message(100) TYPE c,
END OF t_error.
*Internal table declarations
*Internal table to load the data from the file that is changed throgh BDC
DATA : i_final TYPE STANDARD TABLE OF t_final,
wa_final TYPE t_final.
*Internal table to store the error messages
DATA : i_error TYPE STANDARD TABLE OF t_error,
wa_error TYPE t_error.
*Internal table to load the raw data
DATA : i_fdata TYPE STANDARD TABLE OF t_fdata,
wa_fdata TYPE t_fdata.
*Internal table to store records of BDC
DATA : i_bdcdata TYPE STANDARD TABLE OF bdcdata INITIAL SIZE 0,
wa_bdcdata TYPE bdcdata.
Internal table to store BDC messages
DATA: i_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll INITIAL SIZE 0,
wa_bdcmsgcoll TYPE bdcmsgcoll.
VARIABLE DECLARATIONS
DATA: v_ifile TYPE string,
v_input TYPE i,
c_delimiter TYPE c VALUE 'X',
v_mode TYPE c VALUE 'A',
v_sessions TYPE i.
CONSTANTS
CONSTANTS : c_flagx TYPE c VALUE 'X',
c_slash TYPE c VALUE '/',
c_onli(4) TYPE c VALUE 'ONLI',
c_vl02(4) TYPE c VALUE 'VL02',
c_s TYPE c VALUE 'A'.
FORM f_f4_input_file .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_ifile.
ENDFORM. " f_f4_input_file
*& Form f_load_file
FORM f_load_file .
v_ifile = p_ifile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_ifile
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = i_fdata
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
*Text-103-Input file does not exist.
MESSAGE e000 WITH text-103 .
ELSEIF NOT i_fdata IS INITIAL.
DELETE i_fdata WHERE data = space.
DESCRIBE TABLE i_fdata LINES v_input.
ENDIF.
IF v_input EQ 0.
Text-104 - Input file is empty.
MESSAGE e000 WITH text-104 .
ENDIF.
ENDFORM. " f_load_file
*& Form f_check_sessions
FORM f_check_sessions .
IF p_sess IS INITIAL.
MESSAGE e000 WITH text-106.
ELSE.
v_sessions = v_input DIV p_sess.
ENDIF.
ENDFORM. " f_check_sessions
*& Form f_process_bdc
text
FORM f_process_bdc.
LOOP AT i_fdata INTO wa_fdata.
SPLIT wa_fdata AT cl_abap_char_utilities=>horizontal_tab
INTO wa_final-matnr
wa_final-bismt.
APPEND wa_final TO i_final.
CLEAR wa_fdata.
ENDLOOP.
IF rad1 = c_flagx.
PERFORM f_passbdc_vl02.
ELSEIF rad2 = c_flagx.
PERFORM f_sessions_vl02.
ENDIF.
ENDFORM. "f_process_bdc
To populate the Screen information
p_program Program Name
p_dynpro Screen Number
FORM bdc_dynpro USING p_program TYPE any
p_dynpro TYPE any.
CLEAR wa_bdcdata.
Populate the BDC structure with the Screen Information.
Move the Program name PROGRAM
wa_bdcdata-program = p_program.
Move the Screen Number DYNPRO
wa_bdcdata-dynpro = p_dynpro.
Indicate the beginning of a new screen
wa_bdcdata-dynbegin = c_flagx.
APPEND wa_bdcdata TO i_bdcdata.
ENDFORM. "f_bdc_dynpro
*& Form f_passbdc_vl02
text
FORM f_passbdc_vl02.
DATA: l_lines_im TYPE i.
SORT i_final BY matnr ASCENDING.
CLEAR wa_final.
LOOP AT i_final INTO wa_final.
CLEAR: i_bdcmsgcoll[],
wa_bdcmsgcoll,
wa_bdcdata.
CLEAR: i_bdcdata[].
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
wa_final-matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARA-BISMT'.
perform bdc_field using 'MARA-BISMT'
wa_final-bismt.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM02'.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM03'.
CALL TRANSACTION 'MM02' USING i_bdcdata
MODE v_mode
UPDATE c_s
MESSAGES INTO i_bdcmsgcoll.
If error occurred in call transaction 'VA02' then stores all
information of failed records into internal table i_error_im.
IF sy-subrc NE 0.
DESCRIBE TABLE i_bdcmsgcoll LINES l_lines_im.
CLEAR wa_bdcmsgcoll.
READ TABLE i_bdcmsgcoll INTO wa_bdcmsgcoll INDEX l_lines_im.
To capture success and error messages in BDC.
CALL FUNCTION 'FORMAT_MESSAGE' "#EC *
EXPORTING
id = wa_bdcmsgcoll-msgid
lang = wa_bdcmsgcoll-msgspra
no = wa_bdcmsgcoll-msgnr
v1 = wa_bdcmsgcoll-msgv1
v2 = wa_bdcmsgcoll-msgv2
v3 = wa_bdcmsgcoll-msgv3
v4 = wa_bdcmsgcoll-msgv4
IMPORTING
msg = wa_error-message
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ELSE.
WRITE: text-111 COLOR 7.
ENDIF.
CLEAR: wa_final.
REFRESH i_bdcdata.
ENDLOOP.
ENDFORM. "f_passbdc_va02
*& Form bdc_field
text
-->P_FNAM text
-->P_FVAL text
FORM bdc_field USING p_fnam TYPE any
p_fval TYPE any.
CLEAR wa_bdcdata.
Populate the Field Name
wa_bdcdata-fnam = p_fnam.
Populate the field value
wa_bdcdata-fval = p_fval.
APPEND wa_bdcdata TO i_bdcdata.
ENDFORM. "f_bdc_field
*& Form f_sessions_vl02
text
FORM f_sessions_vl02 .
DATA: l_sindex TYPE sy-tabix VALUE 1,
l_eindex TYPE sy-tabix,
l_flag TYPE c VALUE space.
l_eindex = v_input.
SORT i_final BY matnr ASCENDING.
DO p_sess TIMES.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'Y_VL02_NIK'
user = sy-uname
keep = c_flagx
EXCEPTIONS
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR wa_final.
CLEAR: i_bdcdata[].
LOOP AT i_final INTO wa_final FROM l_sindex TO l_eindex .
IF l_flag = v_sessions.
CLEAR l_flag.
EXIT.
ENDIF.
l_flag = l_flag + 1.
CLEAR: i_bdcdata[].
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
wa_final-matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARA-BISMT'.
perform bdc_field using 'MARA-BISMT'
wa_final-bismt.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM02'.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM03'.
l_sindex = l_sindex + 1.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDDO.
ENDFORM. " f_sessions_vl02
*& Form f_report_header
FORM f_report_header .
FORMAT COLOR COL_HEADING INTENSIFIED ON.
ULINE.
text-201 - Company: Carrier
text-102- Batch Data Communication.
text-202 - System: SAP
WRITE: /1 sy-vline,
3 text-201,
50 text-102,
100 text-202,
AT sy-linsz sy-vline.
text-203 - Program:
text-204 - Date/Time:
WRITE: /1 sy-vline,
3 text-203, sy-repid ,
100 text-204,sy-datum ,c_slash, sy-uzeit,
AT sy-linsz sy-vline.
text-205 - User ID:
text-206 - Page:
WRITE: /1 sy-vline,
3 text-205, sy-uname,
100 text-206, sy-pagno,
AT sy-linsz sy-vline.
FORMAT COLOR OFF.
ULINE.
ENDFORM. " f_report_header
FORM bdc_transaction USING tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = tcode
TABLES
dynprotab = i_bdcdata
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE: / text-109 ,wa_final-matnr,
text-110 .
ENDIF.
ENDFORM. "bdc_transaction -
DELETING THE RECORDS IN THE FORM
Dear Friends
I have a problem for deleting the records in my form
on the form I have button for deleting the record
and this button has
when-button-pressed trigger
And it has this contains
Do_Key('DELETE_RECORD');
COMMIT_FORM;
The system displayed this message after pressing the delete button
FRM-40400 : transaction complete: 1 record applied and saved
But when I inquiry, about this record it is not deleted .
Can any one tell me why the record is not deleted .
I am using this version of form
Forms [32 Bit] Version 6.0.8.11.3 (Production)
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining
waiting for your valuable replay.
Best regards
JamilDear Pavel
Yes the ON-DELETE trigger , it is exists in the block ,and because of that, it was not saving the deleted record and this code was in the
on-delete trigger
DECLARE
V_LOC VARCHAR(25);
BEGIN
SELECT CAR_NO INTO V_LOC
FROM CAR_FILE
WHERE CAR_NO = :J_CAR_NO ;
IF V_LOC IS NOT NULL THEN
UPDATE CAR_FILE
SET CAR_STATUS =2
WHERE CAR_NO = :J_CAR_NO;
ELSE
NULL;
END IF;
END ;
Why it is not working with ON-DELETE TRIGGER
But it is working with POST-DELETE TRIGGER.
Best regards
jamil -
How to delete the record in Table
Hi Guru's,
i have Table which contain no.of Records.
i want to deleted one record. if i go to Table maint.Generator....from table itself..
how to do that... when we deleting the record. can we create new TR for that?
can anybody tell me.
Thanks in Advance,
venkatHi,
it is answered, here for my table there is no Table Maint.Generator.
i just explained how i have done it.
i just simply gone into Debug mode. there
code = Dele.
i have given. then i came out from debug mode to Table. there i just got Delete button on application tool bar.
i selected the record then icliked on Delete button.
it is got deleted.
But it is not asking for any new Transport Request.
Regards,
Venkat -
How to delete the record in the file present in the application server?
Hi,
I have two questions.
i) How can I delete a record based on some condition in the recordx in the file that is present in the application server?
ii) How can I lock the users whiel one user is accessing the file on the application server?
Thanks in advance.
SuvanHi,
If u want a frequent deletion this approach to delete a record from a file will havee unnecesary copy of records from one file to another and deletion of one file and renaming activities.
Instead what u can do is Add and field del_flag to ur record structure.
If u want to delete the record from a file just mark this del_flag as 'X'.
While processing u can have a loop like
loop at it_XXX where del_flag <> 'X'.
endloop.
This will logically delete the record.
When u r to finish the application at that time only perform this copying / deleting / and renaing activity
Hope this helps.
Cheers,
Nitin -
Regarding how to delete the record in internal table
Hi experts ,
how to delete the record in intarnal table after validating the data,
if record contains invalid fields?
i am giving my code see this and give me the answer?
loop at it_data into wa_data .
Validate Cost Center
READ TABLE it_kostl INTO wa_kostl WITH KEY kostl = wa_data-kostl BINARY SEARCH.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-004.
ENDIF.
Validate source file material ( material number )
loop at it_mara into wa_mara .
read table it_ausp into wa_ausp with key atwrt = wa_data-i_matnr .
if sy-subrc NE 0 .
PERFORM update_error_log USING wa_data
text-002.
delete it_data-objek .
else.
read table it_mara into wa_mara with key matnr = wa_ausp-objek .
if sy-subrc EQ 0 .
wa_data-objek = wa_mara-matnr.
wa_data-matkl = wa_mara-matkl.
ENDIF.
Modify it_data from wa_data .
endif.
*endloop.
Validate unit of measure (unit)
READ TABLE it_t006 INTO wa_t006 WITH KEY msehi = wa_data-unit .
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-003.
endif.
Validate delivery location ( storage location )
READ TABLE it_lgort INTO wa_lgort WITH KEY del_loc = wa_data-del_loc.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-001.
if wa_data-flag ='x' .
delete it_data from wa_data .
endif.
ENDIF.
endloop.Hi Naren,
First get the index number of the IT_data table and store it in one variable whose declaration like this.
data: tabix type sy-tabix.
while reading the internal table it_data set the tabix variable.
tabix = sy-tabix.
Instead of the above use below one.
Delete it_data-objek
Use the Below statement it will delete the row from the internal table.
Delete it_data-objek index tabix
Thanks,
Chidanand -
Sending email after deleting the records in a table
Hi
I am deleting the records in a table. After deleting the records,
i want to send an email to another person. I am planning to follow this steps.
1. Create a trigger on the table(AFTER DELETE ON table FOR EACH ROW)
to copy the deleted records to temporary table.
2. Read the temporary table and send an email.
Is there any other way we can do with out creating temporary table ?.
GovindI don't know what you plan to use to send the mail but here's a solution that would work.
-- Create a send mail procedure
create or replace procedure send_mail (
sender IN VARCHAR2,
recipient IN VARCHAR2,
message IN VARCHAR2)
IS
mailhost VARCHAR2(30) := 'localhost';
mail_conn utl_smtp.connection;
BEGIN
mail_conn := utl_smtp.open_connection(mailhost, 25);
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, sender);
utl_smtp.rcpt(mail_conn, recipient);
utl_smtp.data(mail_conn, message);
utl_smtp.quit(mail_conn);
END;
/-- Create the trigger to email deleted rows
create or replace trigger email_del_rows
after delete on <table>
for each row
declare
msg varchar2(2000);
begin
msg := 'COL1 COL2 COMPANY NAME DATE'||chr(10);
msg := msg||:old.col1||' '||:old.col2||' '||:old.company_name||' '||:old_date|| chr(10);
msg := msg||'END OF FILE';
send_mail('SENDER','[email protected]',msg);
end;
/You can make it look pretty but you get the basic idea. -
Problem after deleting the records........
Hi Folks,
Kindly help me with this report.
At one point I am deleting the itfinal internal table w.r.t
to HKONT.Before deleting I am having all the values for
LIFNR and AWKey,but once deleting(as mentioned earlier) I
am not getting these two values.The same Awkey is getting repeated
again and again.
Where I am going wrong.
REPORT zf14 no standard page heading line-size 134. .
TABLES: bkpf,bseg,lfa1,t001.
type-pools:slis.
TYPES : BEGIN OF x_bkpf,
bukrs TYPE bkpf-bukrs, " Company Code
belnr TYPE bkpf-belnr, " Document Number
gjahr TYPE bkpf-gjahr, " Fiscal year
awkey TYPE bkpf-awkey, " Object Key
bldat TYPE bkpf-bldat,
budat TYPE bkpf-budat,
END OF x_bkpf.
TYPES : BEGIN OF x_bseg,
bukrs TYPE bseg-bukrs, " Company Code
belnr TYPE bseg-belnr, " Document Number
gjahr TYPE bseg-gjahr, " Fiscal Year
koart TYPE bseg-koart,
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
lifnr TYPE bseg-lifnr, " Vendor Code
name1 type lfa1-name1,
ort01 type lfa1-ort01,
END OF x_bseg.
TYPES : BEGIN OF x_bseg1,
bukrs TYPE bseg-bukrs, " Company Code
belnr TYPE bsak-belnr, " Document Number
gjahr TYPE bsak-gjahr, " Fiscal Year
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
lifnr TYPE bseg-lifnr, " Vendor Code
wrbtr TYPE bseg-wrbtr, " Amt.in Doc.Curr
END OF x_bseg1.
types:begin of x_ven,
name1 type lfa1-name1,
ort01 type lfa1-ort01,
end of x_ven.
TYPES : BEGIN OF x_final,
bukrs TYPE bkpf-bukrs, " Company Code
belnr TYPE bkpf-belnr, " Document Number
gjahr TYPE bkpf-gjahr, " Fiscal year
blart TYPE bkpf-blart, " Document Type
awkey TYPE bkpf-awkey, " Object Key
bldat TYPE bkpf-bldat,
budat TYPE bkpf-budat,
mwskz TYPE bseg-mwskz,
qsskz TYPE bseg-qsskz,
wrbtr TYPE bseg-wrbtr, " Amount in Doc Curr
werks TYPE bseg-werks, " Recv Facility Code
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
ebeln1 type bseg-ebeln,
lifnr TYPE bseg-lifnr, " Vendor Code
lifnr1 type bseg-lifnr,
dmbtr TYPE bseg-dmbtr,
wrtbr type bseg-wrbtr,
vbill type bseg-wrbtr,
tdsamt type c,
tdsrate(4),
shkzg TYPE bseg-shkzg,
name1 TYPE lfa1-name1, "vendor Name
ort01 TYPE lfa1-ort01, "City
j_1icstno TYPE j_1imovend-j_1icstno, "CST
j_1ilstno TYPE j_1imovend-j_1ilstno ,"LST
END OF x_final.
DATA : it_bkpf TYPE TABLE OF x_bkpf WITH HEADER LINE .
DATA : it_bseg TYPE TABLE OF x_bseg WITH HEADER LINE .
DATA : it_bseg1 TYPE TABLE OF x_bseg1 WITH HEADER LINE .
DATA : itfinal TYPE TABLE OF x_final WITH HEADER LINE.
DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.
DATA :i(2), "month
y TYPE int4, "year
c(4),
v_bill LIKE bseg-dmbtr. " bill value
DATA : pos TYPE sy-tabix,
month(99),
month1(99).
data:sl_no(3) value 0.
*Alv
DATA:itfieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA:itrepid TYPE sy-repid.
itrepid = sy-repid.
DATA:itevent TYPE slis_t_event.
DATA:itlistheader TYPE slis_t_listheader.
DATA:walistheader LIKE LINE OF itlistheader.
DATA:itlayout TYPE slis_layout_alv.
DATA:top TYPE slis_formname.
DATA:itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
DATA:itprintparams TYPE slis_print_alv.
DATA:itvariant TYPE disvariant.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_bukrs LIKE t001-bukrs OBLIGATORY. "Company code
SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr, "Vendor name
s_budat for sy-datum obligatory, "bkpf-budat OBLIGATORY, "Date
s_gjahr FOR bseg-gjahr NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN.
SELECT SINGLE bukrs
INTO t001-bukrs
FROM t001
WHERE bukrs = p_bukrs.
IF sy-subrc <> 0.
MESSAGE e000(z_ma) WITH 'Invalid Company Code'.
ENDIF.
IF NOT s_lifnr[] IS INITIAL.
SELECT SINGLE lifnr
INTO lfa1-lifnr
FROM lfa1
WHERE lifnr IN s_lifnr.
IF sy-subrc <> 0.
MESSAGE e000(z_ma) WITH 'Invalid Vendor'.
ENDIF.
ENDIF.
START-OF-SELECTION.
*13
if s_budat is not initial.
if s_budat-high is not initial.
while s_budat-low le s_budat-high.
i = s_budat+7(2).
if i > 3.
s_gjahr = s_budat+3(4).
append s_gjahr.
else.
c = s_budat+3(4).
S_GJAHR = C - 1.
append s_gjahr.
endif.
s_budat-low = s_budat-low + 1.
endwhile.
else.
i = s_budat+7(2).
if i > 3.
s_gjahr = s_budat+3(4).
append s_gjahr.
else.
c = s_budat+3(4).
S_GJAHR = C - 1.
append s_gjahr.
endif.
endif.
endif.
*13
SELECT bukrs belnr gjahr awkey bldat budat
INTO TABLE it_bkpf
FROM bkpf
WHERE bukrs = p_bukrs
AND budat IN s_budat
and gjahr = s_gjahr. "13
IF NOT it_bkpf[] IS INITIAL.
SELECT bukrs belnr dmbtr wrbtr hkont ebeln lifnr
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs = it_bkpf-bukrs
and belnr = it_bkpf-belnr
AND gjahr = s_gjahr "13-it_bkpf-gjahr
AND koart = 'K'.
ENDIF.
IF NOT it_bseg[] IS INITIAL.
SELECT belnr gjahr dmbtr wrbtr hkont ebeln lifnr
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg1
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs = it_bkpf-bukrs "13it_bkpf-bukrs
AND belnr = it_bkpf-belnr "13it_bkpf-belnr
AND gjahr = s_gjahr. "13-it_bkpf-gjahr.
ENDIF.
LOOP AT it_bkpf.
MOVE-CORRESPONDING it_bkpf TO itfinal.
APPEND itfinal.
ENDLOOP.
LOOP AT it_bseg.
MOVE-CORRESPONDING it_bseg TO itfinal.
append itfinal.
select single name1 ort01 from lfa1 into (itfinal-name1 , itfinal-ort01) where lifnr = it_bseg-lifnr.
select single j_1icstno j_1ilstno into (itfinal-j_1icstno , itfinal-j_1ilstno) from j_1imovend
where lifnr = it_bseg-lifnr.
ENDLOOP.
LOOP AT it_bseg1.
MOVE-CORRESPONDING it_bseg1 TO itfinal.
APPEND itfinal.
ENDLOOP.
loop at it_bseg1.
itfinal-ebeln1 = it_bseg1-ebeln.
append itfinal.
endloop.
*Deleting the records from ITFINAL w.r.t HKONT.
<b>LOOP AT itfinal.
IF itfinal-hkont NE '0020106230' AND
itfinal-hkont NE '0020106330'.
DELETE itfinal.
endif.
clear itfinal.
ENDLOOP.</b>
*Caluculating Bill Value
loop at itfinal.
if itfinal-hkont = '0020106230'.
itfinal-tdsrate = '2%'.
itfinal-vbill = itfinal-wrbtr * 100 / 2.
modify itfinal.
elseif itfinal-hkont = '0020106330'.
itfinal-tdsrate = '4%'.
itfinal-vbill = itfinal-wrbtr * 100 / 4.
modify itfinal.
endif.
endloop.
sort itfinal by belnr.
delete adjacent duplicates from itfinal comparing belnr.
format reset.
format color col_normal.
LOOP AT itfinal.
sl_no = sl_no + 1.
write:/ sy-vline,
2 sl_no,
7 sy-vline,
10 itfinal-ebeln1,
21 sy-vline,
23 itfinal-awkey,
44 sy-vline,
45 itfinal-bldat,
57 sy-vline,
60 itfinal-vbill,
75 sy-vline,
76 itfinal-tdsrate,
85 sy-vline,
89 itfinal-wrbtr,
106 sy-vline,
109 itfinal-belnr,
121 sy-vline,
124 itfinal-budat,
134 sy-vline.
ENDLOOP.
write:/ sy-uline.
top-of-page.
data : name1(60).
data : month_text(127),
string(99).
call function 'MONTH_NAMES_GET'
exporting
language = sy-langu
IMPORTING
RETURN_CODE =
tables
month_names = month_names[]
exceptions
month_names_not_found = 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.
format reset.
format color col_positive.
if not s_budat-low is initial .
read table month_names with key mnr = s_budat-low+4(2).
if sy-subrc = 0.
month = month_names-ltx.
string = 'Details of TDS (2% / 4%) On Works Contract Deducted'.
concatenate string 'for the Month of' month into month_text
separated by space.
write :/ month_text.
skip 1.
endif.
endif.
concatenate itfinal-name1 ',' itfinal-ort01
into name1 separated by space.
write :/ 'Vendor Code :', itfinal-lifnr.
write :/ 'Vendor Name and City :', name1.
skip 1.
write :/ 'TNGST Registration No :', itfinal-j_1ilstno,
/ 'CST Registration No :', itfinal-j_1icstno.
skip 1.
Display the coloumn headings
format reset.
format color col_heading.
write :/ sy-uline.
write:/ sy-vline,
2 'Sl_no',
7 sy-vline,
10 'P.O. No',
21 sy-vline,
22 'Invoice No',
44 sy-vline,
45 'Inv Date',
57 sy-vline,
60 'Bill value',
75 sy-vline,
76 'TDS Rate',
85 sy-vline,
89 'TDS Amount' ,
106 sy-vline,
108 'Doc.No.',
121 sy-vline,
125 'Pos Date',
134 sy-vline,
sy-uline.
K.Kiran.Kiran,
I am pasting code here and i am sure that the code should work now
REPORT zf14 no standard page heading line-size 134. .
TABLES: bkpf,bseg,lfa1,t001.
type-pools:slis.
TYPES : BEGIN OF x_bkpf,
bukrs TYPE bkpf-bukrs, " Company Code
belnr TYPE bkpf-belnr, " Document Number
gjahr TYPE bkpf-gjahr, " Fiscal year
awkey TYPE bkpf-awkey, " Object Key
bldat TYPE bkpf-bldat,
budat TYPE bkpf-budat,
END OF x_bkpf.
TYPES : BEGIN OF x_bseg,
bukrs TYPE bseg-bukrs, " Company Code
belnr TYPE bseg-belnr, " Document Number
gjahr TYPE bseg-gjahr, " Fiscal Year
koart TYPE bseg-koart,
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
lifnr TYPE bseg-lifnr, " Vendor Code
name1 type lfa1-name1,
ort01 type lfa1-ort01,
END OF x_bseg.
TYPES : BEGIN OF x_bseg1,
bukrs TYPE bseg-bukrs, " Company Code
belnr TYPE bsak-belnr, " Document Number
gjahr TYPE bsak-gjahr, " Fiscal Year
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
lifnr TYPE bseg-lifnr, " Vendor Code
wrbtr TYPE bseg-wrbtr, " Amt.in Doc.Curr
END OF x_bseg1.
types:begin of x_ven,
name1 type lfa1-name1,
ort01 type lfa1-ort01,
end of x_ven.
TYPES : BEGIN OF x_final,
bukrs TYPE bkpf-bukrs, " Company Code
belnr TYPE bkpf-belnr, " Document Number
gjahr TYPE bkpf-gjahr, " Fiscal year
blart TYPE bkpf-blart, " Document Type
awkey TYPE bkpf-awkey, " Object Key
bldat TYPE bkpf-bldat,
budat TYPE bkpf-budat,
mwskz TYPE bseg-mwskz,
qsskz TYPE bseg-qsskz,
wrbtr TYPE bseg-wrbtr, " Amount in Doc Curr
werks TYPE bseg-werks, " Recv Facility Code
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
ebeln1 type bseg-ebeln,
lifnr TYPE bseg-lifnr, " Vendor Code
lifnr1 type bseg-lifnr,
dmbtr TYPE bseg-dmbtr,
wrtbr type bseg-wrbtr,
vbill type bseg-wrbtr,
tdsamt type c,
tdsrate(4),
shkzg TYPE bseg-shkzg,
name1 TYPE lfa1-name1, "vendor Name
ort01 TYPE lfa1-ort01, "City
j_1icstno TYPE j_1imovend-j_1icstno, "CST
j_1ilstno TYPE j_1imovend-j_1ilstno ,"LST
END OF x_final.
DATA : it_bkpf TYPE TABLE OF x_bkpf WITH HEADER LINE .
DATA : it_bseg TYPE TABLE OF x_bseg WITH HEADER LINE .
DATA : it_bseg1 TYPE TABLE OF x_bseg1 WITH HEADER LINE .
DATA : itfinal TYPE TABLE OF x_final WITH HEADER LINE.
DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.
DATA :i(2), "month
y TYPE int4, "year
c(4),
v_bill LIKE bseg-dmbtr. " bill value
DATA : pos TYPE sy-tabix,
month(99),
month1(99).
data:sl_no(3) value 0.
*Alv
DATA:itfieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA:itrepid TYPE sy-repid.
itrepid = sy-repid.
DATA:itevent TYPE slis_t_event.
DATA:itlistheader TYPE slis_t_listheader.
DATA:walistheader LIKE LINE OF itlistheader.
DATA:itlayout TYPE slis_layout_alv.
DATA:top TYPE slis_formname.
DATA:itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
DATA:itprintparams TYPE slis_print_alv.
DATA:itvariant TYPE disvariant.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_bukrs LIKE t001-bukrs OBLIGATORY. "Company code
SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr, "Vendor name
s_budat for sy-datum obligatory, "bkpf-budat OBLIGATORY, "Date
s_gjahr FOR bseg-gjahr NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN.
SELECT SINGLE bukrs
INTO t001-bukrs
FROM t001
WHERE bukrs = p_bukrs.
IF sy-subrc <> 0.
MESSAGE e000(z_ma) WITH 'Invalid Company Code'.
ENDIF.
IF NOT s_lifnr[] IS INITIAL.
SELECT SINGLE lifnr
INTO lfa1-lifnr
FROM lfa1
WHERE lifnr IN s_lifnr.
IF sy-subrc <> 0.
MESSAGE e000(z_ma) WITH 'Invalid Vendor'.
ENDIF.
ENDIF.
START-OF-SELECTION.
*13
if s_budat is not initial.
if s_budat-high is not initial.
while s_budat-low le s_budat-high.
i = s_budat+7(2).
if i > 3.
s_gjahr = s_budat+3(4).
append s_gjahr.
else.
c = s_budat+3(4).
S_GJAHR = C - 1.
append s_gjahr.
endif.
s_budat-low = s_budat-low + 1.
endwhile.
else.
i = s_budat+7(2).
if i > 3.
s_gjahr = s_budat+3(4).
append s_gjahr.
else.
c = s_budat+3(4).
S_GJAHR = C - 1.
append s_gjahr.
endif.
endif.
endif.
*13
SELECT bukrs belnr gjahr awkey bldat budat
INTO TABLE it_bkpf
FROM bkpf
WHERE bukrs = p_bukrs
AND budat IN s_budat
and gjahr = s_gjahr. "13
IF NOT it_bkpf[] IS INITIAL.
SELECT bukrs belnr dmbtr wrbtr hkont ebeln lifnr
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs = it_bkpf-bukrs
and belnr = it_bkpf-belnr
AND gjahr = s_gjahr "13-it_bkpf-gjahr
AND koart = 'K'.
ENDIF.
IF NOT it_bseg[] IS INITIAL.
SELECT belnr gjahr dmbtr wrbtr hkont ebeln lifnr
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg1
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs = it_bkpf-bukrs "13it_bkpf-bukrs
AND belnr = it_bkpf-belnr "13it_bkpf-belnr
AND gjahr = s_gjahr. "13-it_bkpf-gjahr.
ENDIF.
LOOP AT it_bkpf.
MOVE-CORRESPONDING it_bkpf TO itfinal.
APPEND itfinal.
ENDLOOP.
LOOP AT it_bseg.
MOVE-CORRESPONDING it_bseg TO itfinal.
append itfinal.
select single name1 ort01 from lfa1 into (itfinal-name1 , itfinal-ort01) where lifnr = it_bseg-lifnr.
select single j_1icstno j_1ilstno into (itfinal-j_1icstno , itfinal-j_1ilstno) from j_1imovend
where lifnr = it_bseg-lifnr.
ENDLOOP.
LOOP AT it_bseg1.
MOVE-CORRESPONDING it_bseg1 TO itfinal.
APPEND itfinal.
ENDLOOP.
loop at it_bseg1.
itfinal-ebeln1 = it_bseg1-ebeln.
append itfinal.
endloop.
*Deleting the records from ITFINAL w.r.t HKONT.
LOOP AT itfinal.
IF itfinal-hkont NE '0020106230' AND
itfinal-hkont NE '0020106330'.
DELETE itfinal.
clear itfinal.
continue.
else.
clear itfinal.
endif.
ENDLOOP.
*Caluculating Bill Value
loop at itfinal.
if itfinal-hkont = '0020106230'.
itfinal-tdsrate = '2%'.
itfinal-vbill = itfinal-wrbtr * 100 / 2.
modify itfinal.
elseif itfinal-hkont = '0020106330'.
itfinal-tdsrate = '4%'.
itfinal-vbill = itfinal-wrbtr * 100 / 4.
modify itfinal.
endif.
endloop.
sort itfinal by belnr.
delete adjacent duplicates from itfinal comparing belnr.
format reset.
format color col_normal.
LOOP AT itfinal.
sl_no = sl_no + 1.
write:/ sy-vline,
2 sl_no,
7 sy-vline,
10 itfinal-ebeln1,
21 sy-vline,
23 itfinal-awkey,
44 sy-vline,
45 itfinal-bldat,
57 sy-vline,
60 itfinal-vbill,
75 sy-vline,
76 itfinal-tdsrate,
85 sy-vline,
89 itfinal-wrbtr,
106 sy-vline,
109 itfinal-belnr,
121 sy-vline,
124 itfinal-budat,
134 sy-vline.
ENDLOOP.
write:/ sy-uline.
top-of-page.
data : name1(60).
data : month_text(127),
string(99).
call function 'MONTH_NAMES_GET'
exporting
language = sy-langu
IMPORTING
RETURN_CODE =
tables
month_names = month_names[]
exceptions
month_names_not_found = 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.
format reset.
format color col_positive.
if not s_budat-low is initial .
read table month_names with key mnr = s_budat-low+4(2).
if sy-subrc = 0.
month = month_names-ltx.
string = 'Details of TDS (2% / 4%) On Works Contract Deducted'.
concatenate string 'for the Month of' month into month_text
separated by space.
write :/ month_text.
skip 1.
endif.
endif.
concatenate itfinal-name1 ',' itfinal-ort01
into name1 separated by space.
write :/ 'Vendor Code :', itfinal-lifnr.
write :/ 'Vendor Name and City :', name1.
skip 1.
write :/ 'TNGST Registration No :', itfinal-j_1ilstno,
/ 'CST Registration No :', itfinal-j_1icstno.
skip 1.
Display the coloumn headings
format reset.
format color col_heading.
write :/ sy-uline.
write:/ sy-vline,
2 'Sl_no',
7 sy-vline,
10 'P.O. No',
21 sy-vline,
22 'Invoice No',
44 sy-vline,
45 'Inv Date',
57 sy-vline,
60 'Bill value',
75 sy-vline,
76 'TDS Rate',
85 sy-vline,
89 'TDS Amount' ,
106 sy-vline,
108 'Doc.No.',
121 sy-vline,
125 'Pos Date',
134 sy-vline,
sy-uline.
Thanks
seshu -
Delete the Record in Webdynpro java
Hi Gurus
I had one issue in webdynpro java , I need to delete row in Table if I delete the row in webdynpro java table at the same time the row it needs to delete in Back end table also .
We are useing NWDS 7.2 and we are using Adaptive Web Service model for to consume function module
Guys it's a urgent requirement for me please share your knowledge
ThanksHi
ABAPERS already they given one funtion module , for that in back end they written a querry for to delete the record ,
So now I want to Import that Adaptive webservice into webdynpro java , I will create a button in webdynpro java for Delete
here what code I neeed to mention , If I Delete the record in Table it has to delete in the backend also.
Guys please share your ideas
Thanks
Sony -
Deleting the Records that are in odd position
Hi,
How to delete the records that are in the odd position.
This is my program. Plz correct me. Iam not able to delete the records.
REPORT ZMTSHPRG19 .
TYPES:
BEGIN OF TY_EMP,
EMPID(4) TYPE N,
ENAME(30) TYPE C,
DEPT(4) TYPE C,
SALARY TYPE I,
END OF TY_EMP.
DATA:
FS_EMP TYPE TY_EMP,
IT_EMP TYPE TABLE OF TY_EMP.
FS_EMP-EMPID = '1009'.
FS_EMP-ENAME = 'XX'.
FS_EMP-DEPT = 'D100'.
FS_EMP-SALARY = 10000.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = '1007'.
FS_EMP-ENAME = 'YY'.
FS_EMP-DEPT = 'D100'.
FS_EMP-SALARY = '11000'.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1008.
FS_EMP-ENAME = 'ZZ'.
FS_EMP-DEPT = 'D200'.
FS_EMP-SALARY = 12000.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1001.
FS_EMP-ENAME = 'XY'.
FS_EMP-DEPT = 'D200'.
FS_EMP-SALARY = 10000.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1003.
FS_EMP-ENAME = 'XZ'.
FS_EMP-DEPT = 'D300'.
FS_EMP-SALARY = 8000.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1002.
FS_EMP-ENAME = 'YX'.
FS_EMP-DEPT = 'D300'.
FS_EMP-SALARY = 9500.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1004.
FS_EMP-ENAME = 'YZ'.
FS_EMP-DEPT = 'D300'.
FS_EMP-SALARY = 9500.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1005.
FS_EMP-ENAME = 'AA'.
FS_EMP-DEPT = 'D100'.
FS_EMP-SALARY = 10500.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1006.
FS_EMP-ENAME = 'BB'.
FS_EMP-DEPT = 'D200'.
FS_EMP-SALARY = 12000.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1010.
FS_EMP-ENAME = 'CC'.
FS_EMP-DEPT = 'D100'.
FS_EMP-SALARY = 15000.
APPEND FS_EMP TO IT_EMP.
LOOP AT IT_EMP INTO FS_EMP.
WRITE:/ FS_EMP-EMPID,FS_EMP-ENAME,FS_EMP-DEPT,FS_EMP-SALARY.
ENDLOOP.
ULINE.
DATA:
LINE_COUNT TYPE I,
W_REM TYPE I.
W_REM = LINE_COUNT MOD 2.
DESCRIBE TABLE IT_EMP LINES LINE_COUNT.
SORT IT_EMP BY EMPID.
IF W_REM = 0.
LOOP AT IT_EMP INTO FS_EMP.
WRITE:/ FS_EMP-EMPID,FS_EMP-ENAME,FS_EMP-DEPT,FS_EMP-SALARY..
ENDLOOP.
ENDIF.
Thanks.TYPES:
BEGIN OF TY_EMP,
EMPID(4) TYPE N,
ENAME(30) TYPE C,
DEPT(4) TYPE C,
SALARY TYPE I,
END OF TY_EMP.
DATA:
FS_EMP TYPE TY_EMP,
IT_EMP TYPE TABLE OF TY_EMP.
FS_EMP-EMPID = '1009'.
FS_EMP-ENAME = 'XX'.
FS_EMP-DEPT = 'D100'.
FS_EMP-SALARY = 10000.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = '1007'.
FS_EMP-ENAME = 'YY'.
FS_EMP-DEPT = 'D100'.
FS_EMP-SALARY = '11000'.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1008.
FS_EMP-ENAME = 'ZZ'.
FS_EMP-DEPT = 'D200'.
FS_EMP-SALARY = 12000.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1001.
FS_EMP-ENAME = 'XY'.
FS_EMP-DEPT = 'D200'.
FS_EMP-SALARY = 10000.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1003.
FS_EMP-ENAME = 'XZ'.
FS_EMP-DEPT = 'D300'.
FS_EMP-SALARY = 8000.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1002.
FS_EMP-ENAME = 'YX'.
FS_EMP-DEPT = 'D300'.
FS_EMP-SALARY = 9500.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1004.
FS_EMP-ENAME = 'YZ'.
FS_EMP-DEPT = 'D300'.
FS_EMP-SALARY = 9500.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1005.
FS_EMP-ENAME = 'AA'.
FS_EMP-DEPT = 'D100'.
FS_EMP-SALARY = 10500.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1006.
FS_EMP-ENAME = 'BB'.
FS_EMP-DEPT = 'D200'.
FS_EMP-SALARY = 12000.
APPEND FS_EMP TO IT_EMP.
FS_EMP-EMPID = 1010.
FS_EMP-ENAME = 'CC'.
FS_EMP-DEPT = 'D100'.
FS_EMP-SALARY = 15000.
APPEND FS_EMP TO IT_EMP.
LOOP AT IT_EMP INTO FS_EMP.
WRITE:/ FS_EMP-EMPID,FS_EMP-ENAME,FS_EMP-DEPT,FS_EMP-SALARY.
ENDLOOP.
ULINE.
DATA:
LINE_COUNT TYPE I,
W_REM TYPE I,
n type i value 1.
DESCRIBE TABLE IT_EMP LINES LINE_COUNT.
SORT IT_EMP BY EMPID.
LOOP AT IT_EMP INTO FS_EMP.
w_rem = n mod 2 .
if w_rem = 0 .
WRITE:/ FS_EMP-EMPID,FS_EMP-ENAME,FS_EMP-DEPT,FS_EMP-SALARY.
endif.
n = n + 1.
ENDLOOP.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 11, 2008 4:34 PM
Maybe you are looking for
-
Jabber and impacting other applications
We just put in our new Cisco phone system last week. We are seeing some issues running the Jabber client with other programs. I have three programs where we have seen some sort of impact. First one is runs a live stream to an excel spread sheet. Whil
-
Ouput sql from prepared statement
I'm using prepared statements and I want to output the sql that is being run in the statement to the console. For example: Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:thin:@xx.xx.x.xx:xxxx:xxxx",
-
Listing FTP directory with swing please help me
hi , please i wanna now how to use JTree with FinJ (ftp package that provides api ) if someone has build an ftp application using FinJ please send it to me in [email protected] or a link to dowload it pleaaaaaaaaaaasee any help will be good ( sorry f
-
IMessage on ML - "Could not sign into iMessage. Please check network settings and try again"
i came across an issue when signing into iMessage with an Apple ID on Mac. i had been experiencing the "Could not sign into iMessage. Please check network setting and try again" error for iMessage issue since installing Mountain Lion. i finally solve
-
Different Tax rates from same country plant/ sales organization
Hi Gurus, Here is a scenario I have- We have 2 plants in Japan, A & B, both are linked to Sales org A & B respectively, material X sold out of Sales Org/ Plant - A for a customer 100 needs to have tax rate of 8% and same material X sold out of Sales