Extention of columns more than 255 in list display
hi,
i got a requirement that in a list we can print 250 columns,our requirement is in list to print more than 250 columns ,other than using grid.if any body know this answer pls let me know.its urgent
points r awarded to right answers.
thanks in advance.
kartheek
Hi,
You can check notes 186603 to display report with more than 255 charecters.
you will get the detailed notes. In the Attachments you have the Z program code.
After creation of the new format, run the job with the new format ie. attach the new format to your printer, and run the job. Now take the spool number and put it as a parameters to the Z program.
Hope it work fine.
Rewards points if useful
Regards,
Sonika Ahuja
Similar Messages
-
Spool request with more than 255 columns
Hi,
Please let me know what formatting type has to be used to have spool output with more than 255 lines.
X_24_80_JP L ANY 00024 00080 ABAP list HR Japan: At least 24 rows by 80 columns
X_44_120 L ANY 00044 00120 ABAP/4 list: At least 44 rows by 120 columns
X_51_140_JP L ANY 00051 00140 ABAP list HR Japan: At least 51 rows by 140 columns
X_58_170 L ANY 00058 00170 ABAP/4 list: At least 58 rows by 170 columns
X_60_80_JP L ANY 00060 00080 ABAP list HR Japan: At least 60 rows by 80 columns
X_65_1024/4 L ANY 00065 01024 ABAP List: At Least 65 Lines 4*256=1024 Columns Four-Sided (Only for SAPlpd)
X_65_132 L ANY 00065 00132 ABAP list: At least 65 rows by 132 columns
X_65_132-2 L ANY 00065 00132 ABAP List: 2-column 65 characters 132 columns (only for SAPLPD from 4.15)
X_65_200 L ANY 00065 00200 ABAP list: at least 65 lines with 200 columns (not for all device types)
X_65_255 L ANY 00065 00255 ABAP/4 list: At least 65 rows with a maximum number of columns
X_65_256/2 L ANY 00065 00256 ABAP list: At least 65 lines 2*128=256 double columns (SAPLPD only)
X_65_512/2 L ANY 00065 00512 ABAP List: At least 65 Lines 2*256=512 Columns 2-sided (Only for SAPlpd)
X_65_80 L ANY 00065 00080 ABAP/4 list: At least 65 rows by 80 columns
X_65_80-2 L ANY 00065 00080 ABAP List: 2-column 65 characters 80 columns (only for SAPLPD from 4.15)
X_65_80-4 L ANY 00065 00080 ABAP List: 4-column 65 characters 80 columns (only for SAPLPD from 4.15)
X_90_120 L ANY 00090 00120 ABAP list: At least 90 rows by 120 columns
X_PAPER L ANY 00010 00010 ABAP/4 list: Default list formatting
X_PAPER_NT L ANY 00001 00001 ABAP/4 list: Obsolete (do not use)
X_POSTSCRIPT L ANY 00001 00001 Pre-prepared PostScript
X_SPOOLERR L ANY 00001 00001 ABAP list: Spooler problem report
X_TELEX L TELEX 00001 00001 Telex: 69 characters wide, only as many lines as supported by TTU
ZABC_SAP L ANY 00065 00550 LCM Report Page Type
I have created a custom Format Type with 65*550 (ZABC_SAP) , but still the output gets truncated in the spool.
In sp01 . For the spool request ... If it displayed in Graphical layoout ... Output is getting truncated but when we see in Raw format .. i can see the entire output. But it is not at all formatted.
Thanks,
Tanuj
Message was edited by:
Tanuj Kumar BolisettyHello Tanuj,
You need to use a page format greater than 255 columns for sure. However still if it does not solve the issue then you may consider using the note 186603.
PS: I guess you are on a higher release than 4.6 C . For this release this note íIt has a text attachment for a report tat allows to display such spool requests.
Regards.
Ruchit. -
Excel 2007 to Sql server table. Column with more than 255 characters.
Hi there,
I am facing a problem while converting data from Excel 2007 to SQL server 2005 table. I am using BIDS 2005.I have an excel file where one particular column has more than 255 characters. I use OLEDB connection for excel file as there is no driver for Excel
2007 in BIDS2005. I am using Microsoft Office 12.0 Access Database Engine OLE DB Provider for Excel file.
Next, I changed advanced properties for the column to DT_NTEXT. But when I am getting errors on execution. They are:
[OLE DB Source [1949]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21.
[OLE DB Source [1949]] Error: Failed to retrieve long data for column "action".
[OLE DB Source [1949]] Error: There was an error with output column "action" (2046) on output "OLE DB Source Output" (1959). The column status returned was: "DBSTATUS_UNAVAILABLE".
[OLE DB Source [1949]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "output column "action" (2046)" failed because error code 0xC0209071 occurred, and the error row disposition on "output column "action"
(2046)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
Please advise on how can I deal with columns having more than 255 characters in Excel file.
Thanks!Here is what your connection string should look like for excel source
Provider
=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\temp\test.xls;Extended
Properties="EXCEL 8.0;HDR=YES";
http://sqlworkday.blogspot.com/ -
Is there a way to open CSV files with more than 255 columns?
I have a CSV file with more than 255 columns of data. It's a fairly standard export of social media data that shows volume of posts by day for the past year, from which I can analyze the data and publish customized charts. Very easy in Excel but I'm hitting the Numbers limit of 255 columns per table. Is there a way to work around the limitation? Perhaps splitting the CSV in two? The data shows up in the CSV file when I open via TextEdit, so it's there. Just can't access it in Numbers. And it's not very usable/useful for me in TextEdit.
Regards,
TimYou might be better off with Excel. Even if you could find a way to easily split the CSV file into two tables, it would be two tables when you want only one. You said you want to make charts from this data. While a series on a chart can be constructed from data in two different tables, to do so takes a few extra steps for each series on the chart.
For a test to see if you want to proceed, make two small tables with data spanning the tables and make a chart from that data. Make the chart the normal way using the data in the first table then repeat the following steps for each series
Select the series in the chart
Go to Format sidebar
Click in the "Value" box
Add a comma then select the data for this series from the second chart
Press Return
If there is an easier way to do this, maybe someone else will chime in with that info. -
Attachment with more than 255 columns
Hi together,
i want to send a mail in background with an attachment with more than 255 columns through the function module SO_DOCUMENT_SEND_API1 . The required content-structure of this function module have 255 columns......
I try it also with the function module SO_DOCUMENT_REPOSITORY_MANAGER with the method 'SEND'
but i can't suppress the popup of this function module.
Have anybody an solution for me ?
br
Markus
Edited by: Markus Garyant on Aug 21, 2008 3:39 PMAttachement table has a strucutre SOLISTI1 which can contain only 255 characters BUT you can use the CL_ABAP_CHAR_UTILITIES=>CR_LF for the new line and CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB for the column separater.
You need to concatenate this Separters in the attachment table.
Check out this example:
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
Regards,
Naimesh Patel -
Row chaining in table with more than 255 columns
Hi,
I have a table with 1000 columns.
I saw the following citation: "Any table with more then 255 columns will have chained
rows (we break really wide tables up)."
If I insert a row populated with only the first 3 columns (the others are null), is a row chaining occurred?
I tried to insert a row described above and no row chaining occurred.
As I understand, a row chaining occurs in a table with 1000 columns only when the populated data increases
the block size OR when more than 255 columns are populated. Am I right?
Thanks
dyahavuser10952094 wrote:
Hi,
I have a table with 1000 columns.
I saw the following citation: "Any table with more then 255 columns will have chained
rows (we break really wide tables up)."
If I insert a row populated with only the first 3 columns (the others are null), is a row chaining occurred?
I tried to insert a row described above and no row chaining occurred.
As I understand, a row chaining occurs in a table with 1000 columns only when the populated data increases
the block size OR when more than 255 columns are populated. Am I right?
Thanks
dyahavYesterday, I stated this on the forum "Tables with more than 255 columns will always have chained rows." My statement needs clarification. It was based on the following:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/schema.htm#i4383
"Oracle Database can only store 255 columns in a row piece. Thus, if you insert a row into a table that has 1000 columns, then the database creates 4 row pieces, typically chained over multiple blocks."
And this paraphrase from "Practical Oracle 8i":
V$SYSSTAT will show increasing values for CONTINUED ROW FETCH as table rows are read for tables containing more than 255 columns.
Related information may also be found here:
http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c11schem.htm
"When a table has more than 255 columns, rows that have data after the 255th column are likely to be chained within the same block. This is called intra-block chaining. A chained row's pieces are chained together using the rowids of the pieces. With intra-block chaining, users receive all the data in the same block. If the row fits in the block, users do not see an effect in I/O performance, because no extra I/O operation is required to retrieve the rest of the row."
http://download.oracle.com/docs/html/B14340_01/data.htm
"For a table with several columns, the key question to consider is the (average) row length, not the number of columns. Having more than 255 columns in a table built with a smaller block size typically results in intrablock chaining.
Oracle stores multiple row pieces in the same block, but the overhead to maintain the column information is minimal as long as all row pieces fit in a single data block. If the rows don't fit in a single data block, you may consider using a larger database block size (or use multiple block sizes in the same database). "
Why not a test case?
Create a test table named T4 with 1000 columns.
With the table created, insert 1,000 rows into the table, populating the first 257 columns each with a random 3 byte string which should result in an average row length of about 771 bytes.
SPOOL C:\TESTME.TXT
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
INSERT INTO T4 (
COL1,
COL2,
COL3,
COL255,
COL256,
COL257)
SELECT
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3)
FROM
DUAL
CONNECT BY
LEVEL<=1000;
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SET AUTOTRACE TRACEONLY STATISTICS
SELECT
FROM
T4;
SET AUTOTRACE OFF
SELECT
SN.NAME,
SN.STATISTIC#,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SPOOL OFFWhat are the results of the above?
Before the insert:
NAME VALUE
table fetch continue 166
After the insert:
NAME VALUE
table fetch continue 166
After the select:
NAME STATISTIC# VALUE
table fetch continue 252 332 Another test, this time with an average row length of about 12 bytes:
DELETE FROM T4;
COMMIT;
SPOOL C:\TESTME2.TXT
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
INSERT INTO T4 (
COL1,
COL256,
COL257,
COL999)
SELECT
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3)
FROM
DUAL
CONNECT BY
LEVEL<=100000;
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SET AUTOTRACE TRACEONLY STATISTICS
SELECT
FROM
T4;
SET AUTOTRACE OFF
SELECT
SN.NAME,
SN.STATISTIC#,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SPOOL OFFWith 100,000 rows each containing about 12 bytes, what should the 'table fetch continued row' statistic show?
Before the insert:
NAME VALUE
table fetch continue 332
After the insert:
NAME VALUE
table fetch continue 332
After the select:
NAME STATISTIC# VALUE
table fetch continue 252 33695The final test only inserts data into the first 4 columns:
DELETE FROM T4;
COMMIT;
SPOOL C:\TESTME3.TXT
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
INSERT INTO T4 (
COL1,
COL2,
COL3,
COL4)
SELECT
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3)
FROM
DUAL
CONNECT BY
LEVEL<=100000;
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SET AUTOTRACE TRACEONLY STATISTICS
SELECT
FROM
T4;
SET AUTOTRACE OFF
SELECT
SN.NAME,
SN.STATISTIC#,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SPOOL OFFWhat should the 'table fetch continued row' show?
Before the insert:
NAME VALUE
table fetch continue 33695
After the insert:
NAME VALUE
table fetch continue 33695
After the select:
NAME STATISTIC# VALUE
table fetch continue 252 33695 My statement "Tables with more than 255 columns will always have chained rows." needs to be clarified:
"Tables with more than 255 columns will always have chained rows +(row pieces)+ if a column beyond column 255 is used, but the 'table fetch continued row' statistic +may+ only increase in value if the remaining row pieces are found in a different block."
Charles Hooper
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc.
Edited by: Charles Hooper on Aug 5, 2009 9:52 AM
Paraphrase misspelled the view name "V$SYSSTAT", corrected a couple minor typos, and changed "will" to "may" in the closing paragraph as this appears to be the behavior based on the test case. -
Compressed tables with more than 255 columns
hi,
Would anyone have a sql to find out compressed tables with more than 255 columns.
Thank you
JonuSELECT table_name,
Count(column_name)
FROM user_tab_columns utc
WHERE utc.table_name IN (SELECT table_name
FROM user_tables
WHERE compression = 'ENABLED')
HAVING Count(column_name) > 255
GROUP BY table_name -
Spool output more than 255 characters
Hi ,
i am running a ALV report in background whose output is more than 255 characters . but spool is showing only 255 charcters.
Do we have any setting to change to display all characters.
Or any OSS notes that can be applied.
Thanks & regards,
Sonika AhujaHi,
You need to change the Format Type through SPAD transaction. The Format Type decides the number of rows and columns per page. By creating a new format type as per your requirement would solve the probelm.
Also, in the Report declaration, change the Line-Size to 300 or as per the width of your output.
For further details pls. refer this thread :
Re: Spool List output display > 255 char when the rpt is run in Background
Best regards,
Prashant -
More than 255 characters in background
HI,
My report width is 275 which is displaying when run in front ground. but when run in background it truncates after the 255 characters.
We have created a format using 'SPAD' of width 300, area is showing but the data is not showing after 255.
I have mention line-size 275 in report, i tried this without mentioning line-size but the result is same. it gets truncates after 255, empty area is showing after 255 if we use width 300 format...
ThanksHi,
After creation of the new format, run the job with the new format ie. attach the new format to your printer, and run the job.
Now take the spool number and put it as a parameters to the following program .
Hope it work fine.
Rewards points if useful.
Here is the code:
Display spool list > 255 columns
This is a SAP utility report to allow display of
spool request lists with more than 255 columns in
releases 4.6B and 4.6C (4.6D kernel must be used)
REPORT ZRSPOSHOWLIST LINE-SIZE 80.
PARAMETERS: RQIDENT LIKE TSP01-RQIDENT,
FIRSTL TYPE I DEFAULT 0,
LASTL TYPE I DEFAULT 0.
global data from LSPOXTOP
DATA: RC(10) TYPE C,
ERRMSG(100) TYPE C,
STATUS LIKE SY-SUBRC,
DSN_TYPE(8) TYPE C.
DATA: BEGIN OF DATA_SET_LINE,
DATA_LENGTH(5),
PRECOL(1),
DATA_LINE(1000),
DATA_LINE(5000), "MODAB
END OF DATA_SET_LINE,
DATA_SET_LENGTH(5) TYPE C.
TABLES: TSP01, TST05, TSPOPTIONS.
DATA: TEMSE_NAME LIKE TST01-DNAME,
TEMSE_CLIENT LIKE TST01-DCLIENT,
TEMSE_HANDLE LIKE RSTSTYPE-HANDLE,
TEMSE_PART LIKE TST01-DPART,
TEMSE_OBJTYP LIKE TST01-DTYPE,
TEMSE_RECTYP LIKE RSTSTYPE-RECTYP,
TEMSE_CHARCO LIKE TST01-DCHARCOD.
DATA: IS_OTF.
global data from LSPOCTOP
DATA: BEGIN OF SPOC
, escape
, prtctrl
, FIRST_BYTES(4) " collection of the first bytes of the
" escape sequences, which I am searching for.
, PRTCTRL_START_LENGTH TYPE I
, PRTCTRL_TOTAL_LENGTH TYPE I
, PRTCTRL_START(10)
, SYMBOL_LOW_START(10)
, SYMBOL_HGH_START(10)
, SYMBOL_START_LENGTH TYPE I
, ICON_START(10)
, ICON_START_LENGTH TYPE I
, ICON_SEL TYPE I VALUE 1
, FRAME_START(10)
, FRAME_START_LENGTH TYPE I
, END OF SPOC.
FIELD-SYMBOLS: TYPE C
copied from RSPO_DISPLAY_ABAP_SPOOLJOB
DATA: BUFFER LIKE DATA_SET_LINE OCCURS 1000.
TABLES: TSP02L.
SELECT SINGLE * FROM TSP01 WHERE RQIDENT = RQIDENT.
IF SY-SUBRC <> 0.
WRITE: / 'Spool request does not exist:'(001), RQIDENT.
EXIT.
ENDIF.
CALL FUNCTION 'RSPO_CHECK_JOB_PERMISSION'
EXPORTING
ACCESS = 'DISP'
SPOOLREQ = TSP01
EXCEPTIONS
NO_PERMISSION = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
WRITE: / 'No authorization to display'(002).
EXIT.
ENDIF.
PERFORM READ_DATA TABLES BUFFER
USING TSP01 FIRSTL LASTL.
IF SY-SUBRC <> 0.
WRITE: / 'Error reading spoolo request'(003).
EXIT.
ENDIF.
IF IS_OTF = 'X'.
WRITE: / 'This spool request is not an ABAP list'(004).
EXIT.
ENDIF.
PERFORM DISPLAY_DATA TABLES BUFFER USING TSP01-RQPAPER TSP01-RQIDENT.
FORM GET_SPOOL_LINE.
DO.
IF TEMSE_RECTYP+1(1) = 'Y'.
CALL 'C_RSTS_READ'
ID 'HANDLE' FIELD TEMSE_HANDLE
ID 'BUFF' FIELD DATA_SET_LINE
ID 'BUFFLG' FIELD 1006
ID 'BUFFLG' FIELD 5006 "MODAB
ID 'ALLINE' FIELD 'X'
ID 'BINARY' FIELD ' '
ID 'SHOWLG' FIELD 'X'
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
STATUS = SY-SUBRC.
ELSE.
CALL 'C_RSTS_READ'
ID 'HANDLE' FIELD TEMSE_HANDLE
ID 'BUFF' FIELD DATA_SET_LINE+1
ID 'BUFFLG' FIELD 1005
ID 'BUFFLG' FIELD 5005 "MODAB
ID 'ALLINE' FIELD 'X'
ID 'BINARY' FIELD ' '
ID 'SHOWLG' FIELD 'X'
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
STATUS = SY-SUBRC.
DATA_SET_LINE(5) = DATA_SET_LINE+1(5).
DATA_SET_LINE-PRECOL = ' '.
ADD 1 TO DATA_SET_LINE-DATA_LENGTH.
ENDIF.
STATUS = SY-SUBRC.
IF STATUS <> 6. " EOF, error condition, or got data
EXIT.
ENDIF.
end of this part, try to open next part
ADD 1 TO TEMSE_PART.
CALL 'C_RSTS_CLOSE'
ID 'HANDLE' FIELD TEMSE_HANDLE
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
STATUS = SY-SUBRC.
IF STATUS = 0.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
AUTHORITY = 'SP01'
CLIENT = TEMSE_CLIENT "hjl
NAME = TEMSE_NAME
PART = TEMSE_PART
IMPORTING
CHARCO = TEMSE_CHARCO
CREATER =
CREDATE =
DELDATE =
MAX_CREDATE =
MAX_DELDATE =
NON_UNIQ =
NOOF_PARTS =
RECTYP = TEMSE_RECTYP
SIZE =
STOTYP =
type =
OBJTYPE = TEMSE_OBJTYP
EXCEPTIONS
FB_ERROR = 1
FB_RSTS_OTHER = 2
NO_OBJECT = 3
NO_PERMISSION = 4
OTHERS = 5.
STATUS = SY-SUBRC.
ENDIF.
IF STATUS = 0.
CALL 'C_RSTS_OPEN_READ'
ID 'HANDLE' FIELD TEMSE_HANDLE
ID 'CLIENT' FIELD TEMSE_CLIENT "hjl
ID 'NAME' FIELD TEMSE_NAME
ID 'PART' FIELD TEMSE_PART
ID 'TYPE' FIELD TEMSE_OBJTYP
ID 'CONV' FIELD ' '
ID 'ALLINE' FIELD 'X'
ID 'BINARY' FIELD ' '
ID 'RECTYP' FIELD TEMSE_RECTYP
ID 'CHARCO' FIELD TEMSE_CHARCO
ID 'PROM' FIELD 'I'
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
STATUS = SY-SUBRC.
ENDIF.
ENDDO.
IF STATUS = 4.
STATUS = 12. "EOF
ENDIF.
IF STATUS = 8.
STATUS = 40. "Line too long
ENDIF.
DATA_SET_LENGTH = DATA_SET_LINE-DATA_LENGTH.
ENDFORM.
FORM READ_DATA TABLES BUFFER
USING TSP01 LIKE TSP01 VALUE(FIRST) TYPE I
VALUE(LAST) TYPE I.
DATA: LINES TYPE I.
REFRESH BUFFER.
CLEAR IS_OTF.
TEMSE_CLIENT = TSP01-RQCLIENT.
TEMSE_NAME = TSP01-RQO1NAME.
TEMSE_PART = 1.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
AUTHORITY = 'SP01'
CLIENT = TEMSE_CLIENT
NAME = TEMSE_NAME
PART = TEMSE_PART
IMPORTING
CHARCO = TEMSE_CHARCO
CREATER =
CREDATE =
DELDATE =
MAX_CREDATE =
MAX_DELDATE =
NON_UNIQ =
NOOF_PARTS =
RECTYP = TEMSE_RECTYP
SIZE =
STOTYP =
type =
OBJTYPE = TEMSE_OBJTYP
EXCEPTIONS
FB_ERROR = 1
FB_RSTS_OTHER = 2
NO_OBJECT = 3
NO_PERMISSION = 4
OTHERS = 5.
IF SY-SUBRC = 0.
IF TEMSE_OBJTYP(3) = 'OTF'.
IS_OTF = 'X'.
ENDIF.
ELSE.
EXIT.
ENDIF.
CLEAR TEMSE_HANDLE.
CALL 'C_RSTS_OPEN_READ'
ID 'HANDLE' FIELD TEMSE_HANDLE
ID 'CLIENT' FIELD TEMSE_CLIENT "hjl
ID 'NAME' FIELD TEMSE_NAME
ID 'PART' FIELD TEMSE_PART
ID 'TYPE' FIELD TEMSE_OBJTYP
ID 'CONV' FIELD ' '
ID 'ALLINE' FIELD 'X'
ID 'BINARY' FIELD ' '
ID 'RECTYP' FIELD TEMSE_RECTYP
ID 'CHARCO' FIELD TEMSE_CHARCO
ID 'PROM' FIELD 'I'
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
STATUS = SY-SUBRC.
IF STATUS = 0.
DO.
PERFORM GET_SPOOL_LINE.
IF STATUS <> 0 AND STATUS <> 40 AND STATUS <> 12.
PERFORM CLOSE_JOB.
EXIT.
ENDIF.
IF STATUS <> 12. " 12 = End
IF NOT ( DATA_SET_LENGTH IS INITIAL ).
DATA_SET_LINE-DATA_LENGTH = DATA_SET_LENGTH - 1.
ENDIF.
ADD 1 TO LINES.
IF LINES >= FIRST.
APPEND DATA_SET_LINE TO BUFFER.
ENDIF.
IF ( NOT LAST IS INITIAL ) AND ( LINES >= LAST ).
EXIT.
ENDIF.
ELSE.
IF LINES = 0.
PERFORM CLOSE_JOB.
EXIT.
ENDIF.
IF LINES < FIRST .
PERFORM CLOSE_JOB.
EXIT.
ENDIF.
EXIT.
ENDIF.
ENDDO.
PERFORM CLOSE_JOB.
ENDIF.
ENDFORM.
FORM CLOSE_JOB *
FORM CLOSE_JOB.
IF STATUS <> 0 AND STATUS <> 12.
CALL 'C_RSTS_CLOSE'
ID 'HANDLE' FIELD TEMSE_HANDLE
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
MESSAGE E112(PO) WITH STATUS RC ERRMSG RAISING READ_ERROR.
ENDIF.
CALL 'C_RSTS_CLOSE'
ID 'HANDLE' FIELD TEMSE_HANDLE
ID 'RC' FIELD RC
ID 'ERRMSG' FIELD ERRMSG.
STATUS = SY-SUBRC.
IF STATUS <> 0.
MESSAGE E112(PO) WITH STATUS RC ERRMSG RAISING READ_ERROR.
ENDIF.
ENDFORM.
FORM DISPLAY_DATA TABLES BUFFER USING RQPAPER LIKE TSP01-RQPAPER
RQID LIKE TSP01-RQIDENT.
DATA: LINE_LENGTH TYPE I, GCOL TYPE I, GLINES TYPE I,
LINE_LENGTH2 LIKE RSTSTYPE-LINELENGTH,
V, V2.
CALL FUNCTION 'RSPO_SPOOLDATA_WRITE_INIT'.
PERFORM SPOOLDATA_WRITE_INIT. "MODAB
select single * from tspoptions where spoption = 'REALWIDTH'.
if sy-subrc = 0.
V = 'X'.
endif.
select single * from tspoptions where spoption = 'REALHEIGHT'.
if sy-subrc = 0.
V2 = 'X'.
endif.
IF NOT V IS INITIAL OR NOT V2 IS INITIAL.
GCOL = 0.
GLINES = 0.
SELECT SINGLE * FROM TSP02L WHERE PJIDENT = RQID
AND PJNUMMER = 0.
IF SY-SUBRC = 0.
GCOL = TSP02L-COLUMNS.
GLINES = TSP02L-LINES.
ELSE.
CALL FUNCTION 'RSPO_GET_SIZE_OF_LAYOUT'
EXPORTING
LAYOUT = RQPAPER
IMPORTING
ANSWER =
COLUMNS = GCOL
LINES = GLINES
PFORMAT =
ENDIF.
ENDIF.
IF GCOL < 80 OR V IS INITIAL.
GCOL = 255.
ENDIF.
IF GLINES < 5 OR V2 IS INITIAL.
GLINES = 0.
ENDIF.
IF GCOL >= 1024. "MODAB
GCOL = 1023.
ENDIF.
NEW-PAGE NO-HEADING NO-TITLE LINE-SIZE GCOL
LINE-COUNT GLINES. " make a wide list
SET BLANK LINES ON.
LOOP AT BUFFER.
DATA_SET_LINE = BUFFER.
IF DATA_SET_LINE-PRECOL = 'P'.
IF DATA_SET_LINE(1) = ' '. " Echter Vorschub ?"
NEW-PAGE.
ENDIF.
CONTINUE.
ENDIF.
Zeilenlänge berechnen, falls unbekannt.
IF DATA_SET_LINE-DATA_LENGTH IS INITIAL.
LINE_LENGTH = STRLEN( DATA_SET_LINE-DATA_LINE ).
ELSE.
LINE_LENGTH = DATA_SET_LINE-DATA_LENGTH.
ENDIF.
IF LINE_LENGTH > 0.
LINE_LENGTH2 = LINE_LENGTH.
PERFORM SPOOLDATA_WRITE USING DATA_SET_LINE-DATA_LINE "MODAB
LINE_LENGTH2
1.
ELSE.
" Leerzeile
SKIP.
ENDIF.
ENDLOOP.
ENDFORM.
copied from RSPO_SPOOLDATA_WRITE
FORM SPOOLDATA_WRITE USING VALUE(SPOOL_DATA)
VALUE(DATA_LENGTH) LIKE RSTSTYPE-LINELENGTH
VALUE(START_POS) LIKE SY-COLNO.
function globals
DATA: LPOS LIKE SY-COLNO
, REST_LEN TYPE I
, AREA_LEN TYPE I
, NEXT_HOT TYPE I " offset of next special character
, COLS TYPE I " columns used by special character
, BYTES TYPE I " bytes used by special character
, HOT2
, HOT3
, HOT4
, HOT5
, HOT6
, HOT7
, BEGIN OF ESCAPE_TRICK
, X1(1) TYPE X
, END OF ESCAPE_TRICK
, THE_PRTCTRL(5) TYPE C
Because of a problem within the ABAP listprocessing, I shall
never output the same icon side by side with the same color
and without a gap.
As I don't know the data, I will use two different variables
alternatively.
, ICON_ID1 LIKE ICONS-L4
, ICON_ID2 LIKE ICONS-L4.
FIELD-SYMBOLS:
IF START_POS < 2.
write at / ' ' no-gap.
NEW-LINE.
LPOS = 1.
ELSE.
LPOS = START_POS.
ENDIF.
REST_LEN = STRLEN( SPOOL_DATA ).
DESCRIBE FIELD SPOOL_DATA LENGTH AREA_LEN.
IF DATA_LENGTH = 0.
" fine.
ELSEIF DATA_LENGTH .
MODAB
PERFORM WRITE_BIGFIELD USING
NEXT_HOT
LPOS.
WRITE AT LPOS <PLAIN_TEXT> NO-GAP.
ADD NEXT_HOT TO LPOS.
SUBTRACT NEXT_HOT FROM REST_LEN.
ASSIGN +6(1).
ELSE.
HOT7 = '?'.
ENDIF.
ELSE.
HOT6 = '?'.
ENDIF.
ELSE.
HOT5 = '?'.
ENDIF.
IF HOT5 = SPACE.
IF HOT6 = SPACE.
IF HOT7 = SPACE.
IF SPOC-ICON_SEL = 1.
WRITE AT LPOS(4) ICON_ID1 AS ICON.
write at lpos icon_id1 as icon no-gap.
ELSE.
WRITE AT LPOS(4) ICON_ID2 AS ICON.
write at lpos icon_id2 as icon no-gap.
ENDIF.
COLS = 4.
BYTES = 7.
ELSE.
IF SPOC-ICON_SEL = 1.
WRITE AT LPOS(3) ICON_ID1 AS ICON.
write at lpos icon_id1 as icon no-gap.
ELSE.
WRITE AT LPOS(3) ICON_ID2 AS ICON.
write at lpos icon_id2 as icon no-gap.
ENDIF.
COLS = 3.
BYTES = 6.
ENDIF.
ELSE.
IF SPOC-ICON_SEL = 1.
WRITE AT LPOS(2) ICON_ID1 AS ICON.
write at lpos icon_id1 as icon no-gap.
ELSE.
WRITE AT LPOS(2) ICON_ID2 AS ICON.
write at lpos icon_id2 as icon no-gap.
ENDIF.
COLS = 2.
BYTES = 5.
ENDIF.
ELSE.
"rite at lpos(1) icon_id as icon.
WRITE AT LPOS(1) '#' NO-GAP. " Not enough space for any icon.
COLS = 1.
BYTES = 4.
ENDIF.
ENDIF.
IF .
ELSE.
EXIT.
ENDIF.
ENDWHILE.
MODAB
IF REST_LEN > 0.
ASSIGN .
SPOC-FIRST_BYTES+0(1) = SPOC-PRTCTRL_START(1).
SPOC-FIRST_BYTES+1(1) = SPOC-FRAME_START(1).
SPOC-FIRST_BYTES+2(1) = SPOC-ICON_START(1).
SPOC-FIRST_BYTES+3(1) = SPOC-SYMBOL_LOW_START(1).
ENDFORM. -
hi all,
Good morning.
My requirement is to send a report as an excel attatchment to the respective managers mail box. For this I am using the function module SO_DOCUMENT_SEND_API1 as follows.
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data =
put_in_outbox =
sender_address =
sender_address_type =
commit_work =
tables
packing_list =
object_header =
contents_bin =
contents_txt =
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.
Here the problem is contents_bin is of type SOLISTI1 which takes max 255 characters, As my report columns occupies more than 400 characters, I am unable to get all the column values in excel attachement.
Can anyone please help me to get all the column values in the excel attachment.
Thanks in Advance.Hi,
Please check the following extract of a sample program I had executed.It deals with how to handle more that 255 chars in excel att in FM SO_DOCUMENT_SEND_API1
Hope this helps....
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE X VALUE '09'. "OK for non Unicode
data : Begin of wa_output ,
BUFFER(1000) TYPE C, " data to be written into xls format
End of wa_output.
data : gt_output LIKE wa_output OCCURS 0 WITH HEADER LINE.
data : FIELDNAME_OFFSET TYPE I.
Attachement contents
DATA: BEGIN OF wa_att_cont.
INCLUDE STRUCTURE solisti1.
DATA: END OF wa_att_cont.
DATA: lt_att_cont LIKE wa_att_cont OCCURS 0.
data : begin of zdfies occurs 0.
include structure dfies.
data : end of zdfies.
data : begin of it_field occurs 0,
fldname(40) type c,
end of it_field.
data : yfilname like RLGRAP-FILENAME value 'C:\Documents and
Settings\'.
data : ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
data : flag type i.
********************************Variables*****************************
DATA: lv_count TYPE i, " count
lv_forwarder LIKE soud-usrnam, " Forwarder.
lv_lines TYPE i. " no of lines
********************************Structures****************************
DATA: w_doc_data LIKE sodocchgi1,
w_sent_all(1) TYPE c,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ.
******Structure for Folder ID
DATA: BEGIN OF wa_folder_id.
INCLUDE STRUCTURE soodk.
DATA: END OF wa_folder_id.
Folder Contents, change attributes
DATA: BEGIN OF wa_object_fl_change.
INCLUDE STRUCTURE sofm1.
DATA: END OF wa_object_fl_change.
******Object definition, change attributes
DATA: BEGIN OF wa_object_hd_change.
INCLUDE STRUCTURE sood1.
DATA: END OF wa_object_hd_change.
******Object ID
DATA: BEGIN OF wa_object_id.
INCLUDE STRUCTURE soodk.
DATA: END OF wa_object_id.
******Object Defintion.
DATA: BEGIN OF wa_sood.
INCLUDE STRUCTURE sood.
DATA: END OF wa_sood.
******User Definition
DATA: BEGIN OF wa_soud.
INCLUDE STRUCTURE soud.
DATA: END OF wa_soud.
******Sent to all flag.
DATA: BEGIN OF wa_sonv.
INCLUDE STRUCTURE sonv.
DATA: END OF wa_sonv.
******Mail contents
DATA: BEGIN OF wa_objcont.
INCLUDE STRUCTURE solisti1.
DATA: END OF wa_objcont.
******Mail header.
DATA: BEGIN OF wa_objhead.
INCLUDE STRUCTURE soli.
DATA: END OF wa_objhead.
******Para A
DATA: BEGIN OF wa_objpara.
INCLUDE STRUCTURE soparai1.
DATA: END OF wa_objpara.
******Para B
DATA: BEGIN OF wa_objparb.
INCLUDE STRUCTURE soparbi1.
DATA: END OF wa_objparb.
******Receivers list
DATA: BEGIN OF wa_receivers.
INCLUDE STRUCTURE somlreci1.
DATA: END OF wa_receivers.
Pack list
DATA: BEGIN OF wa_packlist.
INCLUDE STRUCTURE sopcklsti1.
DATA: END OF wa_packlist.
DATA: BEGIN OF wa_att_head.
INCLUDE STRUCTURE soli.
DATA: END OF wa_att_head.
********************internal tables******************************
DATA: lt_objcont LIKE wa_objcont OCCURS 0, "mail contents
lt_objhead LIKE wa_objhead OCCURS 0, "mail header
lt_objpara LIKE wa_objpara OCCURS 0, "Paragraph A
lt_objparb LIKE wa_objparb OCCURS 0, "Paragraph B
lt_receivers LIKE wa_receivers OCCURS 0," receiver list
lt_packlist LIKE wa_packlist OCCURS 0,"Pack list
lt_att_head LIKE wa_att_head OCCURS 0."Attachment Header
**************************Constants***********************************
CONSTANTS: lc_kreuz LIKE sonv-flag VALUE 'X', "Outbox flag,
lc_colon(1) TYPE c VALUE ':',
lc_raw(3) TYPE c VALUE 'RAW',
lc_f(1) TYPE c VALUE 'F',
lc_u(1) TYPE c VALUE 'U'.
DATA: w_cnt TYPE i.
data : wa_edition like t_edition.
DATA : i_strlen TYPE i,
i_off TYPE i ,
i_len TYPE i VALUE 254,
i_totlen TYPE i,
lv_fill_space TYPE i,
lv_split_times TYPE i,
lv_len TYPE i.
**>> Populate the attachment contents.*
LOOP AT gt_output INTO wa_output.
i_strlen = strlen( wa_output ) .
IF i_strlen LE 254.
CONCATENATE con_cret wa_output-buffer
INTO wa_output-buffer.
APPEND wa_output-buffer TO lt_att_cont.
ELSE. " i.e the data is more than 255 characters
DO 4 TIMES.
i_totlen = i_off + i_len .
IF i_totlen = 254.
wa_att_cont = wa_output+i_off(i_len).
CONCATENATE con_cret wa_att_cont
INTO wa_att_cont.
APPEND wa_att_cont TO lt_att_cont.
ELSE.
wa_att_cont = wa_output+i_off(i_len). "splitting more than 255
APPEND wa_att_cont TO lt_att_cont.
ENDIF.
IF i_totlen GE i_strlen.
CLEAR : i_off .
EXIT.
ELSE.
i_off = i_off + 254.
ENDIF.
ENDDO.
ENDIF.
CLEAR : wa_output.
ENDLOOP. -
ALV Cell with more than 255 characters.
Hello Guru's,
I need to display a longtext in ALV with other details. I am using READ_TEXT to get the Longtext and appending it to Internal table field, which i have defined as a string. I have debugged the code and it is containing around 450 characters. But, when i am trying to display using "REUSE_ALV_GRID_DISPLAY" it is only displaying 255 characters.
Please suggest a solution.
Thanks,
Sudhir.Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.
In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.
The report output can contain up to 90 columns in the display with the wide array of display options.
The commonly used ALV functions used for this purpose are;
1. REUSE_ALV_VARIANT_DEFAULT_GET
2. REUSE_ALV_VARIANT_F4
3. REUSE_ALV_VARIANT_EXISTENCE
4. REUSE_ALV_EVENTS_GET
5. REUSE_ALV_COMMENTARY_WRITE
6. REUSE_ALV_FIELDCATALOG_MERGE
7. REUSE_ALV_LIST_DISPLAY
8. REUSE_ALV_GRID_DISPLAY
9. REUSE_ALV_POPUP_TO_SELECT -
Upload Excel file to itab with more than 255 chars
I want to upload an excel file to internal table with more than 255 characters in one of the field. However it restricts the upload to only 255 characters. Currently I am using the code
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = wa_tab_raw_data
i_filename = p_file
TABLES
i_tab_converted_data = <fs_table>
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
where <Fs_table> is a dynamic structure in which one column is defined as string. We cannot use FM ALSM_EXCEL_TO_INTERNAL_TABLE as it has a restriction of only 50 characters and I dont want to create a Zstruture in the system.It wont work for excel file type.However, with FM Gui_Upload and use a text tab-delimited file we can upload long text.
Here is the code.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_files
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = <fs_table>
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. -
More than 255 bytes in SO_NEW_DOCUMENT_ATT_SEND_API1
I know they are some posts about this topic already but I have read them all but I still don't have the solution. I hope someone could help me with this:
The problem is this: I have an internal table and I make an excell file of it which is mailed (sapmail) to the user who started the program. I all works fine except for the problem of the 255 limit. This happens because SOLISTI1 has an 255 limit. The excell attachment is mailed but it breaks after 255 characters (the total characters is about 500).
I know there are some solutions with TABLE_COMPRESS and TABLE_DECOMPRESS but I don't know on which moment you should compress or decompress which table! Below if my coding hope someone can help:
REPORT ZDTAFNAME_K.
tables: marc,
lips,
vbrp,
mara,
kna1,
vbak,
VBKD,
vbrk,
vbap,
vbep,
mvke,
mbew.
selection-screen: begin of block select with frame title text-f70.
select-options art for marc-matnr.
select-options abc for marc-abcin.
select-options fak for vbrp-vbeln default '20406070'.
Select-options dat for vbrp-erdat.
selection-screen: end of block select.
PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '31dtg'.
data: rule(2) value '.,'.
data: begin of itab occurs 0,
deb like vbak-kunnr, "Debiteurennummer
debnaam like kna1-name1, "Naam debiteur
bestnr like vbkd-bstkd, "Bestelnr klant
artnr like marc-matnr, "Artikelnr
oms like lips-arktx, "Omschrijving
type like mara-groes, "Type
fab like lips-matkl, "Fabrikaat
faktuurdat like vbrp-erdat, "Faktuurdatum
faksrt like vbrk-fkart, "Faktuursoort
faktuur like vbrp-vbeln, "Faktuurnr
fakpos like vbrp-posnr, "Faktuurpositie
fakaantal(11) type c , "Faktuuraantal
fakeenh like vbrp-meins, "Faktuureenheid
fakwaarde(11) type c , "Faktuurwaarde
orddat like vbap-erdat, "Orderdatum
ordsrt like vbak-auart, "Ordersoort
verkoper like vbak-ernam, "Verkoper
ordnr like lips-vgbel, "Ordernr
ordnrpos like lips-vgpos, "Order positie
artklant like vbap-kdmat, "Artikelnr klant
ordaant(11) type c, "Order aantal
ordeenh like vbap-meins, "Order eenheid
ordwaarde(11) type c, "Nettowaarde orderpositie
postype like vbap-pstyv, "Positietype
gevlevdat like vbep-edatu, "Gevraagde leverdatum
levdat like lips-erdat, "Werkelijke leverdatum
levnr like lips-vbeln, "Leveringsnr
levpos like lips-posnr, "Levering positie
levaant(11) type c, "Leveringsaantal
leveenh like lips-meins, "Leveringseenheid
min(11) type c, "Bestelpunt
max(11) type c, "Max vrd
basiseenh like mara-meins, "Basiseenheid
abc like marc-abcin, "ABC Classificatie
artsoort like mara-mtart, "Artikelsoort
vkstatus(2) type c, "Verkoopstatus
ikstatus(2) type c, "Inkoopstatus
minlev(11) type c, "Min levereenheid
afrd(11) type c, "Afrondingswaarde
vprs(11) type c, "VPRS
vprseenh(11) type c, "VPRS eenheid
end of itab.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
select * from vbrk client specified where
mandt = sy-mandt and
vbeln in fak and
erdat in dat and
fkart = 'F2'.
select * from vbrp client specified where
mandt = sy-mandt and
vbeln = vbrk-vbeln and
erdat in dat and
matnr in art.
select single * from marc client specified where
mandt = sy-mandt and
werks = 610 and
matnr = vbrp-matnr and
abcin in abc.
if sy-subrc = 0.
itab-levnr = vbrp-vgbel.
itab-levpos = vbrp-vgpos.
itab-faksrt = vbrk-fkart.
select single * from mara client specified where
mandt = sy-mandt and
matnr = marc-matnr.
if sy-subrc = 0.
itab-type = mara-groes.
itab-basiseenh = mara-meins.
endif.
select single * from mvke client specified where
mandt = sy-mandt and
matnr = marc-matnr.
if sy-subrc = 0.
itab-vkstatus = mvke-vmsta.
itab-minlev = mvke-scmng.
endif.
select single * from mbew client specified where
mandt = sy-mandt and
matnr = marc-matnr and
bwkey = 610.
if sy-subrc = 0.
itab-vprs = mbew-verpr.
itab-vprseenh = mbew-peinh.
endif.
select single * from vbak client specified where
mandt = sy-mandt and
vbeln = vbrp-aubel.
if sy-subrc = 0.
itab-deb = vbak-kunnr.
itab-ordsrt = vbak-auart.
endif.
select single * from vbap client specified where
mandt = sy-mandt and
vbeln = vbrp-aubel and
posnr = vbrp-aupos.
if sy-subrc = 0.
itab-verkoper = vbap-ernam.
itab-orddat = vbap-erdat.
itab-artklant = vbap-kdmat.
itab-ordaant := vbap-kwmeng.
itab-ordeenh = vbap-meins.
itab-ordwaarde := vbap-netwr.
itab-postype = vbap-pstyv.
endif.
select single * from vbep client specified where
mandt = sy-mandt and
vbeln = vbap-vbeln and
posnr = vbap-posnr and
etenr = '0001'.
if sy-subrc = 0.
itab-gevlevdat = vbep-edatu.
endif.
select single * from vbkd client specified where
mandt = sy-mandt and
vbeln = vbak-vbeln.
if sy-subrc = 0.
itab-bestnr = vbkd-bstkd.
endif.
select single * from lips client specified where
mandt = sy-mandt and
vbeln = vbrp-vgbel and
posnr = vbrp-vgpos.
if sy-subrc = 0.
itab-levdat = lips-erdat.
itab-levaant = lips-lfimg.
itab-leveenh = lips-meins.
else.
clear itab-levnr.
clear itab-levpos.
clear itab-levaant.
clear itab-levdat.
endif.
select single * from kna1 client specified where
mandt = sy-mandt and
kunnr = vbak-kunnr.
if sy-subrc = 0.
itab-debnaam = kna1-name1.
endif.
itab-artnr = marc-matnr.
itab-oms = vbrp-arktx.
itab-fab = vbrp-matkl.
itab-abc = marc-abcin.
itab-artsoort = mara-mtart.
itab-min = marc-minbe.
itab-max = marc-mabst.
itab-afrd = marc-bstrf.
itab-ikstatus = marc-mmsta.
itab-faktuur = vbrp-vbeln.
itab-fakpos = vbrp-posnr.
*UNPACK VBRP-FKIMG TO ITAB-FAKAANTAL.
*shift itab-fakaantal right by 3 places.
itab-fakaantal = vbrp-fkimg.
translate itab-fakaantal using rule.
itab-fakeenh = vbrp-meins.
itab-faktuurdat = vbrp-erdat.
*UNPACK VBRP-NETWR TO ITAB-FAKWAARDE.
*shift itab-FAKWAARDE right by 2 places.
itab-FAKWAARDE = vbrp-netwr.
Translate van velden
translate itab-fakwaarde using rule.
translate itab-fakaantal using rule.
translate itab-ordaant using rule.
translate itab-ordwaarde using rule.
translate itab-min using rule.
translate itab-max using rule.
translate itab-vkstatus using rule.
translate itab-ikstatus using rule.
itab-ordnr = vbrp-aubel.
itab-ordnrpos = vbrp-aupos.
append itab.
endif.
endselect. " Select * from vbrp.
endselect.
endform.
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'DEBNR' 'NAAM' 'BESTELNR'
'ARTNR' 'OMSCHRIJVING' 'TYPE'
'FABRIKAAT' 'FAKTUURDATUM' 'FAKSRT'
'FAKTUURNR' 'FAK.POS.' 'FAK.AANTAL'
'FAK.EENH' 'FAKTUUR WAARDE' 'ORDER DATUM'
'ORDSRT' 'VERKOPER' 'ORDERNR.' 'ORDER.POS.'
'ARTNR KLANT' 'ORDER AANTAL' 'ORDER EENH'
'ORDERWAARDE' 'POS.TYPE' 'GEVRAAGDE LEVDAT'
'WERKELIJKE LEVDAT' 'LEVERINGSNR' 'LEV.POS'
'LEV.AANTAL' 'LEV.EENH' 'BESTELPUNT'
'MAX VRD' 'BASISEENH' 'ABC' 'ARTSRT.'
'VK.STATUS' 'IK.STATUS' 'MIN.LEVEENH.'
'AFDRONDINGSWAARDE' 'VPRS' 'PER'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT ITAB.
CONCATENATE itab-deb itab-debnaam itab-bestnr itab-artnr
itab-oms itab-type itab-fab itab-faktuurdat
itab-faksrt itab-faktuur itab-fakpos
itab-fakaantal itab-fakeenh itab-fakwaarde
itab-orddat itab-ordsrt itab-verkoper itab-ordnr
itab-ordnrpos itab-artklant itab-ordaant
itab-ordeenh itab-ordwaarde itab-postype
itab-gevlevdat itab-levdat itab-levnr itab-levpos
itab-levaant itab-leveenh itab-min itab-max
itab-basiseenh itab-abc itab-artsoort itab-vkstatus
itab-ikstatus itab-minlev itab-afrd itab-vprs
itab-vprseenh
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
MOVE: SY-UNAME TO t_RECEIVERs-RECEIVER,
'X' TO t_RECEIVERs-EXPRESS,
'B' TO t_RECEIVERs-REC_TYPE.
APPEND t_RECEIVERs.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODYThanks Kunal Ghosh for your replies. I did try to condense it but it was still more than 255 characters.
I solved it by using chunks! I spend more than a week to solve this problem! The solution is so simple. Here's the new code for everybody who has the same problem:
REPORT ZDTAFNAME_K_ART no standard page heading line-size 250.
tables: marc,
lips,
vbrp,
mara,
kna1,
vbak,
VBKD,
vbrk,
vbap,
vbep,
mvke,
mbew.
selection-screen: begin of block select with frame title text-f70.
select-options art for marc-matnr.
select-options abc for marc-abcin.
select-options fak for vbrp-vbeln.
Select-options dat for vbrp-erdat.
select-options fsoort for vbrk-fkart.
select-options vest for marc-werks.
selection-screen: end of block select.
*parameters: p_email type somlreci1-receiver
DEFAULT '31dtg'.
data: p_email like somlreci1-receiver.
data: rule(2) value '.,'.
data: begin of itab occurs 0,
deb like vbak-kunnr, "Debiteurennummer
debnaam like kna1-name1, "Naam debiteur
bestnr like vbkd-bstkd, "Bestelnr klant
artnr like marc-matnr, "Artikelnr
oms like lips-arktx, "Omschrijving
type like mara-groes, "Type
fab like lips-matkl, "Fabrikaat
faktuurdat like vbrp-erdat, "Faktuurdatum
faksrt like vbrk-fkart, "Faktuursoort
faktuur like vbrp-vbeln, "Faktuurnr
fakpos like vbrp-posnr, "Faktuurpositie
fakaantal(11) type c , "Faktuuraantal
fakeenh like vbrp-meins, "Faktuureenheid
fakwaarde(11) type c , "Faktuurwaarde
orddat like vbap-erdat, "Orderdatum
ordsrt like vbak-auart, "Ordersoort
verkoper like vbak-ernam, "Verkoper
ordnr like lips-vgbel, "Ordernr
ordnrpos like lips-vgpos, "Order positie
artklant like vbap-kdmat, "Artikelnr klant
ordaant(11) type c, "Order aantal
ordeenh like vbap-meins, "Order eenheid
ordwaarde(11) type c, "Nettowaarde orderpositie
postype like vbap-pstyv, "Positietype
gevlevdat like vbep-edatu, "Gevraagde leverdatum
levdat like lips-erdat, "Werkelijke leverdatum
levnr like lips-vbeln, "Leveringsnr
levpos like lips-posnr, "Levering positie
levaant(11) type c, "Leveringsaantal
leveenh like lips-meins, "Leveringseenheid
min(11) type c, "Bestelpunt
max(11) type c, "Max vrd
basiseenh like mara-meins, "Basiseenheid
abc like marc-abcin, "ABC Classificatie
artsoort like mara-mtart, "Artikelsoort
vkstatus(2) type c, "Verkoopstatus
ikstatus(2) type c, "Inkoopstatus
minlev(11) type c, "Min levereenheid
afrd(11) type c, "Afrondingswaarde
vprs(11) type c, "VPRS
vprseenh(11) type c, "VPRS eenheid
end of itab.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Xls bestand afname per artikelsoort'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
select * from vbrk client specified where
mandt = sy-mandt and
vbeln in fak and
erdat in dat and
fkart in fsoort.
select * from vbrp client specified where
mandt = sy-mandt and
vbeln = vbrk-vbeln and
matnr in art.
select single * from marc client specified where
mandt = sy-mandt and
werks in vest and
matnr = vbrp-matnr and
abcin in abc.
if sy-subrc = 0.
itab-levnr = vbrp-vgbel.
itab-levpos = vbrp-vgpos.
itab-faksrt = vbrk-fkart.
select single * from mara client specified where
mandt = sy-mandt and
matnr = marc-matnr.
if sy-subrc = 0.
itab-type = mara-groes.
itab-basiseenh = mara-meins.
endif.
select single * from mvke client specified where
mandt = sy-mandt and
matnr = marc-matnr.
if sy-subrc = 0.
itab-vkstatus = mvke-vmsta.
itab-minlev = mvke-scmng.
endif.
select single * from mbew client specified where
mandt = sy-mandt and
matnr = marc-matnr and
bwkey = 610.
if sy-subrc = 0.
itab-vprs = mbew-verpr.
itab-vprseenh = mbew-peinh.
endif.
select single * from vbak client specified where
mandt = sy-mandt and
vbeln = vbrp-aubel.
if sy-subrc = 0.
itab-deb = vbak-kunnr.
itab-ordsrt = vbak-auart.
endif.
select single * from vbap client specified where
mandt = sy-mandt and
vbeln = vbrp-aubel and
posnr = vbrp-aupos.
if sy-subrc = 0.
itab-verkoper = vbap-ernam.
itab-orddat = vbap-erdat.
itab-artklant = vbap-kdmat.
itab-ordaant := vbap-kwmeng.
itab-ordeenh = vbap-meins.
itab-ordwaarde := vbap-netwr.
itab-postype = vbap-pstyv.
endif.
select single * from vbep client specified where
mandt = sy-mandt and
vbeln = vbap-vbeln and
posnr = vbap-posnr and
etenr = '0001'.
if sy-subrc = 0.
itab-gevlevdat = vbep-edatu.
endif.
select single * from vbkd client specified where
mandt = sy-mandt and
vbeln = vbak-vbeln.
if sy-subrc = 0.
itab-bestnr = vbkd-bstkd.
endif.
select single * from lips client specified where
mandt = sy-mandt and
vbeln = vbrp-vgbel and
posnr = vbrp-vgpos.
if sy-subrc = 0.
itab-levdat = lips-erdat.
itab-levaant = lips-lfimg.
itab-leveenh = lips-meins.
else.
clear itab-levnr.
clear itab-levpos.
clear itab-levaant.
clear itab-levdat.
endif.
select single * from kna1 client specified where
mandt = sy-mandt and
kunnr = vbak-kunnr.
if sy-subrc = 0.
itab-debnaam = kna1-name1.
endif.
itab-artnr = marc-matnr.
itab-oms = vbrp-arktx.
itab-fab = vbrp-matkl.
itab-abc = marc-abcin.
itab-artsoort = mara-mtart.
itab-min = marc-minbe.
itab-max = marc-mabst.
itab-afrd = marc-bstrf.
itab-ikstatus = marc-mmsta.
itab-faktuur = vbrp-vbeln.
itab-fakpos = vbrp-posnr.
*UNPACK VBRP-FKIMG TO ITAB-FAKAANTAL.
*shift itab-fakaantal right by 3 places.
itab-fakaantal = vbrp-fkimg.
translate itab-fakaantal using rule.
itab-fakeenh = vbrp-meins.
itab-faktuurdat = vbrp-erdat.
*UNPACK VBRP-NETWR TO ITAB-FAKWAARDE.
*shift itab-FAKWAARDE right by 2 places.
itab-FAKWAARDE = vbrp-netwr.
Translate van velden
translate itab-fakwaarde using rule.
translate itab-fakaantal using rule.
translate itab-ordaant using rule.
translate itab-ordwaarde using rule.
translate itab-min using rule.
translate itab-max using rule.
translate itab-vkstatus using rule.
translate itab-ikstatus using rule.
translate itab-VPRS using rule.
translate itab-vprseenh using rule.
translate itab-levaant using rule.
translate itab-minlev using rule.
translate itab-afrd using rule.
itab-ordnr = vbrp-aubel.
itab-ordnrpos = vbrp-aupos.
append itab.
clear itab.
endif.
endselect. " Select * from vbrp.
endselect. " Select * from vbrk.
endform.
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
<b>
CONCATENATE 'DEBNR' 'NAAM' 'BESTELNR'
'ARTNR' 'OMSCHRIJVING' 'TYPE'
'FABRIKAAT' 'FAKTUURDATUM' 'FAKSRT'
'FAKTUURNR' 'FAK.POS.' 'FAK.AANTAL'
'FAK.EENH' 'FAKTUUR WAARDE' 'ORDER DATUM'
'ORDSRT' 'VERKOPER' 'ORDERNR.' 'ORDER.POS.'
'ARTNR KLANT' 'ORDER AANTAL'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
CONCATENATE con_tab 'ORDER EENH' 'ORDERWAARDE'
'POS.TYPE' 'GEVRAAGDE LEVDAT'
'WERKELIJKE LEVDAT' 'LEVERINGSNR' 'LEV.POS'
'LEV.AANTAL' 'LEV.EENH' 'BESTELPUNT'
'MAX VRD' 'BASISEENH' 'ABC' 'ARTSRT.'
'VK.STATUS' 'IK.STATUS' 'MIN.LEVEENH.'
'AFDRONDINGSWAARDE' 'VPRS' 'PER'
INTO it_attach SEPARATED BY con_tab.
APPEND it_attach.
LOOP AT ITAB.
CONCATENATE itab-deb itab-debnaam itab-bestnr itab-artnr
itab-oms itab-type itab-fab itab-faktuurdat
itab-faksrt itab-faktuur itab-fakpos
itab-fakaantal itab-fakeenh itab-fakwaarde
itab-orddat itab-ordsrt itab-verkoper itab-ordnr
itab-ordnrpos itab-artklant itab-ordaant
INTO it_attach SEPARATED BY con_tab.
CONCATENATE Con_cret it_attach INTO it_attach.
APPEND it_attach.
CONCATENATE con_tab itab-ordeenh itab-ordwaarde itab-postype
itab-gevlevdat itab-levdat itab-levnr itab-levpos
itab-levaant itab-leveenh itab-min itab-max
itab-basiseenh itab-abc itab-artsoort itab-vkstatus
itab-ikstatus itab-minlev itab-afrd itab-vprs
itab-vprseenh
INTO it_attach SEPARATED BY con_tab.
APPEND it_attach.
ENDLOOP.</b>
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
MOVE: SY-UNAME TO t_RECEIVERs-RECEIVER,
'X' TO t_RECEIVERs-EXPRESS,
'B' TO t_RECEIVERs-REC_TYPE.
APPEND t_RECEIVERs.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Deze mail is automatisch gemaakt door transactie ZAKA'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY -
How to display more than 255 chars in background job with ALV Grid ????
Hi All,
I am using ALV grid with OO.
I have used call screen for ALV grid display. I have to display more than 255 characters in width. While running it, I can see the list perfectly.
But in background mode, the list is truncated after 255 chars.
Can anybody help how to send complete list(width more than 255 chars) to spool.
Thanks and Regards,
NehaHi SAP fan,
<b>YES you can run the ALV report in background mode.
To run the report in background do F9 instead of F8, then give immediate and save.
Now goto Sm35 goto job overview and view the job listed
Choose the job and press the spool button. It will show the list created on the next page. When u clcik the list u can see the ALV output.
To see this the job should be in the finished status.
How to define Periodic Jobs
1.Execute transaction SM36
2.Define Job name, Job class, Target server
3.Click on 'START CONDITION' button
4.Click on 'Date/Time' button
5.Enter Scheduled start DATE & TIME. Check mark 'Periodic Job' field. Click on 'Period values' button and select 'Hourly' or 'Dialy' or 'Weekly' or 'Monthly' or Other period and SAVE. Go back to main screen.
6.Click on 'STEPS' button and enter Program name and Variant under box 'ABAP Program'. Click on 'Print Specification' button and enter Printer name under 'Output device' and SAVE
7.Click on SAVE button until you get message on bottom of the screen that describes 'Job XYZ saved with status: Scheduled'.
8.Click on 'Job overview' button or execute SM37 transaction.
9.Select the appropriate 'Job name', 'User name', 'Job Status' & Schedule date under 'Job start condition' and click on 'Execute' button or press F8.
10.You will now see all your scheduled JOBS.
<b>Case: 2</b>
You can Run in Background but make sure it is alv list, not alv Grid FM. if you are uisng alv list not problem , but if you are using alv grid then you can code like this..
if sy-batch = ' '.
call 'REUSE_ALV_GRID_DISPLAY'.
else.
call 'REUSE_ALV_LIST_DISPLAY'.
endif.
if you are using OO alv then write this code..
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING e_offline = off.
IF off IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
ENDIF.
<b>Case: 3</b>
if you are using OO ALV.
Just before creating the custom container check for the following condition.
Batch or Web Reporting
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
CREATE OBJECT o_custcontainer
EXPORTING
container_name = lc_custcontrol
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
ENDIF.
You can see the output in Spool in transaction SP01.</b>
Good Luck and thanks
AK -
ABAP Programming to display more than 255 characters in the screen
Hi
I want to display more than 255 characters in the screen after executing a report but i cant able to do that.
Please help me to find out the solution.
Thanks
Mrutyunjaya TrpathyHai tripathy,
when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain upto 90 columns in the display with the wide array of display options.
The commonly used ALV functions used for this purpose are;
1.REUSE_ALV_VARIANT_DEFAULT_GET
2.REUSE_ALV_VARIANT_F4
3.REUSE_ALV_VARIANT_EXISTENCE
4.REUSE_ALV_EVENTS_GET
5.REUSE_ALV_COMMENTARY_WRITE
6.REUSE_ALV_FIELDCATALOG_MERGE
7.REUSE_ALV_LIST_DISPLAY
8.REUSE_ALV_GRID_DISPLAY
9.REUSE_ALV_POPUP_TO_SELECT
hope u can try in this way.
REGARDS,
PRABA.
Maybe you are looking for
-
Error while creating Logical Data Object Model
Can anyone from Informatica help me on this ?
-
Authoring MP for custom JEE application
Hi The below is for SCOM 2012 R2 I am working on creating MP for Adobe CQ. This is an OSGI container with MBeans. Its not similar to any of the JEE servers like Tomcat, Weblogic etc. Following are the things I have done till now: 1. Added the server
-
Dear Team, We are using Internet through LAN proxy and connected in domain To set proxy -> IE->Tools->Internet Options->Connections->LAN Settings I click on Use a proxy server for your LAN square box, the below IP address and Port fields will be enab
-
How to recover lost phone contacts after Sync ?
My Nokia 6230 was full of contacts. My MacBook Pro adress book was empty. After syncing, my phone is empty... I have no backup ! When iSync deletes a contact from the phone, does it store the information somewhere on the mac before ? Is there any cha
-
Adobe Acrobat 11 Pro---How to get it
I downloaded Adobe Acrobat 11 Pro, dutifully created an Adobe ID and password, and then came the brick wall: Adobe Download Assistant. That was the end of the road. There were no options to get beyond it. Does anyone else out there know the secre