Need help in generatin report email to outlook address thought shellp script
Hi Gururs,
Am new to shell scripting .
Your help is greatly appreciated.
This is the shell script code as below, and this is called by the plsql procedure to run the rpeort and generate an email.
email.sh
if [ $# -ge 1 ]
then
RUN_ENV=$1
else
RUN_ENV="prod"
fi
if [ "$CES_ENV" = "" ]
then
CES_ENV=$RUN_ENV
fi
# Begin setup environment variables
# TRK 09/21/2009 START #
#. /home/cardnet/$CES_ENV/bin/environ.sh
if [ "$BIN_DIR" = "" ]
then
BIN_DIR=`dirname $0`
fi
echo $BIN_DIR
. $BIN_DIR/environ.sh
# TRK 09/21/2009 END #
# End setup environment variables
# Log file setup
LOGDATE=`date +%Y%m%d`
#LOGFILE=/home/cardnet/$CES_ENV/log/generic_email.$LOGDATE.op # TRK 09/21/2009 #
LOGFILE=$HOME_DIR/log/generic_email.$LOGDATE.op
# Accept the paramemeters and store them in a variable
PROCESSNAME=$1
PATHNAME=$2
EMAIL_INPUT_FILE=$3
EMAIL_GROUP_FILE=$3.emlin
SUBJECT=$4
echo PATHNAME $2
echo PROCESSNAME $1
echo EMAIL_INPUT_FILE $3
echo EMAIL_GROUP_FILE
echo SUBJECT $4
echo ' ' >> $LOGFILE
echo '************************** START *************************' >> $LOGFILE
echo ' ' >> $LOGFILE
echo 'date and time : ' `date` >> $LOGFILE
echo ' ' >> $LOGFILE
mail_log_file=`date +%Y%m%d.%H%M%S`.mail_log_file
cd $PATHNAME
if [ $? -gt 0 ]
then
echo "Process Name : $PROCESSNAME ">> $mail_log_file
echo "Path name : $PATHNAME ">> $mail_log_file
echo "MAIL Filename : $EMAIL_INPUT_FILE " >> $mail_log_file
echo "MAIL subject : $SUBJECT " >> $mail_log_file
echo 'Failed to change directory to $PATHNAME ' >> $mail_log_file
echo 'Failed to change directory to $PATHNAME ' >> $LOGFILE
# mail -s "FTP failed for process: $process_name" $ERROR_MAIL_GROUP < $mail_log_file >> $LOGFILE
exit
fi
echo Current directory is `pwd` >> $LOGFILE
echo "Process Name : $PROCESSNAME ">> $mail_log_file
echo "Path name : $PATHNAME ">> $mail_log_file
echo "MAIL Filename : $EMAIL_INPUT_FILE " >> $mail_log_file
echo "MAIL subject : $SUBJECT " >> $mail_log_file
echo ' '>> $LOGFILE
echo "input file is $EMAIL_INPUT_FILE " >> $LOGFILE
echo ' '>> $LOGFILE
if [ ! -f $EMAIL_INPUT_FILE ]
then
echo "File $EMAIL_INPUT_FILE to email not found" >> $mail_log_file
echo "File $EMAIL_INPUT_FILE to email not found" >> $LOGFILE
# mail -s "File $EMAIL_INPUT_FILE to email not found" $ERROR_MAIL_GROUP < $mail_log_file >> $LOGFILE
exit
fi
#Get the file size in KB
du -k $EMAIL_INPUT_FILE | cut -f1 | read EMAILFILESIZE
echo "$EMAIL_INPUT_FILE has filesize = $EMAILFILESIZE " >> $LOGFILE
# Compress the file if size is more than 100 KB
if [ $EMAILFILESIZE -gt 100 ]
then
echo "compressing the file" >> $LOGFILE
# tarfile=$EMAIL_INPUT_FILE.tar
# tar -cf $tarfile $EMAIL_INPUT_FILE >> $LOGFILE
# compress -f $tarfile >> $LOGFILE
# attach_file=$tarfile.Z
#compress -f $EMAIL_INPUT_FILE >> $LOGFILE commented by GEK on 11/03/2010
zip $EMAIL_INPUT_FILE # GEK 11/03/2010
#attach_file=$EMAIL_INPUT_FILE.Z commented by GEK on 11/03/2010
attach_file=$EMAIL_INPUT_FILE.gz # GEK 11/03/2010
else
attach_file=$EMAIL_INPUT_FILE
fi
if [ ! -f $EMAIL_GROUP_FILE ]
then
echo "Mail group file $EMAIL_GROUP_FILE not found" >> $mail_log_file
echo "Mail group file $EMAIL_GROUP_FILE not found" >> $LOGFILE
mail -s "Mail group file $EMAIL_GROUP_FILE not found" $ERROR_MAIL_GROUP < $mail_log_file >> $LOGFILE
exit
fi
cat $EMAIL_GROUP_FILE | read EMAIL_GROUP
[email protected]
echo "send mail to $EMAIL_GROUP" >> $LOGFILE
echo "input file is $attach_file" >> $LOGFILE
# Send the email
#( uuencode $attach_file $attach_file;cat /home/cardnet/tools/BASE/WORK_MAIL_FOOTER.txt ) | mail -s "$SUBJECT" $EMAIL_GROUP >> $LOGFILE # TRK 09/21/200
9 #
( uuencode $attach_file $attach_file;cat $TOOLS_DIR/BASE/WORK_MAIL_FOOTER.txt ) | mail -s "$SUBJECT" $EMAIL_GROUP >> $LOGFILE
echo "File mailing process completed successfully." >> $LOGFILE
echo ' ' >> $LOGFILE
echo '************************** END *************************' >> $LOGFILE
echo ' ' >> $LOGFILE
Plsql proc :
CREATE OR REPLACE PROCEDURE PROD.sample_PROC (process_id_in NUMBER, local_file_name_in VARCHAR2, tms_mail_flag VARCHAR2 DEFAULT NULL)
AS
nSystemReturn NUMBER;
BIN_DIR VARCHAR2(50) := NULL;
DB_NAME VARCHAR2(15);
logfile UTL_FILE.FILE_TYPE;
vFileDate VARCHAR2(8);
process_email_address VARCHAR2(1000) := NULL;
ftp_mode VARCHAR2(4) := NULL;
ws_sys_command VARCHAR2(1000) := NULL;
ws_sys_return NUMBER := 0;
ws_process_name VARCHAR2(30);
varFTPIPADDRESS VARCHAR2(25);
varFILEIDENTIFIER VARCHAR2(4);
varPROCESSNAME VARCHAR2(30);
varFTPUSERID VARCHAR2(15);
varFTPPASSWORD VARCHAR2(15);
varPATHNAME VARCHAR2(500);
varREMOTEDIRECTORY VARCHAR2(50);
varREMOTEFILENAME VARCHAR2(100);
varCOMPRESSYES CHAR(1);
varPROCESSID NUMBER(8);
varFTP_TRANSMISSION_TYPE VARCHAR2(50);
VARSPECIAL_REMOTE_COMMAND VARCHAR2(200);
varSASTRAILER_JOB VARCHAR2(100);
varRETRANSMISSION_INTERVAL NUMBER;
logfile_path varchar2(500) := NULL;
logfile_name VARCHAR2(100) := NULL;
ftp_input_file UTL_FILE.FILE_TYPE;
trl_input_file UTL_FILE.FILE_TYPE;
eml_input_file UTL_FILE.FILE_TYPE;
varSASTRAILER_SPECIAL_COMMAND PROCESS_REFERENCE.SASTRAILER_SPECIAL_COMMAND%TYPE;
varSUB_PROCESS_NAME PROCESS_REFERENCE.SUB_PROCESS_NAME%TYPE;
varDESCRIPTION PROCESS_REFERENCE.DESCRIPTION%TYPE;
varMARS_ALERT_CODE PROCESS_REFERENCE.MARS_ALERT_CODE%TYPE;
varTMS_MAIL_FLAG PROCESS_REFERENCE.TMS_MAIL_FLAG%TYPE;
varPROCESS_FLAG PROCESS_REFERENCE.TMS_MAIL_FLAG%TYPE;
varFTP_FLAG PROCESS_REFERENCE.FTP_FLAG%TYPE;
varKEEP_FILE_NAME VARCHAR2(100);
nProcess_ctr NUMBER(3) := 0;
vTMP_local_file_name_in process_reference.process_file_name%TYPE;
vDATE_FORMAT_FOR_FILE_NAME process_reference.DATE_FORMAT_FOR_FILE_NAME%TYPE;
varSASTRAILER_JOB_PATH_NAME VARCHAR2(700);-- 08/08/2011 SCH
varSASTRAILER_PATH PROD.PROCESS_REFERENCE.PATH_NAME%TYPE;
vSASTRAILER_JOB_NAME PROD.PROCESS_REFERENCE.SASTRAILER_JOB%TYPE;
varSASTRAILER_JOB_FILE_NAME PROD.PROCESS_REFERENCE.SASTRAILER_JOB%TYPE := NULL;
BEGIN
SELECT TO_CHAR(SYSDATE,'YYYYMMDD') INTO vFileDate FROM DUAL;
ws_process_name := 'PROCESS_NOTIFICATION_PROC';
BEGIN
SELECT PATH_NAME, replace(PROCESS_FILE_NAME,'<DATE>',TO_CHAR(SYSDATE,DATE_FORMAT_FOR_FILE_NAME))
INTO logfile_path, logfile_name
FROM prod.process_reference
where process_name = ws_process_name
AND file_identifier = 'LOG';
logfile := UTL_FILE.FOPEN (logfile_path,logfile_name, 'A');
EXCEPTION WHEN OTHERS
THEN
UTL_FILE.PUT_LINE(logfile,TO_CHAR(SYSDATE,'mm-dd-yyyy hh24:mi:ss')||'Error in fileopen : ' || SQLERRM );
GOTO EXIT_REPORT;
END;
UTL_FILE.PUT_LINE(logfile,TO_CHAR(SYSDATE,'mm-dd-yyyy hh24:mi:ss')||'- Starting for process : ' || process_id_in);
UTL_FILE.FFLUSH(logfile);
vTMP_local_file_name_in := local_file_name_in;
FOR allprocessesCur_rec IN
(SELECT process_id, process_name, file_identifier, path_name,
ftp_ip_address, ftp_user_id, ftp_password,
NVL(remote_directory ,'PWD') REMOTEDIR, remote_file_name, NVL(compress_yes,'N') COMPRESSYES,NVL(ftp_transmission_type,'ascii') FTPTRANTYPE,
NVL(special_remote_command,'NONE') SPLREMOTECMD ,NVL(sastrailer_job,'NOTRAILER') SASTRAILER,NVL(retransmission_interval,0) RETRANINTVL ,
SASTRAILER_SPECIAL_COMMAND,
NVL(DESCRIPTION,PROCESS_NAME) PROCESSDESC, NVL(MARS_ALERT_CODE,'NA') MARSCODE,
NVL(TMS_MAIL_FLAG,'N') TMSMAILFLAG ,NVL(PROCESS_FLAG,'Y') PROCESSFLAG,
NVL(FTP_FLAG,'N') FTPFLAG,
DECODE(KEEP_FILE_DATE_FORMAT, NULL,'NA',REPLACE(process_file_name,'<DATE>',TO_CHAR(SYSDATE,KEEP_FILE_DATE_FORMAT)) ) KEEP_FILE_NAME
,DATE_FORMAT_FOR_FILE_NAME
FROM prod.process_reference
WHERE process_id = process_id_in
OR parallel_process_id = process_id_in)
LOOP
varPROCESSID := allprocessesCur_rec.process_id;
varPROCESSNAME := allprocessesCur_rec.process_name;
varFILEIDENTIFIER := allprocessesCur_rec.file_identifier;
varPATHNAME := allprocessesCur_rec.path_name;
varFTPIPADDRESS := allprocessesCur_rec.ftp_ip_address;
varFTPUSERID := allprocessesCur_rec.ftp_user_id;
varFTPPASSWORD := allprocessesCur_rec.ftp_password;
varREMOTEDIRECTORY := allprocessesCur_rec.REMOTEDIR;
varREMOTEFILENAME := allprocessesCur_rec.remote_file_name;
varCOMPRESSYES := allprocessesCur_rec.COMPRESSYES;
varFTP_TRANSMISSION_TYPE := allprocessesCur_rec.FTPTRANTYPE;
varSPECIAL_REMOTE_COMMAND := allprocessesCur_rec.SPLREMOTECMD;
varSASTRAILER_JOB := allprocessesCur_rec.SASTRAILER;
varRETRANSMISSION_INTERVAL := allprocessesCur_rec.RETRANINTVL;
varSASTRAILER_SPECIAL_COMMAND := allprocessesCur_rec.SASTRAILER_SPECIAL_COMMAND;
varDESCRIPTION := allprocessesCur_rec.PROCESSDESC;
varMARS_ALERT_CODE := allprocessesCur_rec.MARSCODE;
varTMS_MAIL_FLAG := allprocessesCur_rec.TMSMAILFLAG;
varPROCESS_FLAG := allprocessesCur_rec.PROCESSFLAG;
varFTP_FLAG := allprocessesCur_rec.FTPFLAG;
varKEEP_FILE_NAME := allprocessesCur_rec.KEEP_FILE_NAME;
vDATE_FORMAT_FOR_FILE_NAME :=allprocessesCur_rec.DATE_FORMAT_FOR_FILE_NAME;
process_email_address := NULL;
IF varTMS_MAIL_FLAG = 'Y' THEN
FOR procnotifCur1 IN (SELECT email_address FROM prod.process_notification WHERE process_id = 0)
LOOP
process_email_address := process_email_address || ' ' || procnotifCur1.email_address;
END LOOP;
END IF;
FOR procnotifCur2 IN (SELECT email_address FROM prod.process_notification WHERE process_id = varPROCESSID)
LOOP
process_email_address := process_email_address || ' ' || procnotifCur2.email_address;
END LOOP;
IF process_email_address IS NOT NULL THEN
eml_input_file := UTL_FILE.FOPEN (varPATHNAME,local_file_name_in||'.emlin', 'W');
UTL_FILE.PUT_LINE(eml_input_file,process_email_address);
UTL_FILE.FCLOSE(eml_input_file);
END IF;
IF process_email_address is NOT NULL THEN
BEGIN
SELECT 'ksh '||
PATH_NAME ||PROCESS_FILE_NAME || ' ' ||'"'||
varPROCESSNAME ||'"'|| ' ' ||'"'||
varPATHNAME ||'"'|| ' ' ||'"'||
local_file_name_in ||'"'|| ' ' ||'"'||
varDESCRIPTION ||'"'
INTO ws_sys_command
FROM prod.process_reference
WHERE process_name = ws_process_name
AND file_identifier = 'SH3';
ws_sys_command := '(uuencode '|| varPATHNAME || local_file_name_in || ' log.txt ) | mail -s "' || TO_CHAR(SYSDATE,'YYYYMMDD') || '-' || varPROCESSNAME || '"' || process_email_address;
UTL_FILE.PUT_LINE(logfile,TO_CHAR(SYSDATE,'mm-dd-yyyy hh24:mi:ss')||' Executing command - '||ws_sys_command);
ws_sys_return := daemon.execute_system(ws_sys_command, process_id_in);
dbms_lock.sleep(1);
UTL_FILE.PUT_LINE(LOGFILE, 'command completed with returncode: ' || ws_sys_return);
UTL_FILE.FFLUSH(logfile);
IF ws_sys_return != 0
THEN
UTL_FILE.PUT_LINE(LOGFILE, 'Non ZERO system return received from daemon for SH1 ' || ws_sys_return);
UTL_FILE.FFLUSH(logfile);
END IF;
EXCEPTION
WHEN OTHERS THEN
UTL_FILE.PUT_LINE(LOGFILE, 'Error in executing daemon for mail: ' || ws_sys_return || 'AND SQL ERR: '|| SQLERRM );
UTL_FILE.FFLUSH(logfile);
END;
END IF;
END LOOP;
UTL_FILE.FCLOSE(logfile);
<<EXIT_REPORT>>
NULL;
END Sample_PROC;
sample table data :
PROCESS_ID
EMAIL_ADDRESS
499
[email protected]
TMS_SYS_COMMAND
PROCESS_IND
PROCESSED_FLAG
ksh /home/test/email.sh "REPORT_IAB_MERS_WITH_LAC_TIDS" "/home/test/rpts" "20140128.REPORT_TIDS.CSV" "REPORT_TIDS"
499
N
PROCESS_ID
PROCESS_NAME
FILE_IDENTIFIER
PATH_NAME
PROCESS_FILE_NAME
DATE_FORMAT_FOR_FILE_NAME
TMS_MAIL_FLAG
DEBUG_FLAG
499
REPORT_TIDS
OUT
/home/test/rpts
<DATE>.REPORT_TIDS.CSV
YYYYMMDD
Y
Y
Than perhaps you don't have your mail system configured properly, such as a missing "smart host" or missing smtp relay in your sendmail configuraiton, or perhaps security options on your smtp gateway, or a networking or DNS issue, etc, etc.
I suggest to try sending a normal e-mail and check the logs to make sure that it works, before troubleshooting the script.
Similar Messages
-
I need help exporting Apple Mail messages to Outlook for MAC 2011
Good morning,
I need help exporting Apple Mail messages to Outlook for MAC 2011. Please....It is possible to do this without external tools, but it is a tremendous faff. See
http://answers.microsoft.com/en-us/mac/forum/macoffice2011-macoutlook/import-ema il-from-mail-to-outlook-2011/5e858173-e1f4-4adc-99d7-253cc467169d?page=2 for details.
The easiest way, however, is to use Mail Exporter Pro https://itunes.apple.com/us/app/mail-exporter-pro/id675131616?mt=12 which will convert the email for you from one format to the other, and comes with an excellent manual.
A third possibility is to connect Apple Mail to an email account via IMAP (this doesn’t have to be your usual account, you can just create a Gmail account for the purpose) . Copy all the messages into it and they will be uploaded. Then connect Outlook 2011 to the same account, via IMAP again, and let the messages download, then copy them to wherever you want to keep them and disconnect from that account. This is slow but preserves the attributes of your email (e.g. read/unead) better than any other method. -
hi friends i need help on classical reports,
sold-party,
material
sales and distrubitutation channel ,division,
incoming orders,order number,invoice ,credit,
i need sub totals and final total of invoice and each customer should display in new page .Hi
Use the Tables KNA1,VBAk,VBAP,VBRK and VBRP and design the report
see the sample report using KNA1,VBAK and VBAP.
REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
HEADING.
*TABLES DECLARATION
TABLES : KNA1, VBAK, VBAP.
*SELECT OPTIONS
SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
*INITIALIZATION
INITIALIZATION.
CUST_NO-LOW = '01'.
CUST_NO-HIGH = '5000'.
CUST_NO-SIGN = 'I'.
CUST_NO-OPTION = 'BT'.
APPEND CUST_NO.
*SELECTION SCREEN VALIDATION
AT SELECTION-SCREEN ON CUST_NO.
LOOP AT SCREEN.
IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
MESSAGE E001(ZTJ1).
ENDIF.
ENDLOOP.
*BASIC LIST SELECTION
START-OF-SELECTION.
SELECT KUNNR NAME1 ORT01 LAND1 INTO
(KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
FROM KNA1
WHERE KUNNR IN CUST_NO.
WRITE:/1 SY-VLINE,
KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
KNA1-NAME1 UNDER 'NAME',
61 SY-VLINE,
KNA1-ORT01 UNDER 'CITY',
86 SY-VLINE,
KNA1-LAND1 UNDER 'COUNTRY',
103 SY-VLINE.
HIDE: KNA1-KUNNR.
ENDSELECT.
ULINE.
*SECONDARY LIST ACCESS
AT user-command.
IF SY-UCOMM = 'IONE'.
PERFORM SALES_ORD.
ENDIF.
IF SY-UCOMM = 'ITWO'.
PERFORM ITEM_DET.
ENDIF.
*TOP OF PAGE
TOP-OF-PAGE.
FORMAT COLOR 1.
WRITE : 'CUSTOMER DETAILS'.
FORMAT COLOR 1 OFF.
ULINE.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'NAME',
61 SY-VLINE,
63 'CITY',
86 SY-VLINE,
88 'COUNTRY',
103 SY-VLINE.
ULINE.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR SECONDARY LISTS
TOP-OF-PAGE DURING LINE-SELECTION.
*TOP OF PAGE FOR 1ST SECONDARY LIST
IF SY-UCOMM = 'IONE'.
ULINE.
FORMAT COLOR 1.
WRITE : 'SALES ORDER DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'SALES ORDER NO.',
40 SY-VLINE,
42 'DATE',
60 SY-VLINE,
62 'CREATOR',
85 SY-VLINE,
87 'DOC DATE',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR 2ND SECONDARY LIST
IF SY-UCOMM = 'ITWO'.
ULINE.
FORMAT COLOR 1.
WRITE : 'ITEM DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'SALES ORDER NO.',
40 SY-VLINE,
42 'SALES ITEM NO.',
60 SY-VLINE,
62 'ORDER QUANTITY',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*END OF PAGE
END-OF-PAGE.
ULINE.
WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
SY-PAGNO.
SKIP.
*& Form SALES_ORD
*& FIRST SECONDARY LIST FORM
FORM SALES_ORD .
SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
(VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
FROM VBAK
WHERE KUNNR = KNA1-KUNNR.
WRITE:/1 SY-VLINE,
VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
40 SY-VLINE,
VBAK-ERDAT UNDER 'DATE',
60 SY-VLINE,
VBAK-ERNAM UNDER 'CREATOR',
85 SY-VLINE,
VBAK-AUDAT UNDER 'DOC DATE',
103 SY-VLINE.
HIDE : VBAK-VBELN.
ENDSELECT.
ULINE.
ENDFORM. " SALES_ORD
*& Form ITEM_DET
*& SECOND SECONDARY LIST FORM
FORM ITEM_DET .
SELECT VBELN POSNR KWMENG INTO
(VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
FROM VBAP
WHERE VBELN = VBAK-VBELN.
WRITE : /1 SY-VLINE,
VBAP-VBELN UNDER 'SALES ORDER NO.',
40 SY-VLINE,
VBAP-POSNR UNDER 'SALES ITEM NO.',
60 SY-VLINE,
VBAP-KWMENG UNDER 'ORDER QUANTITY',
103 SY-VLINE.
ENDSELECT.
ULINE.
ENDFORM. " ITEM_DET
REPORT demo_list_at_pf.
START-OF-SELECTION.
WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
AT pf5.
PERFORM out.
AT pf6.
PERFORM out.
AT pf7.
PERFORM out.
AT pf8.
PERFORM out.
FORM out.
WRITE: 'Secondary List by PF-Key Selection',
/ 'SY-LSIND =', sy-lsind,
/ 'SY-UCOMM =', sy-ucomm.
ENDFORM.
After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
Secondary List by PF-Key Selection
SY-LSIND = 14
SY-UCOMM = PF06
Example for AT USER-COMMAND.
REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
START-OF-SELECTION.
WRITE: 'Basic List',
/ 'SY-LSIND:', sy-lsind.
TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-pfkey.
WHEN 'TEST'.
WRITE 'Self-defined GUI for Function Codes'.
ULINE.
ENDCASE.
AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy-lsind = sy-lsind - 1.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'FC1'.
PERFORM out.
WRITE / 'Button FUN 1 was pressed'.
WHEN 'FC2'.
PERFORM out.
WRITE / 'Button FUN 2 was pressed'.
WHEN 'FC3'.
PERFORM out.
WRITE / 'Button FUN 3 was pressed'.
WHEN 'FC4'.
PERFORM out.
WRITE / 'Button FUN 4 was pressed'.
WHEN 'FC5'.
PERFORM out.
WRITE / 'Button FUN 5 was pressed'.
ENDCASE.
sy-lsind = sy-lsind - 1.
FORM out.
WRITE: 'Secondary List',
/ 'SY-LSIND:', sy-lsind,
/ 'SY-PFKEY:', sy-pfkey.
ENDFORM.
When you run the program, the system displays the following basic list with a the page header defined in the program:
You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
Reward points for useful Answers
Regards
Anji -
Need help on Oracle Report format
Hi,
I need help on Oracle Reports. I am generating a report in excel sheet. I have a column which is 13 digit number (In database it is CHAR datatype). In excel sheet it showing some thing like 9.78381E+12. I want to show complete number like 9783805591331.
Also sometimes leading zero's are not showing when my column values is something like 0098794859583. I need to show the leading zero's as well in excel without losing them.
Below are the parameters i am using for the report
DESFORMAT=SPREADSHEET AND DESTYPE=FILE
My Oracle 9i developer version.
Any help on this would be much appreciated.
Thanks
KishoreAn additional quote string ' character with the number field will solve this problem but if u want to display this field in report then it will look ugly
'''||yourfield from table; check ur regional settings also
plz mark it helpful correct if it is -
Need help Connecting Crystal Reports 8.5 with GBS Agency Expert 6.7.6c
Need help Connecting Crystal Reports 8.5 with GBS Agency Expert 6.7.6c. I need assistance on connecting these together so I can run a report. I am not an IT person so if someone could dumb it down it would be great.
Thanks,
NBGHealthHello,
I assume GBS Agency Expert 6.7.6c is some sort of database or data source? If you have an ODBC driver then create or use a System DSN to the database. Then you can create a report using that DSN.
Otherwise I suggest you contact the makers of GBS Agency Expert 6.7.6c and ask them how to connect to the database.
Let them know CR is ANSII 92 ODBC 3 compliant.
Thank you
Don -
Need Help XML Publisher Report
Hi Friends
I need to generate a report in xml publisher responsibility .
I have create and designed the RTF file using word , And i have genetared an XML file(template )
I have some doubt please clarify by doubts
In RTF template i have some 4columns
For EXample i Give some column name
Invoice Number , Invoice Line Number ,Tax Type ,Tax Code Name etc....
In my RTF I have done like this
I have created two 2 row and 4column
In the 1st row i have all the 4 column heading
In the 2nd row i have done like this
Developer tab> Design mode > In the legacy tool i have selected text Form field
Once i double click the text form field in the default text i have Given C1 Then in the Add help text button i have given <?C_INVOICE_NUMBER?> like this i have done for alls the columns
My RTF design is completed
Now i need load the XML is it?
In the XMl data query i have placed my sql statement
Here my doubt starts
wether all the column in the RTF should be in the XML sql statement ha?
2)In the top of my RTF i need to add date and page No how to add that ?
Thanks In advance
ATHi Friend
Iam saying this is my XML file
<LIST_G_TAX_NAME>
<G_TAX_NAME>
<C_SORT_TAX_NAME>USE TAX</C_SORT_TAX_NAME>
<C_TAX_NAME>Use Tax</C_TAX_NAME>
<C_TAX_RATE>8.25</C_TAX_RATE>
<C_TAX_TYPE>USE</C_TAX_TYPE>
<C_PERIOD_NAME>OCT-11</C_PERIOD_NAME>
<LIST_G_VENDOR>
<G_VENDOR>
<C_SORT_VENDOR_NAME/>
<C_SORT_SITE_CODE/>
<C_VENDOR_ID>851</C_VENDOR_ID>
<C_VENDOR_NAME>ORACLE CORPORATION</C_VENDOR_NAME>
<C_SITE_CODE>CHICAGO</C_SITE_CODE>
<LIST_G_INVOICE>
<G_INVOICE>
<C_INVOICE_DATE>17-OCT-11</C_INVOICE_DATE>
<C_SORT_INVOICE_NUMBER>1308</C_SORT_INVOICE_NUMBER>
<C_INVOICE_ID>350889</C_INVOICE_ID>
<C_INVOICE_NUMBER>1308</C_INVOICE_NUMBER>
<C_INVOICE_LINE_NUMBER>1</C_INVOICE_LINE_NUMBER>
<C_PO_NUMBER>256388</C_PO_NUMBER>
<C_DESCRIPTION>TEST</C_DESCRIPTION>
<C_GL_DATE>17-OCT-11</C_GL_DATE>
<C_INVOICE_LINE_AMOUNT>15</C_INVOICE_LINE_AMOUNT>
<C_CHARGE_ACCOUNT>412.00.6410.7831.1076.1001.00.000.0000</C_CHARGE_ACCOUNT>
<C_LIABILITY_ACCOUNT>412.00.0000.2152.1208.1001.00.000.0000</C_LIABILITY_ACCOUNT>
<C_BATCH_NAME>101711</C_BATCH_NAME>
<C_SITE_CODE2>CHICAGO</C_SITE_CODE2>
<C_INVOICE_AMOUNT>15</C_INVOICE_AMOUNT>
<LIST_G_DIST>
<G_DIST>
<C_INVOICE_TAX_ID>10061</C_INVOICE_TAX_ID>
<C_LINE_TYPE>ITEM</C_LINE_TYPE>
</G_DIST>
</LIST_G_DIST>
<C_TAXABLE_AMOUNT>15</C_TAXABLE_AMOUNT>
<C_TAX_AMOUNT>1.24</C_TAX_AMOUNT>
<C_INVOICE_AMOUNT_DISP> 15.00 </C_INVOICE_AMOUNT_DISP>
<C_TAXABLE_AMOUNT_DISP> 15.00 </C_TAXABLE_AMOUNT_DISP>
<C_TAX_AMOUNT_DISP> 1.24 </C_TAX_AMOUNT_DISP>
</G_INVOICE>
</LIST_G_INVOICE>
<C_INVOICE_SITE_SUM>124.9</C_INVOICE_SITE_SUM>
<C_INVOICE_SITE_SUM_DISP> 124.90 </C_INVOICE_SITE_SUM_DISP>
<C_TAX_SITE_SUM>5.4</C_TAX_SITE_SUM>
<C_TAX_SITE_SUM_DISP> 5.40 </C_TAX_SITE_SUM_DISP>
<C_TAXABLE_SITE_SUM>65.66</C_TAXABLE_SITE_SUM>
<C_TAXABLE_SITE_SUM_DISP> 65.66 </C_TAXABLE_SITE_SUM_DISP>
</G_VENDOR>
</LIST_G_VENDOR>
<C_OLD_VENDOR_ID>0</C_OLD_VENDOR_ID>
<C_INVOICE_SUM>124.9</C_INVOICE_SUM>
<C_INVOICE_SUM_DISP> 124.90 </C_INVOICE_SUM_DISP>
<C_TAX_SUM>5.4</C_TAX_SUM>
<C_TAX_SUM_DISP> 5.40 </C_TAX_SUM_DISP>
<C_TAXABLE_SUM>65.66</C_TAXABLE_SUM>
<C_TAXABLE_SUM_DISP> 65.66 </C_TAXABLE_SUM_DISP>
</G_TAX_NAME>
</LIST_G_TAX_NAME>
And if i need all the column to be displayed in my report
1)Invoice Number
2)Invoice Line Number
3)Tax Type
4)Tax Code Name
5)Tax Rate Percent
6)Supplier Name
7)Description
8)Gl Date
9)Invoive Line Amount
10)Taxable Line Amount
11)Tax Liability
12)Po Number
13)Charge Account
14)Liability Account
Which tag do i need to use fro grouping
For ex
Instead of this <?for-each:G_TAX_NAME?> <?end for-each?>
which one i need to use
Please help
Thanks
AT -
Need help in dynamic report for a range of year and period
Dear all,
I need help in creating an ALV report with dynamic columns based on the Year and period entered on the selection screen. for example if in the year we enter 2002 and period range from 10 to 12 then we should get the 3 columns display for cost(example) for period 10/2002, 11/2002 and 12/2002.
Can anyone help me in achieving this dynamically since the user can enter the year also in intervals along with the period and data also needs to be populated in the corresponding columns.
An example code would be of great help.
Thanks,
AmitHi,
Use field symbols as follows.
TYPE-POOLS : SLIS.
TABLES : MARC,T001W.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARC-MATNR,
END OF ITAB.
DATA : FIELDSTAB TYPE LVC_T_FCAT,
STAB TYPE LVC_S_FCAT,
T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
S_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
NEW_LINE TYPE REF TO DATA,
NEW_TABLE TYPE REF TO DATA,
INDEX(3) TYPE C,
STR(70),
TEXT(6),
CNT(1),
TEXT1(16),
REPID LIKE SY-REPID.
FIELD-SYMBOLS : <FS> TYPE STANDARD TABLE,
<WA> TYPE ANY.
SELECT-OPTIONS : S_WERKS FOR MARC-WERKS NO INTERVALS,
S_MATNR FOR MARC-MATNR NO INTERVALS.
INITIALIZATION.
REPID = SY-REPID.
START-OF-SELECTION.
SELECT * FROM MARC
INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE MATNR IN S_MATNR
AND WERKS IN S_WERKS.
SORT ITAB BY MATNR.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING MATNR.
STAB-FIELDNAME = 'MATNR'.
STAB-DATATYPE = 'CHAR'.
STAB-INTLEN = '18'.
APPEND STAB TO FIELDSTAB.
CLEAR CNT.
LOOP AT S_WERKS.
CLEAR TEXT.
CNT = CNT + 1.
CONCATENATE 'EISLO' CNT INTO TEXT.
STAB-FIELDNAME = TEXT.
STAB-DATATYPE = 'CHAR'.
STAB-INTLEN = '16'.
APPEND STAB TO FIELDSTAB.
CLEAR S_WERKS.
ENDLOOP.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = FIELDSTAB
IMPORTING
EP_TABLE = NEW_TABLE.
ASSIGN NEW_TABLE->* TO <FS>.
CREATE DATA NEW_LINE LIKE LINE OF <FS>.
ASSIGN NEW_LINE->* TO <WA>.
PERFORM MOVE_DATA.
CLEAR S_FIELDCAT.
S_FIELDCAT-FIELDNAME = 'MATNR'.
S_FIELDCAT-TABNAME = ITAB.
S_FIELDCAT-SELTEXT_M = 'Part Number'.
S_FIELDCAT-NO_ZERO = 'X'.
S_FIELDCAT-DDICTXT = 'M'.
APPEND S_FIELDCAT TO T_FIELDCAT.
CLEAR CNT.
LOOP AT S_WERKS.
CLEAR T001W.
CNT = CNT + 1.
SELECT SINGLE * FROM T001W WHERE WERKS = S_WERKS-LOW AND SPRAS = SY-LANGU.
CLEAR TEXT.
CONCATENATE 'EISLO' CNT INTO TEXT.
S_FIELDCAT-FIELDNAME = TEXT.
S_FIELDCAT-SELTEXT_M = T001W-NAME2.
S_FIELDCAT-NO_ZERO = 'X'.
S_FIELDCAT-DDICTXT = 'M'.
APPEND S_FIELDCAT TO T_FIELDCAT.
CLEAR S_WERKS.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = T_FIELDCAT[]
TABLES
T_OUTTAB = <FS>.
*& Form MOVE_DATA
text
FORM MOVE_DATA.
LOOP AT ITAB.
CLEAR STR.
CONCATENATE ITAB-MATNR ' ' INTO STR SEPARATED BY SPACE.
LOOP AT S_WERKS.
CLEAR MARC.
SELECT SINGLE * FROM MARC WHERE MATNR = ITAB-MATNR AND WERKS = S_WERKS-LOW.
IF SY-SUBRC EQ 0.
CLEAR TEXT1.
TEXT1 = MARC-EISLO.
CONCATENATE STR TEXT1 INTO STR SEPARATED BY SPACE.
ELSE.
CONCATENATE STR '0' INTO STR SEPARATED BY SPACE.
ENDIF.
ENDLOOP.
<WA> = STR.
APPEND <WA> TO <FS>.
CLEAR ITAB.
ENDLOOP.
ENDFORM. "MOVE_DATA
Reward points if helpful.
Regards,
Sankar.. -
I need help in Custom Reporting
Hi,
i need help in auditing, SCOM 2012 R2 is deployed in 2 servers with ACS, i have 2 file server that has some shared folder in which users work on some certain document i need to have a report that i can run on certain file that will show me who access that
file when he access what he did like (read write, delete). i don't think we have this type of capability in default report. let me know if someone can help me in that. (free/paid) i know its a bit customized. let me know if u need any more info.
Syed KasifHi,
As far as I know, to audit file access, we should Enable Audit Policy, and then Set up Audit System Access Control List (SACL).
After that, we can make sure that under security event logs there are auditing logs for file access.
Please refer to the below link for more details about auditing file access on file server:
http://blogs.technet.com/b/mspfe/archive/2013/08/27/auditing-file-access-on-file-servers.aspx
And for Collecting Security Events Using Audit Collection Services in Operations Manager:
http://technet.microsoft.com/en-us/library/hh212908.aspx
Regards,
Yan Li
Regards, Yan Li -
Need Help on calling report in OAF Page
Hi,
At present i am wokring EAM Module. Here i need to call one report.
In my OAF Page one button is there("The name of the button is *Issue*"). After clicking this button i need to fire one report(The name of the report is "Maintenance Picking Slip Issued Report").
Please help me how to call report? I don't have any idea how to proceed for this.please explain clearly.
Thanks in advance..
Thanks,
Somasekhar.Somasekhar,
you want to call PLSQL Report or XML Publisher report or you want to submit the concurrent request.
If this XML Publisher report then refer following code for your refrence
public BlobDomain getXMLData(String as[], String s, String s1, String s2, String s3, String s4, String s5,
String s6, String s7, String s8, String s9, String s10)
throws Throwable
int i;
int j;
int k;
int l;
int i1;
int j1;
int k1;
int l1;
int i2;
int j2;
int k2;
OracleCallableStatement oraclecallablestatement;
ARRAY array;
int ai[] = new int[as.length];
i = 0;
j = 0;
k = 0;
l = 0;
i1 = 0;
j1 = 0;
k1 = 0;
l1 = 0;
i2 = 0;
j2 = 0;
k2 = 0;
for(int l2 = 0; l2 < as.length; l2++)
ai[l2] = Integer.parseInt(as[l2]);
if(s.equals("Y"))
i = 1;
if(s1.equals("Y"))
j = 1;
if(s2.equals("Y"))
k = 1;
if(s3.equals("Y"))
l = 1;
if(s4.equals("Y"))
i1 = 1;
if(s5.equals("Y"))
j1 = 1;
if(s6.equals("Y"))
k1 = 1;
if(s7.equals("Y"))
l1 = 1;
if(s8.equals("Y"))
j2 = 1;
if(s10.equals("Y"))
k2 = 1;
i2 = Integer.parseInt(s9);
DBTransaction dbtransaction = getDBTransaction();
String s11 = "BEGIN :1 :=EAM_WorkOrderRep_PVT.getWoReportXML(:2, :3, :4, :5, :6, :7, :8, :9,:10,:11,:12,:13); END;";
oraclecallablestatement = (OracleCallableStatement)dbtransaction.createCallableStatement(s11, 1);
java.sql.Connection connection = oraclecallablestatement.getConnection();
ArrayDescriptor arraydescriptor = ArrayDescriptor.createDescriptor("SYSTEM.EAM_WIPID_TAB_TYPE", connection);
array = new ARRAY(arraydescriptor, connection, ai);
BlobDomain blobdomain;
oraclecallablestatement.registerOutParameter(1, 2005);
oraclecallablestatement.setArray(2, array);
oraclecallablestatement.setInt(3, i);
oraclecallablestatement.setInt(4, j);
oraclecallablestatement.setInt(5, k);
oraclecallablestatement.setInt(6, l);
oraclecallablestatement.setInt(7, k1);
oraclecallablestatement.setInt(8, l1);
oraclecallablestatement.setInt(10, i1);
oraclecallablestatement.setInt(11, j1);
oraclecallablestatement.setInt(9, j2);
oraclecallablestatement.setInt(12, i2);
oraclecallablestatement.setInt(13, k2);
oraclecallablestatement.execute();
CLOB clob = ((OracleCallableStatement)oraclecallablestatement).getCLOB(1);
blobdomain = new BlobDomain();
OutputStream outputstream = blobdomain.getBinaryOutputStream();
long l3 = clob.length();
byte abyte0[] = new byte[(int)l3];
String s12 = clob.getSubString(1L, (int)l3);
abyte0 = s12.getBytes("UTF-8");
outputstream.write(abyte0);
outputstream.close();
return blobdomain;
SQLException sqlexception;
sqlexception;
try
oraclecallablestatement.close();
catch(Exception exception) { }
throw OAException.wrapperException(sqlexception);
public void initSearchCriteria()
log(this, "init search crieria", 1);
getWorkPlanSearchCriteriaVO().executeQuery();
Let me know you got your point or not.
Thanks,
Kumar -
I need help to back up my current emails. I am trying to create an imap email account and i dont want to loose my emails in the process. Anyone???
Hi ricknz,
I suggest using Header and Footer rows, which are very useful in Numbers.
Say you start with this table:
Convert the first row to a header row:
Convert the last row to a Footer Row:
Add a sum formula in the Footer Row:
Then when you add values in the following rows the sum will adjust automatically and the table will expand as you add more data:
SG -
Day one of my new MacBook Pro & I desparately need help with calendar and email
It's day one of my new relationship with a Mac, and I need help! I'd like to use microsoft exchange to sync my calendars to iCal & my emails the way I currently do with my iPhone 4 and iPad 2. The problem is that all I get are error messages. They either say that communication with the server cannot be established or communication to ports 80 & 440 cannot be established. One account I'd an ssl and the others are gmail. Please advise!
anyone? please? i would appreciate any information.
-
Need help on switching my password recovery email because it is sending to my old email. Anyone know how to do this?
Hi Krebbo,
I apologize, I'm a bit unclear on exactly what the nature of your issue is. If you are talking about changing the Apple ID that your iPhone currently uses for services like the iTunes Store, you may find the following article helpful:
iOS: Sign in with a different Apple ID in the iTunes Store, App Store, and iBooks Store
http://support.apple.com/kb/ht1311
Regards,
- Brenden -
I need help with document in email
Need help with document from email
Have you updated to the latest version of Adobe Reader? Have you read the Help file in Reader about bringing PDFs from an email?
-
Need help to create report with jpeg/gif image
Hello,
I need help with creating a form with a special jpeg/gif seal. I never done this Java. Until now, I created all forms with ansi C++ with HP escape characters to draw lines, boxs, and text. This form will contain boxes which is populated with database information read from a text file.
Since this form contains a special seal on the upper right, I don't think it can be done with old fashion ansi C++. How can I create a form with Java and create it as a simple exe to just print the form to a specified printer.
Thanks,
JohnHi,
I am creating a form with boxes (lines and text). What is special about this form is that it has an image jpeg or gif at the top right corner. Is is a state department seal. Up to this form, I had used ansi C++ and print out escape HP character to print out the lines, boxes, and text. I have no idea how to print out the image. I am new to JAVA and only 1 class in it. Is there sample code out there to create this type of form with the image? I need a starting point.
Thanks,
John -
Need help with simple report built in CR in Eclipse
I'm using the Java SDK in Eclipse to be able to leverage a function that does not appear to be native in Crystal Reports - auto refresh. Looking at the SDK, it appears straight forward to create a viewer on an existing report (built via Crystal Reports) and then refresh the data in a loop. First glance at the SDK it appeared CrystalReportViewer would be the right class, but I didn't find that in the CR Java Runtime Library that comes with cr4e download. So, I used ReportViewerBean, at least to prove out the concept. Here's the prototype code (high-level), using the bean:
public static void main (...) throws ReportSDKException
ReportViewerBean viewer = new ReportViewerBean();
viewer.setReportSource(path to the .rpt file);
viewer.init();
viewer.start();
while (...) {
viewer.refreshReport();
What else is needed to display the report?
Thanks,
RogerI'm using the Java SDK in Eclipse to be able to leverage a function that does not appear to be native in Crystal Reports - auto refresh. Looking at the SDK, it appears straight forward to create a viewer on an existing report (built via Crystal Reports) and then refresh the data in a loop. First glance at the SDK it appeared CrystalReportViewer would be the right class, but I didn't find that in the CR Java Runtime Library that comes with cr4e download. So, I used ReportViewerBean, at least to prove out the concept. Here's the prototype code (high-level), using the bean:
public static void main (...) throws ReportSDKException
ReportViewerBean viewer = new ReportViewerBean();
viewer.setReportSource(path to the .rpt file);
viewer.init();
viewer.start();
while (...) {
viewer.refreshReport();
What else is needed to display the report?
Thanks,
Roger
Maybe you are looking for
-
How to track the report calling from powerbuilder?
Suppose I have a powerbuilder application myapp. there are many reports created with pb. There are 2 possible for pb report: datawindow get data from stored procedure datawindow get date with sql. myapp use a specific login mylogin to connect to syba
-
Adobe Acrobat X Pro will not print .pdf on HP printer
Help! I have not been able to print a .pdf file from my HP Officejet J6480. Each time I sent the file to the printer it acts as if its going to print and then I get a paper jam error but there isn't a paper jam. I am using an HP TouchSmart 610 with
-
Hi everyone, We have a page which contains a Calendar, when we're pressing "Next" button, it asks us to enter our user id -- password ? Is it normal to get this message ERROR-1002 ID ....unfound element ? Can somebody help us ? Thanks. Bye.
-
I have sufficient funds on my account but it goes to billing
i have $60 on my account but when i try to buy an in app purchase for $59.99 it goes to billing. Please help!
-
Can I install both Premiere Elements and Premiere Pro on my computer?
I use elements but I want to learn premiere pro so I just installed it but in the process elements was deleted. I still need elements to finish projects I've started in elements. Is there a way to have both programs on my computer and use both elem