Restricting tcodes only to run in background.
Dear All Basis Experts,
Is there a way to restrict a tcode only to be run in background only, i have some performance issue, i want one particular tcode to be run only in background.
Please suggest,
Robert.
Hello Robert King
Do you have any specific tcode which should be execute in background ?
The t-code which require the data entry cannot be execute in background like va01/vl01 and many other t-codes which should register the data entry.
There are mostly reports which could be execute in background or schedule the specific time to execute in background.
Performance Issues
Pleae take the proactive approach to solve the performance issues;
1) Note the time of system while performance degrade
2) Monitor the system and user activity; might be any user execute the reports which having the SQL expensive statement which need to be identify during the monitoring or Early Watch Alert reports.
3)Also; Monitor the Hardware resources like CPU, Memory and Page file to find the causes of the slow performance.
4) CPU too busy
5) Not enough memory to handle the process
6) Page file; too much swap occured
Regards
Anwer Waseem
Similar Messages
-
Running TCODE (AFAB) - Depreciation Run in Background - Error: Printer name
Hi SAP experts,
This is actually a basis technical question.
But the error occurred in the Depreciation Run.
When one of our users run this process in Background, she encountered an error 'Printer name not defined'.
But when I use my account, I was able to successfully run it with no errors.
I have checked SU01 and the default name of the printer (LP01) is both assigned to the users.
We are using SAP 4.6 (4.0B). I hope we could find solutions for this.
Thanks!Hi,
Could you please check note 1292602.
Regards Bernhard -
My eom lightning charger says its unsupported and acts like a knock off and apps appear to be running in background draining battery but I can't see them. Upgraded to iOS 7 phone only lasts 1/2 day. Notifications are all off.
Crazybioteacher wrote:
Not to sound like a jerk but this is my 3rd iPhone and I hit the usual fixes.
And we would know that based on the initial posting based on what? -
Disabling parallel run of background job
Hi All
I have an ECC6.0 system in load balancing mode with cluster environment. The problem is that we have a program which runs in background. The same is specified to run on App1 server. However, in case the no. of bkd processes are less in App1 servers, it schedules the remaining jobs on to App Server 2 which is not desired.
eg
I have a process which activates 8 bkgd jobs on App1
App1 only has 5 bkgd processes free
The remaining 3 jobs will get scheduled on App2, which is not desired.
Please let me know how can i restrict a background process to run only on a single server.
Regards
Lokesh.If you define/change a job you can give a background server, however, if you give a fixed instance name and that instance is down the job won´t run at all.
You may be able to use an external scheduling software for this, e. g. Redwood Cronacle - which is free for Netweaver customers.
Markus -
Report program when run in background job getting cancelled immediately
Hi
When i run a program in foreground i am able to see the output. But when run in background not able to run the job successfully. The job is getting cancelled immediately.
I am using the below function module for output display. Should i need to pass any parameters in the below function module so that i can run the program in background successfully.
CALL METHOD DETAIL_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = IS_LAYOUT
I_SAVE = 'A'
IS_VARIANT = GS_VARIANT
CHANGING
IT_FIELDCATALOG = IT_FIELDCATALOG
IT_OUTTAB = BLOCKED_STOCK_TAB_ALV[].
Please suggest.
Thanks and regards
Rajani YeluriHi Rajani.
ALV require the DRYPOR(screen) for display but incase you run in back ground which have to write to spool but in spool we can only write in format of LIST REPORT not inter-active report like ALV. That why
system cancelled your process immediately.
Hope it helps.
Sayan. -
Getting the variant name when the report program is run in background
Hi All,
How to get the variant name for the report program when run in background? My requirement is to create an email attachement with the name 'variant.XLS', where variant = selection screen variant, when the report program is run in background. The system field SY-SLSET holds the variant name only when run online.
Any pointers to this will be highly appreciated.
Thanks and regards,
Nilesh.Hello Nilesh,
Please find the algo:
1. Call the FM: GET_JOB_RUNTIME_INFO to get the background job details.
2. Select data from TBTCP using these details:
DATA:
FP_EVENTID TYPE BTCEVENTID
FP_EVTPARM TYPE BTCEVTPARM
FP_ACTIVE TYPE BTCXPGFLAG
FP_JOBCNT TYPE BTCJOBCNT
FP_JOBNM TYPE BTCJOB
FP_STEPCNT TYPE BTCSTEPCNT.
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
EVENTID = FP_EVENTID
EVENTPARM = FP_EVTPARM
EXTERNAL_PROGRAM_ACTIVE = FP_ACTIVE
JOBCOUNT = FP_JOBCNT
JOBNAME = FP_JOBNM
STEPCOUNT = FP_STEPCNT
EXCEPTIONS
NO_RUNTIME_INFO = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* Error calling FM: GET_JOB_RUNTIME_INFO
ENDIF.
DATA: FP_VARIANT TYPE BTCVARIANT.
SELECT JOBNAME JOBCOUNT STEPCOUNT VARIANT
FROM TBTCP
INTO TABLE L_IT_TBTCP
WHERE JOBNAME = FP_JOBNM
AND JOBCOUNT = FP_JOBCNT
AND STEPCOUNT = FP_STEPCNT.
IF SY-SUBRC = 0.
SORT L_IT_TBTCP BY JOBNM JOBCNT STEPCNT.
READ TABLE L_IT_TBTCP INTO L_WA_TBTCP INDEX 1.
IF SY-SUBRC = 0.
FP_VARIANT = L_WA_TBTCP-VARIANT.
ENDIF.
ENDIF.
Hope this helps.
BR,
Suhas -
Ability to schedule a report to run in background but No access to transact
Hi,
I want to give users ability to schedule a report to run in background but No access to transaction Sm37.
What can be the process/steps to work and morever if we do this is there any disadvantages that users
can face later...
<removed_by_moderator>
Thanks,
Barada
Edited by: Julius Bussche on Jan 28, 2009 1:12 PMSorry, I misread your question - thinking that the report should only be run in the background.
I agree with the others (also about SMX and SMXX to display their own jobs, but not change them afterwards), but which report (tree) is this?
You can still give the user an ability to maintain a variant via transaction VARCH though (no execute possibility) . It will check S_PROGRAM p_action VARIANT or look for a user specific protection flag.
But then the user can submit it online as well from other transactions. That is why I thought you were looking for a way to run it as low priority in the background only.
Cheers,
Julius -
Spool List output display 255 char when the rpt is run in Background
Hi Friends,
I tried executing a program in Background.. The report output has more than 64 columns ( more than 255 char ) ..
Iam using "REUSE_ALV_GRID_DISPLAY" for displaying the list.
My Problem:
1. The spool list is truncated after 255 characters when i run in background.
2. Th output in Spool List is coming in 2 rows ... not very clear ... becoz of that the grid lines are not getting displayed.
3. I ve not used any Standard - line size for dislaying ..
4. In foreground i am able to display all the 64 columns... Y not in Background......
5. My Printer setting is ..X_255 .... only ...
Requirement:
1. What should i do to increase the spool list display to more than 255 characters
2. Or how to save the background run reports output to an excel sheet as how we 'll take the from the foreground.
Expecting your answers,
Thanks in Advance...
Cheers,
R.Kripa .........
Enjoy ABAPing ..........
new upcoming Abaper ....Hello Kripa,
You need to perform two actions.
1. set an appropriate format for the printer you are using. As explained from the previous messages you go to: SPAD -> output devives (type the printer you are using) -> from the menu ..-> goto -> device type -> formats. In there create a new format like Z_65_650
or Z_65_xxxx where xxxx could be up to 1065. This is the length of your report.
When you give your report in background, do not forget to choose the new format you created.
2. After the spool request is created, you take its number and use it ar a parameter in the following report.
Please copy and paste it in a new program, maybe called ZRSPOSHOWSPOOLLIST.
It should work then.
roxani
Display spool list > 255 columns
This is a SAP utility report to allow display of
spool request lists with line size more than 255 characters 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: <SPOC_PRTCTRL> TYPE C
, <SPOC_FRAME> TYPE C
, <SPOC_ICON> TYPE C
, <SPOC_SYMBOL_LOW> TYPE C
, <SPOC_SYMBOL_HGH> 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.
Zeilenlange 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: <LDATA>
, <PLAIN_TEXT>
, <PRTCTRL>
, <HOT_PRTCTRL>
, <HOT_FRAME>
, <HOT_ICON>
, <HOT_SYMBOL>
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 <= AREA_LEN.
REST_LEN = DATA_LENGTH.
ELSE.
WRITE: / 'Fehler beim Decodieren der Listendaten'(005).
STOP.
ENDIF.
CHECK REST_LEN > 0.
ASSIGN SPOOL_DATA(REST_LEN) TO <LDATA>.
WHILE <LDATA> CA SPOC-FIRST_BYTES.
NEXT_HOT = SY-FDPOS.
IF NEXT_HOT > 0.
ASSIGN <LDATA>(NEXT_HOT) TO <PLAIN_TEXT>.
MODAB
PERFORM WRITE_BIGFIELD USING <PLAIN_TEXT>
NEXT_HOT
LPOS.
WRITE AT LPOS <PLAIN_TEXT> NO-GAP.
ADD NEXT_HOT TO LPOS.
SUBTRACT NEXT_HOT FROM REST_LEN.
ASSIGN <LDATA>+NEXT_HOT(REST_LEN) TO <LDATA>.
ENDIF.
IF REST_LEN >= SPOC-PRTCTRL_START_LENGTH.
ASSIGN <LDATA>(SPOC-PRTCTRL_START_LENGTH) TO <HOT_PRTCTRL>.
ELSE.
ASSIGN 'too_short' TO <HOT_PRTCTRL>.
ENDIF.
IF REST_LEN >= SPOC-FRAME_START_LENGTH.
ASSIGN <LDATA>(SPOC-FRAME_START_LENGTH) TO <HOT_FRAME>.
ELSE.
ASSIGN 'too_short' TO <HOT_FRAME>.
ENDIF.
IF REST_LEN >= SPOC-ICON_START_LENGTH.
ASSIGN <LDATA>(SPOC-ICON_START_LENGTH) TO <HOT_ICON>.
ELSE.
ASSIGN 'too_short' TO <HOT_ICON>.
ENDIF.
IF REST_LEN >= SPOC-SYMBOL_START_LENGTH.
ASSIGN <LDATA>(SPOC-SYMBOL_START_LENGTH) TO <HOT_SYMBOL>.
ELSE.
ASSIGN 'too_short' TO <HOT_SYMBOL>.
ENDIF.
IF REST_LEN > 1.
HOT2 = <LDATA>+1(1).
IF REST_LEN > 2.
HOT3 = <LDATA>+2(1).
IF REST_LEN > 3.
HOT4 = <LDATA>+3(1).
ELSE.
HOT4 = '?'.
ENDIF.
ELSE.
HOT3 = '?'.
ENDIF.
ELSE.
HOT2 = '?'.
ENDIF.
IF <HOT_FRAME> = <SPOC_FRAME>.
COLS = 1. " in most cases.
BYTES = 2. " in most cases.
CASE HOT2.
WHEN '0'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN '1'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN '2'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN '3'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN '4'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN '5'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN '6'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN '7'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN '8'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN '9'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN ':'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
WHEN ';'. " box_drawings_light_left
WRITE AT LPOS '4' AS LINE NO-GAP.
WHEN '<'. " box_drawings_light_up
WRITE AT LPOS '5' AS LINE NO-GAP.
WHEN '='. " box_drawings_light_right
WRITE AT LPOS '4' AS LINE NO-GAP.
WHEN '>'. " box_drawings_light_down
WRITE AT LPOS '5' AS LINE NO-GAP.
WHEN '?'. " drawings_checkbox_off
WRITE AT LPOS ' ' AS CHECKBOX INPUT OFF NO-GAP.
WHEN '@'. " drawings_checkbox_on
WRITE AT LPOS 'X' AS CHECKBOX INPUT OFF NO-GAP.
WHEN OTHERS.
BYTES = 0.
ENDCASE.
ENDIF.
IF <HOT_SYMBOL> = <SPOC_SYMBOL_LOW>.
ESCAPE_TRICK = HOT3.
SUBTRACT 32 FROM ESCAPE_TRICK-X1.
IF HOT4 = SPACE.
WRITE AT LPOS(2) ESCAPE_TRICK AS SYMBOL NO-GAP.
COLS = 2.
BYTES = 4.
ELSE.
WRITE AT LPOS(1) ESCAPE_TRICK AS SYMBOL NO-GAP.
BYTES = 3.
ENDIF.
ENDIF.
IF <HOT_SYMBOL> = <SPOC_SYMBOL_HGH>.
ESCAPE_TRICK = HOT3.
ADD 32 TO ESCAPE_TRICK-X1.
IF HOT4 = SPACE.
WRITE AT LPOS(2) ESCAPE_TRICK AS SYMBOL NO-GAP.
COLS = 2.
BYTES = 4.
ELSE.
WRITE AT LPOS(1) ESCAPE_TRICK AS SYMBOL NO-GAP.
BYTES = 3.
ENDIF.
ENDIF.
IF <HOT_ICON> = <SPOC_ICON>.
IF SPOC-ICON_SEL >< 1.
SPOC-ICON_SEL = 1.
ICON_ID1 = '@00@'.
ICON_ID1+1(1) = HOT3.
ICON_ID1+2(1) = HOT4.
ELSE.
SPOC-ICON_SEL = 2.
ICON_ID2 = '@00@'.
ICON_ID2+1(1) = HOT3.
ICON_ID2+2(1) = HOT4.
ENDIF.
IF REST_LEN > 4.
HOT5 = <LDATA>+4(1).
IF REST_LEN > 5.
HOT6 = <LDATA>+5(1).
IF REST_LEN > 6.
HOT7 = <LDATA>+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 <HOT_PRTCTRL> = <SPOC_PRTCTRL>.
COLS = 0. " in most cases.
BYTES = 6. " in most cases.
IF REST_LEN >= SPOC-PRTCTRL_TOTAL_LENGTH.
THE_PRTCTRL = <LDATA>+SPOC-PRTCTRL_START_LENGTH(5).
IF THE_PRTCTRL = 'SABLD'.
FORMAT INTENSIFIED ON.
"no 3.0 'SAULN'.
"no 3.0 FORMAT UNDERSCORED ON.
ELSEIF THE_PRTCTRL = 'SAOFF'.
FORMAT INTENSIFIED OFF.
"no 3.0 FORMAT UNDERSCORED OFF.
ELSEIF THE_PRTCTRL(3) = 'COL'.
CASE THE_PRTCTRL+3(1).
WHEN '0'.
FORMAT COLOR OFF.
WHEN '1'.
FORMAT COLOR 1.
WHEN '2'.
FORMAT COLOR 2.
WHEN '3'.
FORMAT COLOR 3.
WHEN '4'.
FORMAT COLOR 4.
WHEN '5'.
FORMAT COLOR 5.
WHEN '6'.
FORMAT COLOR 6.
WHEN '7'.
FORMAT COLOR 7.
ENDCASE.
CASE THE_PRTCTRL+4(1).
WHEN 'N'.
FORMAT INTENSIFIED OFF INVERSE OFF.
WHEN 'H'.
FORMAT INTENSIFIED ON INVERSE OFF.
WHEN 'V'.
FORMAT INTENSIFIED ON INVERSE ON.
ENDCASE.
ENDIF. "printcontrol
ELSE. "??
ENDIF.
ENDIF.
IF BYTES = 0.
BYTES = 1.
WRITE AT LPOS(1) '#'.
COLS = 1.
ENDIF.
ADD COLS TO LPOS.
SUBTRACT BYTES FROM REST_LEN.
IF REST_LEN > 0.
ASSIGN <LDATA>+BYTES(REST_LEN) TO <LDATA>.
ELSE.
EXIT.
ENDIF.
ENDWHILE.
MODAB
IF REST_LEN > 0.
ASSIGN <LDATA>(REST_LEN) TO <PLAIN_TEXT>.
PERFORM WRITE_BIGFIELD USING <PLAIN_TEXT>
REST_LEN
LPOS.
ENDIF.
ENDFORM.
FORM WRITE_BIGFIELD USING VALUE(FIELD) TYPE C
VALUE(LEN)
VALUE(POS).
FIELD-SYMBOLS <P>.
DATA: CHUNK TYPE I.
WHILE LEN > 0.
IF LEN > 255.
CHUNK = 255.
ELSE.
CHUNK = LEN.
ENDIF.
WRITE AT POS FIELD(CHUNK) NO-GAP.
ADD CHUNK TO POS.
LEN = LEN - CHUNK.
IF LEN > 0.
FIELD = FIELD+CHUNK.
ENDIF.
ENDWHILE.
ENDFORM.
FORM SPOOLDATA_WRITE_INIT.
DATA: BEGIN OF ESCAPE_TRICK
, X1(1) TYPE X
, END OF ESCAPE_TRICK
FIELD-SYMBOLS: <LDATA>
, <PLAIN_TEXT>
, <PRTCTRL>
ESCAPE_TRICK-X1 = '1C'.
SPOC-PRTCTRL_START = ESCAPE_TRICK.
SPOC-PRTCTRL_START_LENGTH = 1.
SPOC-PRTCTRL_TOTAL_LENGTH = SPOC-PRTCTRL_START_LENGTH + 5.
ASSIGN SPOC-PRTCTRL_START(SPOC-PRTCTRL_START_LENGTH) TO <SPOC_PRTCTRL>.
ESCAPE_TRICK-X1 = '1B'.
SPOC-FRAME_START = ESCAPE_TRICK.
SPOC-FRAME_START_LENGTH = 1.
ASSIGN SPOC-FRAME_START(SPOC-FRAME_START_LENGTH) TO <SPOC_FRAME>.
ESCAPE_TRICK-X1 = '1B'.
SPOC-ICON_START = ESCAPE_TRICK.
SPOC-ICON_START+1 = ','.
SPOC-ICON_START_LENGTH = 2.
ASSIGN SPOC-ICON_START(SPOC-ICON_START_LENGTH) TO <SPOC_ICON>.
ESCAPE_TRICK-X1 = '1B'.
SPOC-SYMBOL_LOW_START = ESCAPE_TRICK.
SPOC-SYMBOL_LOW_START+1 = '('.
SPOC-SYMBOL_HGH_START = ESCAPE_TRICK.
SPOC-SYMBOL_HGH_START+1 = ')'.
SPOC-SYMBOL_START_LENGTH = 2.
ASSIGN SPOC-SYMBOL_LOW_START(SPOC-SYMBOL_START_LENGTH)
TO <SPOC_SYMBOL_LOW>.
ASSIGN SPOC-SYMBOL_HGH_START(SPOC-SYMBOL_START_LENGTH)
TO <SPOC_SYMBOL_HGH>.
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. -
Spool to PDF Conversion in ECC6 from Report running in Background
Hi Friends,
Iam working in ECC6, I have created one Classical report with line size of 295 which is running in Background and spool is generating.
But my requirement is I have to send this spool to email through PDF Attachment.
Here i have to convert Spool of line size 295 to PDF format. and then using FM give mail to respective email ids.
Here is the code i have written for your refference:
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
endif.
1. FORM GET_JOB_DETAILS .
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM. " G
2. FORM OBTAIN_SPOOL_ID .
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
MESSAGE s004(zdd) WITH gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM. " OBTAIN_SPO
3. CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
dst_device = 'ZLOCL'
PDF_DESTINATION = 'X'
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
*Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " CONVERT_SPOOL_TO_PDF
4. FORM PROCESS_EMAIL .
DESCRIBE TABLE it_mess_att LINES gd_recsize.
*DESCRIBE TABLE it_pdf_output LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
ENDFORM. " P
5. FORM SEND_EMAIL USING P_EMAIL.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachnament'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as PDF format
PERFORM send_file_as_email_attachment
TABLES it_mess_bod
it_mess_att
it_pdf_output
USING p_email1
'PDF Document Attached'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
CHANGING gd_error
gd_reciever.
ENDFORM. " SEND_EMAIL
6. FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES it_message
it_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.
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,
send_mail LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1.
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[] = it_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.
LOOP AT p_email1.
t_receivers-receiver = p_email1-low.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
ENDLOOP.
CALL FUNCTION 'SO_DOCUMENT_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. " SEND_FILE_AS_EMAIL_ATTACHMENT
But when iam executing the report in Background mail is coming to respective email ids but when i opened that attachment which is in PDF is not opening, giving error as below:
"Could not parsed Attachment.PDF!"
and file size is less oringinallly file size should be 125 KB buit in mail it is coming only 3 KB.
When i executed FM CONVERT_ABAPSPOOLJOB_2_PDF in foreground, its working fine for that Spool id.
Any suggestions from u friends.
regards,
Sekhar.Hi when ur running tha application in background pass the below parameters .
DATA:
w_form_name TYPE tdsfname VALUE 'Zpramu_TEST',
w_fmodule TYPE rs38l_fnam,
w_cparam TYPE ssfctrlop,
w_outoptions TYPE ssfcompop,
W_bin_filesize TYPE i, " Binary File Size
w_FILE_NAME type string,
w_File_path type string,
w_FULL_PATH type string.
Internal tables declaration
Internal table to hold the OTF data
DATA:
t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
Internal table to hold OTF data recd from the SMARTFORM
t_otf_from_fm TYPE ssfcrescl,
Internal table to hold the data from the FM CONVERT_OTF
T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
This function module call is used to retrieve the name of the Function
module generated when the SMARTFORM is activated
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_form_name
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = w_fmodule
EXCEPTIONS
no_form = 1
no_function_module = 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.
Calling the SMARTFORM using the function module retrieved above
GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
format of the output
w_cparam-no_dialog = 'X'.
w_cparam-preview = space. " Suppressing the dialog box
" for print preview
w_cparam-getotf = 'X'.
Printer name to be used is provided in the export parameter
OUTPUT_OPTIONS
w_outoptions-tddest = 'LP01'.
CALL FUNCTION w_fmodule
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = w_cparam
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = w_outoptions
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = t_otf_from_fm
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 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.
t_otf[] = t_otf_from_fm-otfdata[].
Function Module CONVERT_OTF is used to convert the OTF format to PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = W_bin_filesize
BIN_FILE =
TABLES
otf = T_OTF
lines = T_pdf_tab
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 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.
To display File SAVE dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILE_NAME =
FILE_FILTER =
INITIAL_DIRECTORY =
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = w_FILE_NAME
path = w_FILE_PATH
fullpath = w_FULL_PATH
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_bin_filesize
filename = w_FULL_PATH
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = T_pdf_tab
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Return Messages for a BAPI run in Background
Hi all,
I am running a BAPI( BAPI_SALESORDER_CHANGE ) in Background task, It works fine and updates the Sales order but i dont get any return messages.But based on the return messages i need to show up on the report which orders got updated and which are not.....
Can anyone help me how can i get the return messages when i run a BAPI in background task......Thanks for the quick response....I think you got me wrong...I am not running the program as a background job....I am running only the bapi in background task as below.....
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
IN BACKGROUND TASK AS SEPARATE UNIT
EXPORTING
salesdocument = v_vbeln
order_header_in = it_bapisdh1
order_header_inx = it_bapisdh1x
TABLES
return = it_return
partnerchanges = it_bapiparnrc.
When the bapi runs as a background task i dont get any return messages in it_return but the sales order gets updated....
But i will have to capture the return messages as well....How can i achieve that ? -
ABAP program to run in Background job
Hi,
We have a custumized program (SO Creation) calling some functions (like: WS_QUERY, WS_UPLOAD, WS_DOWNLOAD, CREATE_TEXT and CALL TRANSACTION VA01) and can only run thru dialog process (foreground). Is it possible to convert it to something that can run thru background job?
Please help.
Thanks.Hi Deo ,
Unfortunately cl_gui_frontend_services will not work in background.
Please have a look at following information about cl_gui_frontend_services :
The class CL_GUI_FRONTEND_SERVICES contains static methods for the following areas:
File functions
Directory functions
Registry
Environment
Write to / read from clipboard
Upload / download files
Execute programs / open documents
Query functions, such as Windows directory, Windows version, and so on
Standard dialogs (open, save, directory selection)
To Use this, you should be bit familier with OO ABAP Concepts. So I will suggest you to go through with OO concepts of ABAP. It will be of great help to you.
Regards,
Nikhil -
Send mail using CL_BCS through function module, run in background task.
Hi,
I am running a function module in Background task. in this function module I am sending mail using CL_BCS class.
but mail is not generated. if I run the same function Module in foreground mail generated successfully....
can anyone please tell me the reason behind this.Hi i realise that The LIST_TO_ASCII thing is not working correctly in background because the the list-processing in beckground is working not the same as in dialog i think.
I can only get the last page of the list out when running in background. Any solution to this?
my code:
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
list_index = sy-lsind
TABLES
list_dyn_ascii = downtab
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE 0.
EXIT.
ENDIF.
Thanks ,
LH -
The number of rows per page is greyed out when running in background?
Hi,
For a customized transaction the number of rows per page cannot be set when running in background.
While a background job is created in SM36 after entering the report name and the selection variant name in the properties of Format the rows and columns field is greyed out.It was not editable.
Is there any settings to be done or in the custom program any code change needs to be done?
Thanks in advance.
Regards,
Sharon.Hi Gabriel,
After double clicking the format only the rows field is not set to edit.It was greyed out.Is it anything related to the printer settings that will be maintained for a user?
Regards,
Sharon. -
Error in BIM when running in background mode
Hi,
I am facing an error when running a BIM in sm35.
The BIM runs fine with my userid in all three modes( foreground,display error mode, background mode)....but fails when the functional person is testing in background mode. The BIM runs fine in all other modes.
It gives the message when running in background mode
"No batch input data for screen SAPLMGMW 4008"
What should I check or do to correct it.
Please help.
Regards
RashiThe BIM runs fine in Foreground mode and in Display error mode even for the functional..It is giving error only for Background mode.
I also did the following
1. Created the BIM in my id and tried running( in background) it using the other id ...it was successful
2. Created the BIM in other id and ran ( in background) using my id....it failed.
I will check again for authorisations also.
Regards,
Rashi -
Maximum Line Width when Report is running in background
Hello Experts,
I have written a ABAP program and user is running in background. My output is of width of 599 characters. But wehn the user is running in the background, it is showing a warning that last 345 columns won't be displayed.
What is the maximum width, that is allowed for report being displayed in background.
Kindly help and points will be rewarded. its really urgent.
Thanks in advance.
Thanks and Regards,
SaurabhHey Saurabh,
I am facing the same problem. I have a report which has 406 characters. It is displayed correctly when executed in foreground but only 255 characters when executed in background.
You have resolved this issue. Can you please provide me the solution to execute it in background and get the complete output.
Regards,
Anosh
Maybe you are looking for
-
Fusion drive and logic?!
hi all, im going to have a new i mac i7 27 inch and bought it with a fusion drive. i saw some articles that claim fusion drive isnt good for logic work?? please let me know if its true and if I now have to start worry thanks.. and hope it was good de
-
Copying large video files to PC-external HD
I need to deliver a large Quicktime-file (5,87 Gb) edited in FCE to someone who will open it on his PC in Avid. It seems to be complicated: First problem is conversion - I need to convert my QT-file to a Windows Media file, right? This can be done wi
-
My laptop was stolen. How do I sync my old iphone to a new computer without losing my purchases (music & apps)?
-
What is changing in the nightly builds?
I've seen a lot of new commits go through svn with commit monitor. But when I download the nightly builds and do a file compare there are few files that are actually changing. I'm stuck on a couple of bugs that I think I've seen the fix be comitted
-
Problems installing new Adobe Flash Player
Several web sites that I visit give the message that I need to update my Adobe Flash Player. I go to the Adobe site and download the update and go through the install, but when I go back to the page saying that I need to update the flash player it s