How to send an abap report to an HTML file?
hello this a two part question and This is the first question and I will post the next question after I am done with this.
So here goes.
My question is how do I send/download an abap report and convert it to an HTML file?
Thanks guys take care!
Hi Chand,
This code will help.
Generate an HTML file from a Report in ABAP
data: begin of itab occurs 0,
matnr type mara-matnr,
mtart type mara-mtart,
matkl type mara-matkl,
groes type mara-groes,
end of itab.
data: ifields type table of w3fields with header line.
data: ihtml type table of w3html with header line.
select * into corresponding fields of table itab
from mara up to 100 rows.
call function 'WWW_ITAB_TO_HTML'
EXPORTING
* TABLE_ATTRIBUTES = 'BORDER=1'
* TABLE_HEADER =
ALL_FIELDS = 'X'
tables
html = ihtml
fields = ifields
* ROW_HEADER =
itable = itab
check sy-subrc = 0.
call function 'GUI_DOWNLOAD'
exporting filename = 'c:test.html'
tables data_tab = ihtml
Similar Messages
-
How to send an ABAP report to Microsoft Outlook
Hi All.
May you please help me out on this one, i am trying to send an ABAP report to Microsoft Outlook? I am not even sure where to start so please help me out i know you can help me...
Kind Regards,
Fred.Hi,
Here is the example program
*& Report ZSENDEMAIL *
*& Example of sending external email via SAPCONNECT *
REPORT zsendemail .
PARAMETERS: psubject(40) type c default 'Hello',
p_email(40) type c default '[email protected]' .
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
*START-OF-SELECTION.
START-OF-SELECTION.
Perform populate_message_table.
*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*& Form POPULATE_MESSAGE_TABLE
Adds text to email text table
form populate_message_table.
Append 'Email line 1' to it_message.
Append 'Email line 2' to it_message.
Append 'Email line 3' to it_message.
Append 'Email line 4' to it_message.
endform. " POPULATE_MESSAGE_TABLE
*& Form SEND_EMAIL_MESSAGE
Send email message
form send_email_message.
Fill the document data.
gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
Add the recipients email address
clear it_receivers.
refresh it_receivers.
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
append it_receivers.
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
receivers = it_receivers
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
endform. " SEND_EMAIL_MESSAGE
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
form initiate_mail_execute_program.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM
Regards
Sudheer -
How to Send mail with an attachment of html file?
Hi all,
i am using Oracle 11g Database R1 on Windows 2003 Server R2. I am using the below script for sending a mail with an attachment
declare
vInHandle utl_file.file_type;
flen number;
bsize number;
ex boolean;
l_Output raw(32767);
fname varchar2(30) := 'TEXT.TXT';
vSender varchar2(30) := '[email protected]';
vRecip varchar2(30) := '[email protected]';
vSubj varchar2(50) := 'Weekly Invoice Report';
vAttach varchar2(50) := 'TEXT.TXT';
vMType varchar2(30) := 'Content-type: text / html';
begin
utl_file.fgetattr('ORALOAD', fname, ex, flen, bsize);
vInHandle := utl_file.fopen('ORALOAD', fname, 'R');
utl_file.get_raw (vInHandle, l_Output);
utl_file.fclose(vInHandle);
utl_mail.send_attach_raw(sender => vSender
,recipients => vRecip
,subject => vsubj
,attachment => l_Output
,att_inline => false
,att_filename => fname);
end;
this Script is Working Fine for text based file only. but i want to send a html file from oracle directory. is it possible? .... Please Advice me... if it possible please provide a sample code or any Link Related to this.
Thank You So Much for Your Help
Shanif it possible please provide a sample code or any Link Related to this.Perhaps the maildemo is of use to you, read more threads about it's use here:
http://forums.oracle.com/forums/search.jspa?objID=f75&q=maildemo
OTN code sample link:
https://codesamples.samplecode.oracle.com/servlets/tracking?id=S516 -
How to call an abap report in BSP..
hi all,
Please can anybody tell me how to call an abap report in BSP application.....since I am new to BSP....
with regards,
Santoshcheck this thread
Urgent!! How to call a custom transaction or an ABAP program in BSP? -
How to send a ALV report as a workitem
Hi All,
How to send a ALV report to the SAP Inbox for approval.
Requirement: When the reviewer executes the report and click on send button.
It will go to the approver for report approval.
How to send a report when reviewer click on the send button.
I am unable to find a solution when the user click on the send button the report will go to the approver.
Please help me out on this...
Regards,
Siraj,
+918008322278.Hi Siraj
I do not have a ready sample with me; however, here can be a logical sequencing of steps which you can follow to achieve this:
1) Define a custom PF STATUS in the ALV with the SEND Button
2) In the User Command routine for ALV, code for SEND
3) See how standard ALV - EXPORT to EXCEL Works - Debug and find the steps to generate an EXCEL - in the SEND Functionality
4) Once Excel is downloaded, create a SOFM document for the same - Check the method CREATE of object SOFM on the coding required to do it
5) Generate the SOFM Object Instance using the document created and calling FM SWO_INVOKE
6) Now you have the run time instance of the report output as a document
7) Define a custom Business object and a custom workflow based on that object
8) Define a custom event with the event parameter of type SOFM
9) From your SEND routine of the report -> trigger the event and pass the SOFM Instance of the excel as event parameter
10) Workflow will have this object via binding from event to workflow container
11) In the decision step to approver, bind this to _ATTACH_OBJECTS
For each of these, you will find some link already on SCN.
Hope this helps.
Once you have the solution, by the above steps or a better one, do remember to create a document on SCN in order to help others - this is a valid requirement and it would be good to have a ready reckoner :-)
regards,
Modak -
How to shedule an abap report to run paralely in more background session
I wander how to shedule an abap report to run paralely in more background session.
I am afraid of parallel locking.Hi,
You can schedule different jobs with same program name.
Use ENQUEUE_ & DEQUEUE_ to lock/unlock the records being process. The lock objects can be created in SE11.
Best regards,
Prashant -
How to create a ABAP report off of SRM box for live data?
How to create a ABAP report off of SRM box for live data?
Thanks in advance.
York.you can try infoset query:
STEP - A:
1. Go to T Code RSQ02 and give the InfoSet name & select CREATE.
2. Provide the Name(Description) and Data Source i.e. for eg here i take "DIRECT READ OF TABLE" = /BIC/AODS100. Then CONTINUE.
3. Select what to Include in the 3 options available with the POPUP, here "INCLUDE ALL TABLE FIELDS". Then Check the fields and click GENERATE(one RED and WHITE round icon).
4. Now provide the PACKAGE for the INFOSET. Come Back(F3).
STEP - B: optional(If u want to create a new user group)
1. Select ENVIRONMENT -> USER GROUPS. Provide the User Group name and CREATE.
2. Provide Description and SAVE.
3. Provide PACKAGE and SAVE. Come Back (F3) to the Initial Screen.
4. Click Role/User Group Assignment. Select Newly Created User Group or an existing one. Then SAVE (CTRL + S). F3.
STEP - C:
1. Select ENVIRONMENT -> Queries. Provide the query name and CREATE.
2. Select the INFOSET u have created and assigned the user group.
3. Provide the Title and Select BASIC LIST. There you have to select (check) the fields you want to display, SAVE and then TEST. It will ask for Variant, just CONTINUE. -
How to send ALV Grid report to Email?
hai all,
How to send ALV Grid report to Email.
please its very urgent.....Hi,
when u run the Alv, u will button 'Mail Recepiant' in tool bar.When u click it and enter to new screen, go to the Recipient Tab(down) enter ur maild id and click 'Send' button on tool bar.
or.
if u want to send the Alv content to mail id thru prg, go thru the following code.
TABLES
TABLES: BSID. " Accounting: Secondary Index for Customers.
TYPE-POOLS
TYPE-POOLS: SLIS.
INTERNAL TABLES
Internal table to hold Customer data.
DATA: BEGIN OF TB_BSID OCCURS 0,
BUKRS LIKE BSID-BUKRS, " Company code
KUNNR LIKE BSID-KUNNR, " Customer number
AUGDT LIKE BSID-AUGDT, " Clearing Date
BLDAT LIKE BSID-BLDAT, " Doc date in document
SHKZG LIKE BSID-SHKZG, " Debit/credit indicator
DMBTR LIKE BSID-DMBTR, " Amount in local currency
ZFBDT LIKE BSID-ZFBDT, " Baseline date for due date calc
ZBD1T LIKE BSID-ZBD1T, " Cash discount days 1
ZBD2T LIKE BSID-ZBD2T, " Cash discount days 2
ZBD3T LIKE BSID-ZBD3T, " Net Payment Terms Period
REBZG LIKE BSID-REBZG, " No Of the Inv the Tran Belongs to
REBZT LIKE BSID-REBZT, " Follow-On Document Type
END OF TB_BSID.
Internal table to hold Open Items.
DATA: TB_BSID_OPEN LIKE TABLE OF TB_BSID WITH HEADER LINE.
Internal table to hold Cleared Items.
DATA: TB_BSAD_CLEAR LIKE TABLE OF TB_BSID WITH HEADER LINE.
Internal table to hold General Data in Customer Master
DATA: BEGIN OF TB_KNA1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR, " Customer Number
NAME1 LIKE KNA1-NAME1, " Name Line 1
TELF1 LIKE KNA1-TELF1, " Telephone Number
ADRNR LIKE KNA1-ADRNR, " Address
END OF TB_KNA1.
Internal table to hold Customer Master (Company Code)
DATA: BEGIN OF TB_KNB1 OCCURS 0,
KUNNR LIKE KNB1-KUNNR, " Customer Number
BUKRS LIKE KNB1-BUKRS, " Company code
ERDAT LIKE KNB1-ERDAT, " Rec Created Date
ZAMIB LIKE KNB1-ZAMIB, " DMS Managed Indicator
END OF TB_KNB1.
Internal table to hold Final Output Data
DATA: BEGIN OF TB_FINAL OCCURS 0,
KUNNR LIKE KNA1-KUNNR, " Customer Number
NAME1 LIKE KNA1-NAME1, " Name Line 1
ADDRESS1(25) TYPE C, " Address line 1
ADDRESS2(25) TYPE C, " Address line 2
ADDRESS3(25) TYPE C, " Address line 3
ADDRESS4(25) TYPE C, " Address line 4
PHONE LIKE KNA1-TELF1, " Telephone Number
DAYS_SLOW(3) TYPE C, " Days Slow
LAST_DATE(8) TYPE C, " Date of Last Invoice
AVG(4) TYPE C, " Average Days to Pay
CURRENT(10) TYPE N, " Current
AVG_1_30(10) TYPE N, " 1-30 past due
AVG_31_60(10) TYPE N, " 31-60 past due
AVG_61_90(10) TYPE N, " 61-90 past due
AVG_90G(10) TYPE N, " 90+ past due
END OF TB_FINAL.
ALV Internal tables
DATA : TB_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, " Field Catalog
TB_EVENTS TYPE SLIS_T_EVENT, " ALV Events
TB_COMMENTS TYPE SLIS_T_LISTHEADER. " Comment
Internal tables for the sending mail data
DATA: TB_OBJPACK TYPE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE,
TB_OBJHEAD TYPE SOLISTI1 OCCURS 1 WITH HEADER LINE,
TB_OBJTXT TYPE SOLISTI1 OCCURS 10 WITH HEADER LINE,
TB_RECLIST TYPE SOMLRECI1 OCCURS 5 WITH HEADER LINE,
TB_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
TB_DOC_CHNG TYPE SODOCCHGI1.
Internal table to get mail Receivers Address
DATA: TB_ZRECEIVE LIKE YSMTP_ADDRESS OCCURS 0 WITH HEADER LINE.
STRUCTURES
DATA: X_SADR TYPE SADR, " For Address
X_FIELDCAT TYPE SLIS_FIELDCAT_ALV, " For Field Catalog
X_LAYOUT TYPE SLIS_LAYOUT_ALV, " For Layout
X_EVENTS TYPE SLIS_ALV_EVENT, " For Events
X_COMMENTS TYPE SLIS_LISTHEADER, " For Comments
X_ADDR1_SEL LIKE ADDR1_SEL, " For Address
WA_FAEDE TYPE FAEDE. " For FAEDE struct
VARIABLES
DATA: G_REPID LIKE SY-REPID, " Prog ID
G_DAYS_SLOW(3) TYPE N, " Days Slow
G_OPEN TYPE I, " Counter
G_AVG(4) TYPE C, " Avg Days
G_COUNT TYPE I, " Counter
G_TITLE TYPE SOLISTI1-LINE, " Description
G_TAB_LINES TYPE SY-TABIX, " Internal data count
G_REC_COUNT TYPE I, " Total records
G_CURR_BAL TYPE N, " Account balance
G_FILE_NAME LIKE EDI_PATH-PTHNAM. " Output File Name
CONSTANTS
CONSTANTS: C_D TYPE C VALUE 'D', " Account type
C_X TYPE C VALUE 'X', " Check Value
C_0(4) TYPE N VALUE '0.00', " Constant for char
C_1(2) TYPE C VALUE '01', " Posting key const
C_H TYPE C VALUE 'H', " For Commenet-Type
C_TXT(3) TYPE N VALUE 'TXT', " File type
C_RAW(3) TYPE C VALUE 'RAW', " File type
C_DELIMITER TYPE X VALUE '09', " ASCII CODE LINE
C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
C_INTERFACE TYPE YWFSALOFFICNOTIF-INTERFACE_ID VALUE 'AP',
C_FILENAME(20) TYPE N VALUE 'TEXT.TXT'," File name
C_TITLE(30) TYPE N VALUE 'Z21614_DB_CREDIT_AGENCY',
C_Z001 TYPE RF035-RASID VALUE 'Z001'." Net 30/60/90/120/150
SELECTION SCREEN.
Selection Screen for Selection Criteria.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
SELECT-OPTIONS: S_BUKRS FOR BSID-BUKRS OBLIGATORY, " Company Code
S_BLDAT FOR BSID-BLDAT," OBLIGATORY, " Doc Date
S_KUNNR FOR BSID-KUNNR, " Cust No
S_ZUONR FOR BSID-ZUONR. " Assignment
PARAMETERS: P_GRACE(2) TYPE N OBLIGATORY, " Grace Days
P_ZAMIB LIKE KNB1-ZAMIB AS CHECKBOX. " DMS Indicator
SELECTION-SCREEN END OF BLOCK B1.
Selection Screen for Output Options.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-T02.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 01.
PARAMETERS: P_REPORT RADIOBUTTON GROUP R1. " Report Only
SELECTION-SCREEN COMMENT 5(25) TEXT-016.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 01.
PARAMETERS: P_DOWN RADIOBUTTON GROUP R1. " Dwnld to Unix
SELECTION-SCREEN COMMENT 5(25) TEXT-017.
SELECTION-SCREEN POSITION 30.
PARAMETERS: P_FILE LIKE FILENAME-FILEINTERN DEFAULT
'Z21614_DB_CREDIT_AGENCY'. " File Name
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
Selection Screen for E-mail.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-T03.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 01.
PARAMETERS: P_EMAIL AS CHECKBOX. " E-mail
SELECTION-SCREEN COMMENT 5(25) TEXT-018.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B3.
INITIALIZATION
INITIALIZATION.
G_REPID = SY-REPID.
AT SELECTION SCREEN. *
AT SELECTION-SCREEN.
Validation of selection screen entries
perform validate_data.
START-OF-SELECTION
START-OF-SELECTION.
Select Data from Customer Master (Company Code)
PERFORM SELECT_KNB1.
Select Custmer Open Items.
PERFORM SELECT_CUSTOMER_OPEN_ITEMS.
Select Custmer Cleared Items.
PERFORM SELECT_CUSTOMER_CLEARED_ITEMS.
Select General Data in Customer Master
PERFORM SELECT_KNA1.
Populate Final Output Data.
PERFORM POPULATE_TB_FINAL.
End of selection *
END-OF-SELECTION.
If both display report and send email is checked
IF P_REPORT = C_X AND P_EMAIL = C_X.
MESSAGE E999 WITH
'Select One Among Report Only & Send E-mail'(023).
When Radiobutton for Email or if the program is run background
ELSEIF ( P_EMAIL = C_X OR SY-BATCH = C_X ).
To send the mail
PERFORM SEND_EMAIL.
ELSEIF P_REPORT = C_X .
To display the Final Output data using ALV's
PERFORM DISPLAY_ALV_REPORT.
ENDIF.
Transfering data to file when downloading to Unix
IF P_DOWN = C_X.
IF G_REC_COUNT IS INITIAL.
MESSAGE I999 WITH
'No Records Found For Selection Criteria'(024).
EXIT.
ELSE.
IF NOT G_FILE_NAME IS INITIAL.
Trasefering data to file
PERFORM TRANSFER_DATA_FILE.
Interface Audit report
PERFORM WRITE_REPORT.
ENDIF.
ENDIF.
ENDIF.
F O R M S
*& Form VALIDATE_DATA
Validating selection-screen entries
FORM VALIDATE_DATA.
Local variables
DATA : L_BUKRS LIKE BSEG-BUKRS, " For Company Code
L_KUNNR LIKE BSEG-KUNNR. " For Customer Number
Validate the Company code.
SELECT SINGLE BUKRS
INTO L_BUKRS
FROM T001
WHERE BUKRS IN S_BUKRS.
IF SY-SUBRC <> 0.
MESSAGE E999 WITH 'Enter valid Company Code'(025).
ENDIF.
Validate the Customer number
IF NOT S_KUNNR[] IS INITIAL.
SELECT SINGLE KUNNR
INTO L_KUNNR
FROM KNA1
WHERE KUNNR IN S_KUNNR.
IF SY-SUBRC <> 0.
MESSAGE E999 WITH 'Enter valid Customer Number'(026).
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_DATA
*& Form SELECT_KNB1
Select Data from Customer Master (Company Code)
FORM SELECT_KNB1 .
CLEAR: TB_KNB1,
TB_KNB1[].
SELECT KUNNR
BUKRS
ERDAT
ZAMIB
FROM KNB1
INTO TABLE TB_KNB1
WHERE BUKRS IN S_BUKRS
AND KUNNR IN S_KUNNR.
IF SY-SUBRC = 0.
Sort TB_KNB1 by Customer no & Rec Created Date
SORT TB_KNB1 BY KUNNR ERDAT DESCENDING.
ENDIF.
ENDFORM. " SELECT_KNB1
*& Form SELECT_CUSTOMER_OPEN_ITEMS
Select Custmer Open Items.
FORM SELECT_CUSTOMER_OPEN_ITEMS .
CLEAR: TB_BSID,
TB_BSID[].
SELECT A~BUKRS
B~KUNNR
B~AUGDT
B~BLDAT
B~SHKZG
B~DMBTR
B~ZFBDT
B~ZBD1T
B~ZBD2T
B~ZBD3T
B~REBZG
B~REBZT
INTO TABLE TB_BSID
FROM BKPF AS A JOIN BSID AS B
ON ABUKRS = BBUKRS
AND ABELNR = BBELNR
AND AGJAHR = BGJAHR
WHERE A~BUKRS IN S_BUKRS
AND A~BLDAT IN S_BLDAT
AND B~KUNNR IN S_KUNNR
AND B~ZUONR IN S_ZUONR
AND B~BSCHL = C_1.
IF SY-SUBRC = 0.
DMS Managed Indicator = X.
IF P_ZAMIB = C_X.
LOOP AT TB_KNB1 WHERE ZAMIB = SPACE.
DELETE TB_BSID WHERE BUKRS = TB_KNB1-BUKRS
AND KUNNR = TB_KNB1-KUNNR.
ENDLOOP.
ENDIF.
Transfering Open Items from TB_BSID to TB_BSID_OPEN
TB_BSID_OPEN[] = TB_BSID[].
ENDIF.
ENDFORM. " SELECT_CUSTOMER_OPEN_ITEMS
*& Form SELECT_CUSTOMER_CLEARED_ITEMS
Select Custmer Cleared Items.
FORM SELECT_CUSTOMER_CLEARED_ITEMS .
CLEAR: TB_BSAD_CLEAR,
TB_BSAD_CLEAR[].
SELECT A~BUKRS
B~KUNNR
B~AUGDT
B~BLDAT
B~SHKZG
B~DMBTR
B~ZFBDT
B~ZBD1T
B~ZBD2T
B~ZBD3T
B~REBZG
B~REBZT
INTO TABLE TB_BSAD_CLEAR
FROM BKPF AS A JOIN BSAD AS B
ON ABUKRS = BBUKRS
AND ABELNR = BBELNR
AND AGJAHR = BGJAHR
WHERE A~BUKRS IN S_BUKRS
AND A~BLDAT IN S_BLDAT
AND B~KUNNR IN S_KUNNR
AND B~ZUONR IN S_ZUONR
AND B~BSCHL = C_1.
IF SY-SUBRC = 0.
DMS Managed Indicator = X.
IF P_ZAMIB = C_X.
LOOP AT TB_KNB1 WHERE ZAMIB = SPACE.
DELETE TB_BSID WHERE BUKRS = TB_KNB1-BUKRS
AND KUNNR = TB_KNB1-KUNNR.
ENDLOOP.
ENDIF.
Sort TB_BSID_CLEAR by Customer number
SORT TB_BSAD_CLEAR BY KUNNR.
ENDIF.
Append lines of TB_BSID_CLEAR to table TB_BSID
APPEND LINES OF TB_BSAD_CLEAR TO TB_BSID.
Sort TB_BSID by Cust num AND Doc date in document
SORT TB_BSID BY KUNNR BLDAT.
ENDFORM. " SELECT_CUSTOMER_CLEARED_ITEMS
*& Form SELECT_KNA1
Select General Data in Customer Master
FORM SELECT_KNA1.
CLEAR: TB_KNA1,
TB_KNA1[].
SELECT KUNNR
NAME1
TELF1
ADRNR
INTO TABLE TB_KNA1
FROM KNA1
WHERE KUNNR IN S_KUNNR.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " SELECT_KNA1
*& Form POPULATE_TB_FINAL
Populate Final Output Data.
FORM POPULATE_TB_FINAL.
Local variable
DATA: L_DAYS_SLOW(3) TYPE N. " Days Slow
CLEAR: TB_FINAL,
TB_FINAL[].
LOOP AT TB_KNA1.
Move-corresponding TB_KNA1 to TB_FINAL.
TB_FINAL-KUNNR = TB_KNA1-KUNNR. " Customer Number
TB_FINAL-NAME1 = TB_KNA1-NAME1. " Name Line 1
TB_FINAL-PHONE = TB_KNA1-TELF1. " Telephone Number
To get Customer Address.
PERFORM GET_CUSTOMER_ADDRESS.
To get Date of Last Invoice.
READ TABLE TB_BSID WITH KEY KUNNR = TB_KNA1-KUNNR.
IF SY-SUBRC = 0.
TB_FINAL-LAST_DATE = TB_BSID-BLDAT.
ENDIF.
To get past due and current details.
PERFORM GET_PAST_DUE_CURRENT.
To get Days Slow.
CLEAR WA_FAEDE .
LOOP AT TB_BSID_OPEN WHERE KUNNR = TB_KNA1-KUNNR.
WA_FAEDE-SHKZG = TB_BSID-SHKZG.
WA_FAEDE-ZFBDT = TB_BSID-ZFBDT.
WA_FAEDE-ZBD1T = TB_BSID-ZBD1T.
WA_FAEDE-ZBD2T = TB_BSID-ZBD2T.
WA_FAEDE-ZBD3T = TB_BSID-ZBD3T.
WA_FAEDE-REBZG = TB_BSID-REBZG.
WA_FAEDE-REBZT = TB_BSID-REBZT.
WA_FAEDE-KOART = C_D.
To Determine Due Date.
CALL FUNCTION 'DETERMINE_DUE_DATE'
EXPORTING
I_FAEDE = WA_FAEDE
IMPORTING
E_FAEDE = WA_FAEDE
EXCEPTIONS
ACCOUNT_TYPE_NOT_SUPPORTED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
CLEAR WA_FAEDE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: L_DAYS_SLOW.
L_DAYS_SLOW = SY-DATUM - WA_FAEDE-NETDT - P_GRACE.
G_DAYS_SLOW = G_DAYS_SLOW + ABS( L_DAYS_SLOW ).
G_OPEN = G_OPEN + 1.
ENDLOOP.
IF G_OPEN IS INITIAL.
TB_FINAL-DAYS_SLOW = G_DAYS_SLOW / G_OPEN. " Days Slow
ENDIF.
To get Average days to Pay.
PERFORM GET_AVG_DAYS_PAY.
Calculating total records .
G_REC_COUNT = G_REC_COUNT + 1.
APPEND TB_FINAL.
CLEAR TB_FINAL.
ENDLOOP.
Current account balance.
G_CURR_BAL = TB_FINAL-CURRENT + TB_FINAL-AVG_1_30 +
TB_FINAL-AVG_31_60 +
TB_FINAL-AVG_61_90 +
TB_FINAL-AVG_90G .
ENDFORM. " POPULATE_TB_FINAL
*& Form GET_PAST_DUE_CURRENT
To get past due and current details.
FORM GET_PAST_DUE_CURRENT.
Local Varaibles.
DATA: L_RF035_SFAE1 TYPE RF035-SFAE1,
L_RF035_SFAE2 TYPE RF035-SFAE2,
L_RF035_SFAE3 TYPE RF035-SFAE3,
L_RF035_SFAE4 TYPE RF035-SFAE4,
L_RF035_SFAE5 TYPE RF035-SFAE5,
L_RF035_SFAE6 TYPE RF035-SFAE6,
L_RF035_SFAEL TYPE RF035-SFAEL,
L_RF035_SNFA1 TYPE RF035-SNFA1,
L_RF035_SNFA2 TYPE RF035-SNFA2,
L_RF035_SNFA3 TYPE RF035-SNFA3,
L_RF035_SNFA4 TYPE RF035-SNFA4,
L_RF035_SNFA5 TYPE RF035-SNFA5,
L_RF035_SNFA6 TYPE RF035-SNFA6,
L_RF035_SNFAE TYPE RF035-SNFAE.
LOOP AT TB_KNB1 WHERE KUNNR = TB_KNA1-KUNNR.
CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'
EXPORTING
BUKRS = TB_KNB1-BUKRS
KKBER = ' '
KUNNR = TB_KNB1-KUNNR
RASID = C_Z001
IMPORTING
SFAE1 = L_RF035_SFAE1
SFAE2 = L_RF035_SFAE2
SFAE3 = L_RF035_SFAE3
SFAE4 = L_RF035_SFAE4
SFAE5 = L_RF035_SFAE5
SFAE6 = L_RF035_SFAE6
SFAEL = L_RF035_SFAEL
SNFA1 = L_RF035_SNFA1
SNFA2 = L_RF035_SNFA2
SNFA3 = L_RF035_SNFA3
SNFA4 = L_RF035_SNFA4
SNFA5 = L_RF035_SNFA5
SNFA6 = L_RF035_SNFA6
SNFAE = L_RF035_SNFAE
EXCEPTIONS
INVALID_RASTER = 1
NO_OPEN_ITEMS = 2
OTHERS = 3
IF SY-SUBRC = 0.
TB_FINAL-AVG_1_30 = TB_FINAL-AVG_1_30 + L_RF035_SFAE1.
TB_FINAL-AVG_31_60 = TB_FINAL-AVG_31_60 + L_RF035_SFAE2.
TB_FINAL-AVG_61_90 = TB_FINAL-AVG_61_90 + L_RF035_SFAE3.
TB_FINAL-AVG_90G = TB_FINAL-AVG_90G + L_RF035_SFAE4
+ L_RF035_SFAE5
+ L_RF035_SFAE6.
TB_FINAL-CURRENT = TB_FINAL-CURRENT + L_RF035_SNFAE.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDFORM. " GET_PAST_DUE_CURRENT
*& Form GET_CUSTOMER_ADDRESS
To get Customer Address.
FORM GET_CUSTOMER_ADDRESS.
X_ADDR1_SEL-ADDRNUMBER = TB_KNA1-ADRNR.
CALL FUNCTION 'ADDR_GET'
EXPORTING
ADDRESS_SELECTION = X_ADDR1_SEL
IMPORTING
SADR = X_SADR
EXCEPTIONS
PARAMETER_ERROR = 1
ADDRESS_NOT_EXIST = 2
VERSION_NOT_EXIST = 3
INTERNAL_ERROR = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ADDRESS LINE 1.
TB_FINAL-ADDRESS1 = X_SADR-STRAS.
ADDRESS LINE 2.
CONCATENATE X_SADR-PFACH 'CODE' X_SADR-PSTL2 INTO TB_FINAL-ADDRESS2
SEPARATED BY SPACE.
ADDRESS LINE 3.
CONCATENATE X_SADR-ORT01 X_SADR-ORT02 ',' X_SADR-REGIO X_SADR-PSTLZ
INTO TB_FINAL-ADDRESS3 SEPARATED BY SPACE.
ADDRESS LINE 4.
TB_FINAL-ADDRESS4 = X_SADR-LAND1.
ENDFORM. " GET_CUSTOMER_ADDRESS
*& Form GET_AVG_DAYS_PAY
To get Average days to Pay.
FORM GET_AVG_DAYS_PAY.
*Local variable
DATA: L_DAYS TYPE N . " Number of Days
LOOP AT TB_BSAD_CLEAR WHERE KUNNR = TB_KNA1-KUNNR.
L_DAYS = TB_BSAD_CLEAR-AUGDT - TB_BSAD_CLEAR-BLDAT.
G_AVG = G_AVG + L_DAYS.
G_COUNT = G_COUNT + 1.
ENDLOOP.
IF NOT G_COUNT IS INITIAL.
TB_FINAL-AVG = G_AVG / G_COUNT. " Average days to Pay.
ENDIF.
ENDFORM. " GET_AVG_DAYS_PAY
*& Form DISPLAY_ALV_REPORT
text
FORM DISPLAY_ALV_REPORT.
For Populating Field Catalog.
PERFORM RPT_BUILD_FIELDCATLOG.
For Modifying Field Catalog.
PERFORM RPT_MODIFY_FIELDCATLOG.
For TOP_OF_PAGE Event.
PERFORM RPT_GET_EVENTS.
For Displaying Output in Grid Format.
PERFORM RPT_GRID_DISPLAY.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form RPT_BUILD_FIELDCATLOG
text
FORM RPT_BUILD_FIELDCATLOG.
To build the Field Catlog.
DATA : L_TABNAME TYPE SLIS_TABNAME. " Table Name
L_TABNAME = 'TB_FINAL'.
REFRESH : TB_FIELDCAT.
CLEAR : TB_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = G_REPID
I_INTERNAL_TABNAME = L_TABNAME
I_INCLNAME = G_REPID
CHANGING
CT_FIELDCAT = TB_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_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.
ENDFORM. " RPT_BUILD_FIELDCATLOG
*& Form RPT_MODIFY_FIELDCATLOG
text
FORM RPT_MODIFY_FIELDCATLOG.
Getting the Header Text for the Coloumns
DATA : L_TABIX LIKE SY-TABIX, " Index
L_DDICTXT TYPE C VALUE 'L'. " Flag
Getting the Header Text for the Coloumns
LOOP AT TB_FIELDCAT INTO X_FIELDCAT.
CLEAR L_TABIX.
L_TABIX = SY-TABIX.
CASE X_FIELDCAT-FIELDNAME.
WHEN 'KUNNR'. " Customer Number
X_FIELDCAT-SELTEXT_L = 'Customer Number'(001).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'NAME1'. " Name Line 1
X_FIELDCAT-SELTEXT_L = 'Name'(002).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS1'. " Address line 1
X_FIELDCAT-SELTEXT_L = 'Address 1'(003).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS2'. " Address line 2
X_FIELDCAT-SELTEXT_L = 'Address 2'(004).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS3'. " Address line 3
X_FIELDCAT-SELTEXT_L = 'Address 3'(005).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'ADDRESS4'. " Address line 4
X_FIELDCAT-SELTEXT_L = 'Address 4'(006).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'PHONE'. " Telephone Number
X_FIELDCAT-SELTEXT_L = 'Telephone Number'(007).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'DAYS_SLOW'. " Days Slow
X_FIELDCAT-SELTEXT_L = 'Days Slow'(008).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'LAST_DATE'. " Date of Last Invoice
X_FIELDCAT-SELTEXT_L = 'Date of Last Invoice'(009).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG'. " Average Days to Pay
X_FIELDCAT-SELTEXT_L = 'Average Days to Pay'(010).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'CURRENT'. " Current
X_FIELDCAT-SELTEXT_L = 'Aging Category 1'(011).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_1_30'. " 1-30 past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 2'(012).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_31_60'. " 31-60 past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 3'(013).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_61_90'. " 61-90 past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 4'(014).
X_FIELDCAT-DDICTXT = L_DDICTXT.
WHEN 'AVG_90G'. " 90+ past due
X_FIELDCAT-SELTEXT_L = 'Aging Category 5'(015).
X_FIELDCAT-DDICTXT = L_DDICTXT.
ENDCASE.
MODIFY TB_FIELDCAT FROM X_FIELDCAT INDEX L_TABIX.
ENDLOOP.
ENDFORM. " RPT_MODIFY_FIELDCATLOG
*& Form RPT_GET_EVENTS
text
FORM RPT_GET_EVENTS.
DATA : L_TABIX TYPE SY-TABIX. " Index
CLEAR : TB_EVENTS,
TB_EVENTS[].
To get the events from this function module
for ALV display
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = TB_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE I999 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Modifing Top of Page event
READ TABLE TB_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO X_EVENTS.
IF SY-SUBRC = 0.
CLEAR L_TABIX.
L_TABIX = SY-TABIX.
X_EVENTS-FORM = C_TOP_OF_PAGE.
MODIFY TB_EVENTS FROM X_EVENTS INDEX L_TABIX.
CLEAR X_EVENTS.
ENDIF.
ENDFORM. " RPT_GET_EVENTS
*& Form TOP_OF_PAGE
Top Of Page for the ALV format
FORM TOP_OF_PAGE.
REFRESH TB_COMMENTS.
For heading
CLEAR X_COMMENTS.
X_COMMENTS-TYP = C_H.
X_COMMENTS-INFO = 'D&B Credit Agency Interface'(019).
APPEND X_COMMENTS TO TB_COMMENTS.
This module outputs formatted simple header information at TOP-OF-PAGE
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = TB_COMMENTS.
ENDFORM. " TOP_OF_PAGE
*& Form RPT_GRID_DISPLAY
text
FORM RPT_GRID_DISPLAY.
Layout Settings
CLEAR X_LAYOUT.
X_LAYOUT-ZEBRA = 'X'.
X_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
X_LAYOUT-NO_COLHEAD = SPACE.
To Display the Output in ALV Format
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
IS_LAYOUT = X_LAYOUT
IT_FIELDCAT = TB_FIELDCAT
IT_EVENTS = TB_EVENTS
TABLES
T_OUTTAB = TB_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " RPT_GRID_DISPLAY
*& Form SEND_EMAIL
text
--> p1 text
<-- p2 text
FORM SEND_EMAIL.
Prepare the mail
PERFORM SEND_MAIL USING C_INTERFACE.
Sending the mail to Receivers
PERFORM SENDING_MAIL.
ENDFORM. " SEND_EMAIL
*& Form SEND_MAIL
Sending the Mail
FORM SEND_MAIL USING P_C_INTERFACE TYPE YWFSALOFFICNOTIF-INTERFACE_ID.
Populating Report name
G_TITLE = C_TITLE.
PERFORM POPULATE_EMAIL_REF_DATA USING G_TITLE.
IF NOT G_REC_COUNT IS INITIAL.
To populate the data to table tb_objbin
PERFORM POPULATE_DATA_OBJBIN.
To get the attached file for the mail
CLEAR G_TAB_LINES.
DESCRIBE TABLE TB_OBJBIN LINES G_TAB_LINES.
TB_OBJHEAD = C_FILENAME.
APPEND TB_OBJHEAD.
CLEAR TB_OBJHEAD.
Creation of the entry for the mail
TB_OBJPACK-TRANSF_BIN = C_X.
TB_OBJPACK-HEAD_START = C_1.
TB_OBJPACK-HEAD_NUM = C_1.
TB_OBJPACK-BODY_START = C_1.
TB_OBJPACK-BODY_NUM = G_TAB_LINES.
TB_OBJPACK-DOC_TYPE = C_TXT.
TB_OBJPACK-OBJ_NAME = G_REPID.
TB_OBJPACK-OBJ_DESCR = 'Interface Audit Report'(020).
TB_OBJPACK-DOC_SIZE = G_TAB_LINES * 255.
APPEND TB_OBJPACK.
ENDIF.
ENDFORM. " SEND_MAIL
*& Form SENDING_MAIL
FORM SENDING_MAIL.
Function Module to send mail along with attached file
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = TB_DOC_CHNG
TABLES
PACKING_LIST = TB_OBJPACK
OBJECT_HEADER = TB_OBJHEAD
CONTENTS_BIN = TB_OBJBIN
CONTENTS_TXT = TB_OBJTXT
RECEIVERS = TB_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
CASE SY-SUBRC.
WHEN 0.
MESSAGE S999 WITH 'Mail has been sucessfully sent'(029).
WHEN 1.
MESSAGE S999 WITH 'Too Many Parameters'(030).
WHEN 2.
MESSAGE S999 WITH 'Doc Could Not Be Sent'(031).
WHEN 4.
MESSAGE S999 WITH 'No Authority To Send'(032).
WHEN 99.
MESSAGE S999 WITH 'Error While Sending'(033).
ENDCASE.
ENDFORM. " SENDING_MAIL
*& Form POPULATE_EMAIL_REF_DATA
Poplulating the body of the mail
FORM POPULATE_EMAIL_REF_DATA USING TEXT TYPE SOLISTI1-LINE.
Setting up Mail Subject
TB_DOC_CHNG-OBJ_DESCR = 'Interface Audit Report'(020).
Populating body of the mail
TB_OBJTXT-LINE = 'Interface Audit Report'(020).
APPEND TB_OBJTXT.
CLEAR: TB_OBJTXT.
DESCRIBE TABLE TB_OBJTXT LINES G_TAB_LINES.
READ TABLE TB_OBJTXT INDEX G_TAB_LINES.
*To determine the document size
TB_DOC_CHNG-DOC_SIZE = ( G_TAB_LINES - 1 ) * 255 + STRLEN( TB_OBJTXT ).
Creation of the entry for the Mail Contents
CLEAR TB_OBJPACK-TRANSF_BIN.
TB_OBJPACK-HEAD_START = C_1.
TB_OBJPACK-HEAD_NUM = C_0.
TB_OBJPACK-BODY_START = C_1.
TB_OBJPACK-BODY_NUM = G_TAB_LINES.
TB_OBJPACK-DOC_TYPE = C_RAW.
APPEND TB_OBJPACK.
ENDFORM. " POPULATE_EMAIL_REF_DATA
*& Form POPULATE_DATA_OBJBIN
Populating table for file attachment -
How to find existed abap reports?
how to find existed abap reports?
Hi abapdoubts,
on wich time do you want to find?
In runtime? Than sy-repid.
on dialog? take F1 with further Infoemation.
On the GUI on the riht_button corner, there are somw Information too.
regards, Dieter -
How to download a ABAP report to text file
Hi Experts,
I want to save a ABAP report to a local file in my PC (*txt format). Since it uses a lot of includes, I have to download those ones too.. Is there is quickway to save the main program and all it's subprograms to a text file ?
Regards
ShibuHi,
Try this report, it will solve u r problem,
TABLES:TRDIR.
SELECT-OPTIONS: PGMNAME FOR TRDIR-NAME.
CONSTANTS: LINESIZE value 2048.
PARAMETERS:
HEADING AS CHECKBOX DEFAULT 'X',
FGROUP AS CHECKBOX,
USER LIKE TRDIR-CNAM DEFAULT '*',
DOWNLOAD AS CHECKBOX default 'X',
pa_TEXTP AS CHECKBOX,
DOWNDIR(80) DEFAULT 'C:\temp\',
chg_date(8) default '19000101',
chg_time(6) default '000000'.
PGMNAME like TRDIR-NAME.
DATA:
W_TEXT(128),
W_FILENAME(128),
W_PROGRAM_LOW(8),
W_PROGRAM_HIGH(8).
DATA:
_texttab type textpool,
texttab type standard table of textpool initial size 0
with header line,
BEGIN OF TEXTTAB OCCURS 0,
ID(1),
KEY(8),
ENTRY(70),
END OF TEXTTAB,
BEGIN OF ABAPTAB OCCURS 500,
LINE(72),
line(LINESIZE),
END OF ABAPTAB,
BEGIN OF TRTAB OCCURS 0,
NAME LIKE TRDIR-NAME,
ENTRY LIKE TEXTTAB-ENTRY,
CDAT LIKE TRDIR-CDAT,
UDAT LIKE TRDIR-UDAT,
END OF TRTAB,
BEGIN OF TRFTAB OCCURS 0,
NAME LIKE TRDIR-NAME,
ENTRY LIKE TEXTTAB-ENTRY,
CDAT LIKE TRDIR-CDAT,
UDAT LIKE TRDIR-UDAT,
END OF TRFTAB.
START-OF-SELECTION.
IF FGROUP = ' '.
PERFORM LOAD_TRDIR_PROGRAM.
PERFORM PROCESS_PROGRAM.
ELSE.
PERFORM LOAD_TRDIR_FGROUP.
PERFORM PROCESS_FGROUP.
ENDIF.
*& form load_trdir_program.
FORM LOAD_TRDIR_PROGRAM.
SELECT * FROM TRDIR
WHERE NAME IN PGMNAME
and sdate >= chg_date
and stime >= chg_time.
IF USER <> '*'.
CHECK TRDIR-UNAM = USER OR
TRDIR-CNAM = USER.
ENDIF.
CLEAR: TEXTTAB.
REFRESH: TEXTTAB.
CLEAR: TRTAB.
READ TEXTPOOL TRDIR-NAME INTO TEXTTAB LANGUAGE 'E'.
IF SY-SUBRC = 0.
READ TABLE TEXTTAB WITH KEY 'R'.
MOVE TEXTTAB-ENTRY TO TRTAB-ENTRY.
ENDIF.
MOVE TRDIR-NAME TO TRTAB-NAME.
MOVE TRDIR-CDAT TO TRTAB-CDAT.
MOVE TRDIR-UDAT TO TRTAB-UDAT.
APPEND TRTAB.
CLEAR: TEXTTAB.
ENDSELECT.
ENDFORM. " load_trdir_program
*& Form load_trdir_fgroup
FORM LOAD_TRDIR_FGROUP.
SELECT * FROM TRDIR
WHERE NAME BETWEEN 'SAPLYYYY' AND 'SAPLZZZZ'.
CHECK TRDIR-UNAM = USER OR TRDIR-CNAM = USER.
CLEAR: TEXTTAB.
CLEAR: TRTAB.
REFRESH: TEXTTAB.
READ TEXTPOOL TRDIR-NAME INTO TEXTTAB LANGUAGE 'E'.
IF SY-SUBRC = 0.
READ TABLE TEXTTAB WITH KEY 'R'.
MOVE TEXTTAB-ENTRY TO TRTAB-ENTRY.
ENDIF.
MOVE TRDIR-NAME TO TRTAB-NAME.
MOVE TRDIR-CDAT TO TRTAB-CDAT.
MOVE TRDIR-UDAT TO TRTAB-UDAT.
APPEND TRTAB.
CLEAR: TEXTTAB.
ENDSELECT.
LOOP AT TRTAB.
MOVE-CORRESPONDING TRTAB TO TRFTAB.
APPEND TRFTAB.
MOVE TRTAB-NAME+3(5) TO W_PROGRAM_LOW.
MOVE '%' TO W_PROGRAM_LOW+5(1).
MOVE TRTAB-NAME+3(5) TO W_PROGRAM_HIGH.
MOVE 'MMMMMMMM' TO W_PROGRAM_HIGH.
SELECT * FROM TRDIR
WHERE NAME LIKE W_PROGRAM_LOW.
*where name between w_program_low and w_program_high.
CHECK TRDIR-NAME+5(1) <> '$'.
CHECK TRDIR-NAME(5) =
TRTAB-NAME+3(5).
READ TEXTPOOL TRDIR-NAME INTO
TEXTTAB LANGUAGE 'E'.
READ TABLE TEXTTAB WITH KEY 'R'.
MOVE TEXTTAB-ENTRY TO TRFTAB-ENTRY.
MOVE TRDIR-NAME TO TRFTAB-NAME.
MOVE TRDIR-CDAT TO TRFTAB-CDAT.
MOVE TRDIR-UDAT TO TRFTAB-UDAT.
APPEND TRFTAB.
ENDSELECT.
ENDLOOP.
ENDFORM. " load_trdir_fgroup.
FORM PROCESS_PROGRAM
FORM PROCESS_PROGRAM.
LOOP AT TRTAB.
READ REPORT TRTAB-NAME INTO ABAPTAB.
IF DOWNLOAD = 'X'.
PERFORM DOWNLOAD_PROGRAMS USING TRTAB-NAME.
ELSE.
PERFORM LIST_PROGRAMS USING TRTAB-NAME.
ENDIF.
IF pa_TEXTP = 'X'.
READ TEXTPOOL TRTAB-NAME INTO TEXTTAB LANGUAGE
'E'.
IF SY-SUBRC = 0 AND DOWNLOAD = 'X'.
PERFORM DOWNLOAD_TEXTPOOL USING
TRTAB-NAME.
ENDIF.
LOOP AT TEXTTAB.
WRITE:/
TEXTTAB-ID,
TEXTTAB-KEY,
TEXTTAB-ENTRY.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDFORM.
FORM PROCESS_fgroup
FORM PROCESS_FGROUP.
LOOP AT TRFTAB.
READ REPORT TRFTAB-NAME INTO ABAPTAB.
IF DOWNLOAD = 'X'.
PERFORM DOWNLOAD_PROGRAMS USING TRFTAB-NAME.
ELSE.
PERFORM LIST_PROGRAMS USING TRFTAB-NAME
ENDIF.
IF pa_TEXTP = 'X'.
READ TEXTPOOL TRFTAB-NAME INTO TEXTTAB LANGUAGE
'E'.
IF SY-SUBRC = 0 AND DOWNLOAD = 'X'.
PERFORM DOWNLOAD_TEXTPOOL USING
TRFTAB-NAME.
LOOP AT TEXTTAB.
WRITE:/
TEXTTAB-ID,
TEXTTAB-KEY,
TEXTTAB-ENTRY.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
*& Form DOWNLOAD_PROGRAMS
FORM DOWNLOAD_PROGRAMS USING NAME.
W_TEXT = 'Downloading'.
W_TEXT+15(8) = NAME.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
TEXT = W_TEXT
EXCEPTIONS
OTHERS = 1.
clear w_filename.
MOVE DOWNDIR TO W_FILENAME(80).
MOVE NAME TO W_FILENAME+20(8).
MOVE '.txt' TO W_FILENAME+28(4).
CONDENSE W_FILENAME NO-GAPS.
concatenate w_filename name '.doc' into w_filename.
condense w_filename no-gaps.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = W_FILENAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = ABAPTAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
ENDFORM. " DOWNLOAD_PROGRAMS
*& Form LIST_PROGRAMS
FORM LIST_PROGRAMS USING NAME.
LOOP AT ABAPTAB.
WRITE:/ NAME, ABAPTAB-LINE.
ENDLOOP.
ENDFORM. " LIST_PROGRAMS
*& Form DOWNLOAD_TEXTPOOL
FORM DOWNLOAD_TEXTPOOL USING NAME.
W_TEXT = 'Textpool...'.
W_TEXT+15(8) = NAME.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
TEXT = W_TEXT
EXCEPTIONS
OTHERS = 1.
MOVE DOWNDIR TO W_FILENAME(80).
MOVE TRTAB-NAME TO W_FILENAME+20(8).
MOVE '.tpl' TO W_FILENAME+28(4).
CONDENSE W_FILENAME NO-GAPS.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = W_FILENAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = TEXTTAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
ENDFORM. " DOWNLOAD_TEXTPOOL
TOP-OF-PAGE.
IF HEADING = 'X'.
Place your heading here:
call function 'Z_WRITE_HEADER_FOOTER'
exporting
type = 'H'
exceptions
others = 1.
skip 1.
ENDIF.
Regards
Nilesh -
How do I save a pdf as an html file without losing formatting?
How do I save a pdf as an html file without losing formatting? My coworker is able to do this on her Adobe 9 by saving to html css 4.0 - I have Adobe 11 and have not been able to save as an html at all without loosing formatting.
Are the PDF files that you are attempting to Save As HTML tagged?
-
How to send the ALV report output by automated email.
Hi All,
Can any one advice how to send ALV report output by automated email.
Thanks in advance.
Vikram.
Edited by: vikram mallavaram. on Oct 13, 2011 3:26 PM
Moderator message: FAQ, please search for previous discussions of this topic.
Edited by: Thomas Zloch on Oct 13, 2011 3:27 PMHi Ramya,
Check the links below :
http://wiki.sdn.sap.com/wiki/display/Snippets/Sending+Mail
http://wiki.sdn.sap.com/wiki/display/Snippets/AbapEMAILProgram
http://wiki.sdn.sap.com/wiki/display/ABAP/SendMessagetoExternalemailidandSAPUseridvia+ABAP
They will explain you to send an email.
Regards,
Kittu -
How to port a ABAP report into ITS? Please help!
Hi Experts,
I have a ABAP report that contains a selection screen with 3 select-option elements and a search button. On pressing search button an ALV grid opens with data from a SAP table based on selection screen criteria.
I want to web enable it so that it can be accessed from Enterprise Portal. i will be using IAC iview in Portal.
Now the IAC iview needs my ABAP report to be ported to ITS?
1.How to port it to ITS? What are the steps?
2.In order to port in to ITS do I need to change my ABAP code?
3.Are there any known limitations of porting ABAP reports in ITS? For example Performance, ALV not supported, Table control not supported etc.
4. Does it handle dynamic programming?
5. Are there any documentation for porting report to ITS?
6. How much time effort it will be for porting ABAP reportys to ITS?
To add some more points. SAP transaction iview is not allowed in my organization. Webdynpro/BSP is also not supported. Thats why I am using IAC iview which needs ITS.
Please help
Thanks
Gopal
Message was edited by: gopalkrishna baligahi,
step1.create a transaction for ABAPreport in SE93.
step2.Go to transaction SICF and create a service in the following path sap/bc/gui/sap/its.
Check the following Url to create a service.
/people/durairaj.athavanraja/blog/2005/08/21/running-your-first-its-webgui-application-in-sap-netweaver-04-abap-edition--nsp
step3. create a system object setting the following property categories.
1.Connector
2.Usermanagement
3.ITS
4.WAS
In the usermanagement do the user mapping.
step4. While creating an IAC iview, in the third step for the <b>Internet Application Component (IAC)</b> property give the service name you have created in SICF.
you need not change the abap code. The only limitation while porting abap report in ITS is you cannot view the icons in the tool bar, instead you view the buttons.
ALV is supported. Functionality wise nothing will change except the appearance mainly with the icons.
Regards,
Gopi -
Hi Frds
I have created abap report ,in selection screen Project,year,period and Company code is given.Now the end user asking me to restrict the output of the report based on company code which we giving in selection screen..
For Example:
User1 150 (Company code)
User2 160 (Company code)
User3 170 (Company code)
User4 180 (Company code)
the user1 should able run only 150 company code report outputs only,if he gives company code other then 150 ,the error message should raise .Like this for all user .
The user must run only his company code related projects.
Thanks
By
Parihi,
how do you identify different users,
if you can identify the users..
you can sort and group the table by company code.
Then based on the condition you can pass the data to the alv
Any way fieldcatalog is same for all the structure.
It is just the structure you pass is the different.
So group the table.
Append the data of that particular company code to different and merge that with field catalog..
This is a rough solution what i have in mind.
Hope this might help you..
Thank you. -
How to Call general ABAP Report in WDA?
Hi All,
Is it possible to run our general ABAP report in our WDA.
If yes how can i move....
Thanks & regards,
RaviDavid Pietroniro wrote:
> Hello,
>
> You can call your report using the SUBMIT command to call it like a job. Follow an example on how to do this (from ABAP Help).
> But this is only usefull if this report only process data and don't show data on screen, because this data can´t be showed in the web dynpro via write commands like described in the threads before.
>
> Regards.
Actually with a few changes you are close to a solution here. There is way to get the output of the report and convert it to HTML. You will need to have a little wrapper application around your report. You will have to run this wrapper as a background job or via RFC (pointing to destination NONE). Here is a sample:
* SELECTION SCREEN LAYOUT *
selection-screen begin of block two with frame title text-002.
parameter: prog like sy-repid.
parameter: vari1 like raldb-variant.
selection-screen end of block two.
.....Other Processing....
submit (prog) and return
exporting list to memory
using selection-set vari1.
call function 'LIST_FROM_MEMORY'
tables
listobject = itab
exceptions
not_found = 1.
if sy-subrc ne 0.
leave program.
endif.
call function 'WWW_HTML_FROM_LISTOBJECT'
exporting
* REPORT_NAME =
template_name = 'WEBREPORTING_REPORT'
tables
html = html_tab
listobject = itab.
Once the data is converted into HTML it is more usable from WD. You can't really display it directly within WD, but you could push it out as a file attachment from WD using cl_wd_runtime_services=>attach_file_to_response.
This is a lot of work and I still think it might be easier to fire a linkToURL or Exit Plug and navigate to the ITS/WebGUI.
Maybe you are looking for
-
Looking for a list of Video Transitions(not effects)
Hello, I'd really like to find a list of Transitions similar to this list so that I can print and study it. Make note, etc. There doesn't seem to be an equivalent. While this one implies that it deals with Transitions it really only has the transitio
-
Why call me when i am 9 days late on my monthly payment
i dont understand why vwerizon calls me 4 times a day when i am a couple of days late on my monthly bill considering i am paid a month in advance to start with have been a customer for almost 10 years and have maintained my account not thousands behi
-
Can't change country for account
I recently moved from the UK, and though my cards are still attached to banks in there, they now have billing addresses in the US. So, I've dutifully gone off to my iTunes account to change the address details to my US billing address -- but it doesn
-
Hi CRM Gurus, I am working on SAP CRM 2007 where IPC is an inbuilt component which has to be activated at the of installation. Now my problem is in CRM 2007 where we have to write the routines ? Thnaks in Advance, Regards, Ramji Gupta
-
Hi , Can someone please throw some light on how we can add a new parameter in HTTP header for a WSDL call. I will be using a Web-service adapter to invoke a wsdl and the requirement is to pass a HTTP Header parameter with each call, this parameter wo