Using STRLEN in a sapscript form
I
How can i use STRLEN function in a sapscript ?
I want to know lenght of a variable (&EKKO-TZX01&) and if's less than 40 char's I want put spaces until 40 char's.
It's possible in sapscript ?
Thanks
For ur requirement
You can replace leading spaces in a value with a fill character. Use the F option with the character immediately following the F in the specification as the fill character.
Syntax
&symbol(F f )&
f = fill character
Eg.:
Initially if &KNA1-UMSAT& -> 700.00
&KNA1-UMSAT(F*)& -> **700.00
So u can use &ekko-txz01(F )&
Regards,
Prashant
Similar Messages
-
Using a perform in a form with sapscript
Hi,
I would like to print a field during the runtime in a form. This field it is not available in the program so i would like to find it using a perform in the sapcript.
Someone tell me that this is possible...but someone can tell me how? Is there some docs about this issue?
Best Regards
João FernandesHi,
following is the help link...
http://help.sap.com/saphelp_nw70/helpdata/en/d1/803279454211d189710000e8322d00/frameset.htm
Calling ABAP Subroutines: PERFORM
You can use the PERFORM command to call an ABAP subroutine (form) from any program, subject to the normal ABAP runtime authorization checking. You can use such calls to subroutines for carrying out calculations, for obtaining data from the database that is needed at display or print time, for formatting data, and so on.
PERFORM commands, like all control commands, are executed when a document is formatted for display or printing. Communication between a subroutine that you call and the document is by way of symbols whose values are set in the subroutine.
The system does not execute the PERFORM command within SAPscript replace modules, such as TEXT_SYMBOL_REPLACE or TEXT_INCLUDE_REPLACE. The replace modules can only replace symbol values or resolve include texts, but not interpret SAPscript control commands.
Syntax in a form window:
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
/: ENDPERFORM
INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.
OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.
The ABAP subroutine called via the command line stated above must be defined in the ABAP report prog as follows:
FORM <form> TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
ENDFORM.
The values of the SAPscript symbols passed with /: USING... are now stored in the internal table IN_TAB . Note that the system passes the values as character string to the subroutine, since the field Feld VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR 80). See the example below on how to access the variables.
The internal table OUT_TAB contains names and values of the CHANGING parameters in the PERFORM statement. These parameters are local text symbols, that is, character fields. See the example below on how to return the variables within the subroutine.
From within a SAPscript form, a subroutine GET_BARCODE in the ABAP program QCJPERFO is called. Then the simple barcode contained there (First page, Next page, Last page) is printed as local variable symbol.
Definition in the SAPscript form:
/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM
/ &BARCODE&
Coding of the calling ABAP program:
REPORT QCJPERFO.
FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA: PAGNUM LIKE SY-TABIX, "page number
NEXTPAGE LIKE SY-TABIX. "number of next page
READ TABLE IN_PAR WITH KEY PAGE.
CHECK SY-SUBRC = 0.
PAGNUM = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY NEXTPAGE.
CHECK SY-SUBRC = 0.
NEXTPAGE = IN_PAR-VALUE.
READ TABLE OUT_PAR WITH KEY BARCODE.
CHECK SY-SUBRC = 0.
IF PAGNUM = 1.
OUT_PAR-VALUE = |. "First page
ELSE.
OUT_PAR-VALUE = ||. "Next page
ENDIF.
IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = L. "Flag: last page
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.
Regards,
Bharat. -
How Sapscript form can be send by mail
Hello all,
I want to send a Sapscript form by mail.
I think it should first be converted to PDF form and than need to be send by mail.
I have created a z form which is a copy of standard for medruck and also have changed the standard program SAPFM06P. So I need to add functionality in z program so that i can send the sapscript form by mail.
Can any body let me know the complete process how can i do it?
ThanksHi,
Just follow the below code . I am giving the code which starts from OPEN_FORM. After that one submit program is there u can see the code.
*& Form display_layout
text
--> p1 text
<-- p2 text
FORM display_layout.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
device = 'PRINTER'
DIALOG = 'X'
form = 'YFIL_DUNN_01'
LANGUAGE = SY-LANGU
options = itcpo
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
canceled = 1
device = 2
form = 3
options = 4
unclosed = 5
mail_options = 6
archive_error = 7
invalid_fax_number = 8
more_params_needed_in_batch = 9
spool_error = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT i_tab INTO wa_tab.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = '531'
FUNCTION = 'SET'
TYPE = 'BODY'
window = 'MAIN'
IMPORTING
pending_lines = wa_tab.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
result = itcpp
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
OTHERS = 5.
IF sy-subrc = 0.
IF ( itcpp-userexit IS INITIAL AND
NOT itcpp-tdspoolid IS INITIAL ).
p_spool = itcpp-tdspoolid.
SUBMIT yfir_mailsend_pdf_attachment WITH p_spool = p_spool
WITH p_kunnr = p_kunnr.
ENDIF.
ENDIF.
ENDFORM. " display_layout
*& Form modify_duedate
text
--> p1 text
<-- p2 text
FORM modify_duedate.
SELECT SINGLE mat_rec_no
mat_rec_date FROM yfi_matno
INTO (v_mat_rec_no, v_mat_rec_date)
WHERE vbeln = wa_tab-vbeln.
CHECK sy-subrc EQ 0.
SELECT SINGLE zterm
FROM vbrk INTO v_zterm
WHERE vbeln EQ wa_tab-vbeln.
CHECK sy-subrc EQ 0.
SELECT SINGLE zdays
FROM yfi_payment INTO v_zdays
WHERE zterm EQ v_zterm.
IF sy-subrc EQ 0.
wa_tab-zfbdt_due = ( v_mat_rec_date + v_zdays ).
wa_tab-due_days = ( sy-datum - wa_tab-zfbdt_due ).
IF wa_tab-due_days LE 0.
wa_tab-due_days = 'N/A'.
ENDIF.
IF ( wa_tab-umskz = 'A' AND wa_tab-shkzg = 'H' ).
wa_tab-zfbdt = ' '.
wa_tab-zfbdt_due = ''.
wa_tab-due_days = ''.
ENDIF.
MODIFY i_tab FROM wa_tab INDEX sy-tabix.
CLEAR: v_mat_rec_no, v_mat_rec_date, v_zterm, v_zdays.
ENDIF.
ENDFORM. " modify_duedate
SUBMIT PROGRAM :
REPORT yfir_mailsend_pdf_attachment MESSAGE-ID yf.
*& Program Name : *
& Author :
*& Creation Date : *
*& Program Type : *
*& SAP Release : *
*& Description : *
*& Transport No : *
*& Transaction : *
*& Send document with OTF/ALI attachment from spool to externalreci-
*& pient. OTF/ALI document is converted to PDF/HTML format duringthe
*& SAPconnect send process.
*& This report serves as example documentation for the function
*& modules SO_NEW_DOCUMENT_ATT_SEND_API1 and SO_DOCUMENT_SEND_API1.
*& Following this example you should be able to develop your own
*& report to send documents with all kinds of attachments.
Creation of the entry for the compressed document
*& TABLES:
TABLES : kna1,
adr6.
*& INTERNAL TABLES:
***********PDF Declaration*******
DATA: BEGIN OF i_spool OCCURS 0,
rqident LIKE tsp01-rqident,
rqo1name LIKE tsp01-rqo1name,
rqclient LIKE tsp01-rqclient,
END OF i_spool.
*& VARIABLES :
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: spoolno LIKE tsp01-rqident,
download TYPE c VALUE 'X', "AS CHECKBOX DEFAULT 'X',
p_file LIKE rlgrap-filename
VALUE 'C:\Invoice.pdf', "#EC NOTEXT
otf LIKE itcoo OCCURS 100 WITH HEADER LINE,
cancel,
pdf LIKE tline OCCURS 100 WITH HEADER LINE,
doctab LIKE docs OCCURS 1 WITH HEADER LINE,
numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
Data Declaration
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
*objpack-head_start = 1.
*objbin = ' | '. APPEND objbin.
*DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
objpack-head_start = 1.
*& PARAMETERS:
PARAMETERS : p_spool LIKE tsp01-rqident NO-DISPLAY,
p_kunnr LIKE kna1-kunnr NO-DISPLAY.
*& M A I N P R O C E S S
*& START OF SELECTION.
START-OF-SELECTION.
SELECT SINGLE
adr6~addrnumber
adr6~smtp_addr
FROM adr6
INNER JOIN kna1
ON kna1~adrnr = adr6~addrnumber
INTO CORRESPONDING FIELDS OF adr6
WHERE kna1~kunnr = p_kunnr.
IF sy-subrc = 0.
Create receiver list
reclist-receiver = adr6-smtp_addr. "<-- customer address
reclist-rec_type = 'U'.
APPEND reclist.
ENDIF.
***Convert Spool request to PDF
PERFORM pdf_convert.
docdata-obj_name = 'MAIL_AEIW'.
docdata-obj_descr = 'Dunning'.
Main Text
objtxt = 'Hi,'.
APPEND objtxt.
objtxt = 'Dunning'.
APPEND objtxt.
objtxt = 'Regards'.
APPEND objtxt.
Write Packing List (Main)
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
Create Message Attachment
Write Packing List (Attachment)
att_type = 'PDF'.
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
*objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-doc_size = tab_lines * 255.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = 'Attached Document'.
APPEND objpack.
*check for not maintaining customer address
IF reclist IS INITIAL.
MESSAGE e000 WITH 'Please Maintain Customer e-Mail ID'.
LEAVE LIST-PROCESSING.
ELSE.
Send Message
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel.6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
OBJECT_PARB =
receivers = reclist
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ELSE.
WRITE 'Mail sent successfully'.
ENDIF.
ENDIF.
WRITE: / 'End of Program'.
*& Form pdf_convert
text
--> p1 text
<-- p2 text
FORM pdf_convert.
DATA: date1 LIKE sy-datum,
time1 LIKE sy-uzeit,
period1 LIKE tsp01-rqcretime.
date1 = sy-datum.
time1 = sy-uzeit.
date1 = date1 - 1.
CONCATENATE date1 time1 INTO period1.
SELECT rqident
rqo1name
rqclient FROM tsp01 INTO TABLE i_spool
WHERE rqowner = sy-uname AND
rqclient = sy-mandt AND
rqident = p_spool.
IF sy-subrc <> 0.
WRITE: / 'No Spool Request created today'(003)
COLOR COL_NEGATIVE.
EXIT.
ENDIF.
SORT i_spool DESCENDING BY rqident.
READ TABLE i_spool INDEX 1.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = i_spool-rqclient
name = i_spool-rqo1name
part = 1
IMPORTING
CHARCO =
CREATER =
CREDATE =
DELDATE =
MAX_CREDATE =
MAX_DELDATE =
NON_UNIQ =
NOOF_PARTS =
RECTYP =
SIZE =
STOTYP =
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_spool-rqident
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
OTF_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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.
CASE sy-subrc.
WHEN 0.
WHEN 1.
WRITE: / 'Error On Spool Job'(002)
COLOR COL_NEGATIVE.
EXIT.
WHEN 2.
WRITE: / 'No Permission'(003)
COLOR COL_NEGATIVE.
EXIT.
WHEN 3.
WRITE: / 'Conversion Not Possible'(004)
COLOR COL_NEGATIVE.
EXIT.
WHEN OTHERS.
WRITE: / 'Incorrect Destination Device'(005)
COLOR COL_NEGATIVE.
EXIT.
ENDCASE.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_src = 134
line_width_dst = 255
TABLES
content_in = pdf
content_out = objbin
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4.
ENDFORM. " pdf_convert -
Sending sapscript form to an external mail
i need to send sapscript form to an external mail like for example a yahoo mail from SAP. i need an ABAP code that performs this function. its urgent, please
1) REPORT PROGRAM - RSTXPDFT4 ,
FIRST GENERATE SPOOL REQUEST THEN DOWNLOAD SAPSCRIPT TO PDF FILE ON LOCAL PC.
2) copy this code to send this downloaded form to external mail -
*& Report ZGILL_SENDMAIL_PDF *
REPORT ZGILL_SENDMAIL_PDF .
INCLUDE ZGILL_INCMAIL. "SEE BELOW FOR INCLUDE PROGRAM CODE.
* DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
* SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case DEFAULT '[email protected]'.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY DEFAULT 'C:TEMPSALARY_SLIP1.PDF'.
* AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
* START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
* FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
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.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
* CHECK_DOS_FORMAT =
IMPORTING
* DRIVE =
EXTENSION = extension
NAME = name
* NAME_WITH_EXT =
* PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
**********************iNCLUDE pROGRAM*********************************************
*& Include ZGILL_INCMAIL *
* Data
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
* FORM
FORM ml_customize USING objname objdesc.
*----------- Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
*--------- Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
* FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
* FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
* FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
*--------- Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
* IMPORTING
* COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
* Header Data
* Already Done Thru FM
* Main Text
* Already Done Thru FM
* Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
* Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
* Receiver List
* Already done thru fm
ENDFORM. "ml_prepare
* FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
* CONTENTS_HEX = objhex
* OBJECT_PARA =
* object_parb =
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
* FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
*-------------- Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
*------------- Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
* FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
*-------- Data
DATA : pos TYPE i.
DATA : len TYPE i.
*------------ Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
***********************INCLUDE END********************************* -
Sending sapscript form through Email
Hi,
I modifyed a std sapscript form for customer statement and that output i want to send to the customer through Email.So now i need a help for further what are the steps need to be do for sending that form by email.Pls be in details so that for me easy to solve this.
Thanks,
Rajendra.Hi ,
I am using the below code to send the form output by mail but it is not working for me.pls correct my code where i want to change so that i can solve my issues.
DATA: itcpo LIKE itcpo,
tab_lines LIKE sy-tabix.
Variables for EMAIL functionality
DATA: maildata LIKE sodocchgi1.
DATA: mailpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: mailhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: mailbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: mailtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: mailrec LIKE somlrec90 OCCURS 0 WITH HEADER LINE.
DATA: solisti1 LIKE solisti1 OCCURS 0 WITH HEADER LINE.
parameter: p_email1 like somlreci1-receiver .
PERFORM send_form_via_email.
FORM SEND_FORM_VIA_EMAIL *
FORM send_form_via_email.
CLEAR: maildata, mailtxt, mailbin, mailpack, mailhead, mailrec.
REFRESH: mailtxt, mailbin, mailpack, mailhead, mailrec.
Creation of the document to be sent File Name
maildata-obj_name = 'TEST'.
Mail Subject
maildata-obj_descr = 'Subject'.
Mail Contents
mailtxt-line = 'Here is your file'.
APPEND mailtxt.
Prepare Packing List
PERFORM prepare_packing_list.
Set recipient - email address here!!!
mailrec-receiver = p_email1.
mailrec-rec_type = 'U'.
APPEND mailrec.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = maildata
put_in_outbox = ' '
TABLES
packing_list = mailpack
object_header = mailhead
contents_bin = mailbin
contents_txt = mailtxt
receivers = mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
ENDFORM.
Form PREPARE_PACKING_LIST
FORM prepare_packing_list.
CLEAR: mailpack, mailbin, mailhead.
REFRESH: mailpack, mailbin, mailhead.
DESCRIBE TABLE mailtxt LINES tab_lines.
READ TABLE mailtxt INDEX tab_lines.
maildata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( mailtxt ).
Creation of the entry for the compressed document
CLEAR mailpack-transf_bin.
mailpack-head_start = 1.
mailpack-head_num = 0.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'RAW'.
APPEND mailpack.
Creation of the document attachment
This form gets the OTF code from the SAPscript form.
If you already have your OTF code, I believe that you may
be able to skip this form. just do the following code, looping thru
your SOLISTI1 and updating MAILBIN.
PERFORM get_otf_code.
LOOP AT solisti1.
MOVE-CORRESPONDING solisti1 TO mailbin.
APPEND mailbin.
ENDLOOP.
DESCRIBE TABLE mailbin LINES tab_lines.
mailhead = 'TEST.OTF'.
APPEND mailhead.
Creation of the entry for the compressed attachment
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'OTF'.
mailpack-obj_name = 'TEST'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
APPEND mailpack.
ENDFORM.
Form GET_OTF_CODE
FORM get_otf_code.
DATA: BEGIN OF otf OCCURS 0.
INCLUDE STRUCTURE itcoo .
DATA: END OF otf.
DATA: itcpo LIKE itcpo.
DATA: itcpp LIKE itcpp.
CLEAR itcpo.
itcpo-tdgetotf = 'X'.
Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'Z2006FICSE'
language = sy-langu
options = itcpo
dialog = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'MAIN'
EXCEPTIONS
error_message = 01
OTHERS = 02.
Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
MOVE-CORRESPONDING itcpo TO itcpp.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
result = itcpp
TABLES
otfdata = otf
EXCEPTIONS
OTHERS = 1.
Move OTF code to structure SOLI form email
CLEAR solisti1. REFRESH solisti1.
LOOP AT otf.
solisti1-line = otf.
APPEND solisti1.
ENDLOOP.
ENDFORM.
Hope i can expect the feedback soon from you guys.
Thanks,
Rajendra. -
SAPSCRIPT form - Text is not porperly displayed
hi all,
in my SAPSCRIPT form, I am getting a text from PERFORM stmt. in the PERFORM , the text is coming correct, but in the form , it is showing only half of the text.
the code
FORM get_text TABLES ts_intab STRUCTURE itcsy
ts_outtab STRUCTURE itcsy.
DATA: l_haul_text(500) TYPE c,
l_haul_long(250) TYPE c.
l_haul_long = l_haul_text+0(250).
LOOP AT ts_outtab.
CASE ts_outtab-name.
WHEN 'L_HAUL_LONG'.
ts_outtab-value = l_haul_long.
MODIFY ts_outtab.
ENDCASE.
ENDLOOP.
Then in the form, just display
/: PERFORM GET_TEXT IN PROGRAM
/: USING &VBDKL-VBELN&
/: CHANGING &L_HAUL_LONG&
/: ENDPERFORM
&L_HAUL_LONG&
while debugging, the text is correct till TS_OUTTAB but when it comes to the form L_HAUL_LONG, it is truncated.......what should i do..
Kindly help.
THnaksanswered
-
Addint new field to the standard sapscript form.
FOR SALES INVOICE DOCUMENT FORM PRINTING
TRANSACTION CODE: VF01
OUTPUT TYPE : FJCI
PROGRAM NAME: RVADAUS1
SAPSCRIPT FORM NAME: SD_EXPORT_FJCI
ENTRY ROUTINE: ENTRY_FJCI.
STRUCTURE USED FOR THIS OUTPUT TYPE = V55EFJCI
THE QUERY IS AS FOLLOWS:
I WANT TO ADD DATA MODE OF TRANSPORT FROM THE INVOICE DOCUMENT. THE TABLE AND FIELD IS T618-BEZEI.
SO I COPIED THE STANDARD FORM TO ZSD_EXPORT_FJCI AND THE STANDARD PROGRAM TO ZRVADAUS1.
I SUCCESSFULLY FETCHED THAT FIELD DATA.
I APPEND THE STRUCTURE 'ZAV55EFJCI' TO ADD THE ADDITIONAL T618-BEZEI FIELD.
AND WRITE MY SELECT QUERY IN THE ENTRY_FJCI FORM ROUTINE.
THE CODE IS AS FOLLOWS:
data: begin of it_mode_of_tp occurs 1,
bezei type t618t-bezei,
end of it_mode_of_tp.
select a~bezei as zzbezei into table it_mode_of_tp from t618t as a
inner join
eikp as b on aexpvz = bexpvz and aland1 = baland inner join vbrk as
c on bexnum = cexnum
where cvbeln = nast-objky and aspras = nast-spras .
loop at it_mode_of_tp.
v55efjci-zzbezei = it_mode_of_tp-bezei.
endloop.
BUT THE DATA FOR THAT IS NOT GETTING DISPLAYED.
THIS WAS THE FIRST METHOD I FOLLOWD.
THE SECOND METHOD I DID WAS AS FOLLOWS:
FORM ENTRY_FJCI.
PERFORM PROCESSING.
ENDFORM
FORM PROCESSING.
PERFORM PRINT_DOCUMENT.
ENDFORM.
FORM PRINT_DOCUMENT.
CALL FUNCTION 'RV_EXPORT_DOCUMENT_PRINT'
ENDFORM.
IN THIS FUNCTION THE DATA IS GETTING FETCHED FROM THE DATABASE TABLES AND STORED IN THE STRUCURE V55EFJCI.
SO I COPIED THAT FUNCTION.
IN THIS FUNCTION , THEIR IS A INCLUDE PROGRAM 'LV55EF11' FOR FETCHING DATA FOR ENTRY_FJCI FORM ROUTINE.
I COPIED THAT PROGRAM CODE , AND CREATED MY OWN INCLUDE PROGRAM (WHICH I AM STORING IT IN ANOTHER Z PACKAGE.)
AND WRITTEN MY ABOVE CODE IN THAT PROGRAM. BUT WHEN I DO THIS, NOITHING GETS DISPLAYED , EVEN THE PREVIOUSLY COMING DATA ALSO NOT GETTING DISPLAYED.
HOW SHOULD I PROCEED.you said you copied layout(form) SD_EXPORT_FJCI to ZSD_EXPORT_FJCI,
you updated program to fetch datat & populate v55efjci-zzbezei field.
Now
- you need to modify layout(form) ZSD_EXPORT_FJCI via SE71 to insert your field in one of the windows where it has to be printed (sap script knowledge is required here).
- you need to either modify SAP output type FJCI to use your program/layout(form) or you need to create your own output type and assign your form/program to it, and in addition to that if you define your own output type - yo have to add it to output determination procedure, to access sequences, add condition records to condition table... so it's picked up by the invoice. -
How to make an unformatted sapscript form
At the bottom of [this page|http://help.sap.com/saphelp_45b/helpdata/en/34/60b30cae724effe10000009b38f91f/content.htm] it says:
"If you want to pass on the information to be printed to one printer only, and this printer then takes care of editing and layout, you can mark a special form for this purpose (see Release Information SAPSCRIPT). In this way, the text is passed on unformatted. This is of interest, for example, if you are using thermal-transfer label printers
... without any links. I've been looking for this "Release Information SAPSCRIPT" but can't find it, does anyone know where?
I need to print labels to a thermal printer (Paxar Monarch) but if I put the print codes inside a sapscript form, the printer always gives errors. If I write the same printcodes directly to the printer, it works fine. However, I need to use sapscript forms for customizing reasons, but the form just needs to pass on the printcodes as unformatted text.Refer this link might be useful -
ftp://ftp.nicelabel.com/docs/whitepaper/wp-Printing_labels_from_SAP_R3-eng.pdf
Regards,
Amit -
Call a function module from within a sapscript form
not being an ABAPer i have the task of changing the Invoice SAPScript form.
i have made the necessary changes - just about... but they have asked that i include the VAT Number on the Invoice....
not too bad apart from different company codes have different vat numbers...
not knowing a better way to retrieve data from table V_001_B - i am using the print program -RFKORD50, is there a better way of getting the VAT Number by company code? I figured if i could call the FM to return the value, all well and good.., they do not want the print program changed if possible so was looking at alternate methods....
or am i trying to reinvent the wheel here?thank you both! helpful answers! :o)
anyway!
i have written the program which is called from the SAPScript:
/: PERFORM GET_VATNUMBER IN PROGRAM ZFI_F140_OPERATIONS
/: USING &BKPF-BUKRS&
/: CHANGING &VATNUMBER&
CE VAT Registration No : &VATNUMBER&
REPORT zfi_f140_operations.
FORM get_vatnumber TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
DATA: lv_co_code TYPE bukrs,
lv_vat_no TYPE stceg.
READ TABLE in_par WITH KEY name = 'BKPF-BUKRS'.
MOVE in_par-value TO lv_co_code.
SELECT SINGLE stceg FROM t001
INTO lv_vat_no WHERE bukrs = lv_co_code.
out_par-name = 'VATNUMBER'.
WRITE lv_vat_no TO out_par-value.
CONDENSE out_par-value.
MODIFY out_par INDEX 1.
ENDFORM.
it is not working and i cannot work out why...
i have not been ABAPing for very long but have had a go....
any thoughts as to what i have done wrong?
or point me where i should be looking? thank you! -
Missing text elements in my sapscript form / Transaction F.17
Hello!
I'm on a sap ecc 6.0 system and have problems with a sapscript form.
My printprogram is sapf130d and my form is y_..._debi_slep.
Starting the transaction F.17 i get several lists and at last the error-list. This error-list says "in form y_..._debi_slep in the main window the following textelements are missing ...". Three elements 506, 595 and 606 are missing.
When i look into the form i couldn't see the elements. So with "/E 506", "/E 595" and "/E 606" i've inserted the elements in the main window and saved and activated the form. A new try with "F.17" raises the same errors. For my understanding the relevant elements should be in the info window in this case - i inserted them there, too ... but the errors remain the same. In the print program i can find all these textelements.
Perhaps someone out there has a solution or a hint for me?
Thanks a lot in advance.
Best regards,
IngoThe cause of error could be of any reason.
1) For driver program SAPF130D, following forms must be used, or customised by copying any of this below forms.. May be this could be one <b>reasons for the error.</b>
Forms
The following forms are used in the standard SAP R/3 System:
Form for Form name
Letter and Reply <b>F130_CONFIRM_01</b>
Check list <b>F130_LIST_01 and F130_LIST_02</b>
Results table <b>F130_RESULT_01 or F130_RESULT_02</b>
Error list <b>F130_ERROR_01 or F130_ERROR_02</b>
If you define your own forms, the form name should contain the identification code "F130".
Regards,
Sairam -
In which table the lines of the SAPScript form text elements are found?
Hello,
I want to write a report analyzing the lines contained in the text elements of an SAPScript form. From which table can I select the data? Regards.
Lars.Sorry.. forgot to mention the FM name.
You can use FM 'READ_TEXT'.
pass 'ST' for ID.
and 'TEXT' for OBJECT
and pass the name of text element to NAME u will get the
text element. -
Get the current line no.(similar to sy-linno in report) in Sapscript form
Hi everyone,
In ABAP reporting, you can use sy-linno to determine the current line no.
But if in sapscript form,
does any system field to get the currect line no. or y-origin. ?
Just say the program is now runing and have written several lines in a window of the form.
AS This is the first line
AS This is the second line
AS This is the third line
how to get the current line = 3 or yorigin '+3' LN?
Thanks for reply in advance.Hi,
you can also chk the sy-linno directly in your script.
Regards
Subramanian -
Display sapscript form in Web Dynpro Java
Hi,
Is it possible to print an existing sapscript form i.e. PO from ECC to my Web Dynpro application? I have successfully created a Web Dynpro Java application to create POs but now have a requirement to display or print the PO?
Can someone provide me with a sample code? I'm hoping to be able to do this without using Adobe.
Again, thanks for all your help.
Best regards,
JaypeeHi mark,
Without Adobe also u can display PO order.
Below is the code to open a HTML window from WDJava, with data from WDJava...
Inside DoInit()
IWDAttributeInfo attr1 =
wdContext.getNodeInfo().getAttribute("htmlfile");
ISimpleTypeModifiable mtype1 = attr1.getModifiableSimpleType();
IWDModifiableBinaryType btype1 = (IWDModifiableBinaryType) mtype1;
btype.setFileName(attr.getName() + ".html");
btype.setMimeType(WDWebResourceType.HTML);
_contentType = mtype;
Where htmlfile is a context attribute of type binary... and do a global declaration like this
ISimpleTypeModifiable _contentType = null; (This declaration can be done at the end of your view's coding between Begin Others and End Others)
Now,
inside on action print
public void onActionPrintData(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String videoName )
//@@begin onActiondisplayVideo(ServerEvent)
byte[] content = new byte4028;
try {
content = this.displayPrint().getBytes("UTF-8");
wdContext.currentContextElement().setHtmlfile(content);
wdContext.currentPrintElement().setAttrUrl(
_contentType.format(content));
//Where content is loaded with data from displayPrint() method, which is holding the HTML *page to be displayed to the user *
IWDWindow win =
wdThis
.wdGetAPI()
.getComponent()
.getWindowManager()
.createNonModalExternalWindow(WDWebResource
.getWebResource(content, WDWebResourceType.HTML)
.getURL(),"ShowVideo");
win.setWindowSize(445,460);
win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
win.removeWindowFeature(WDWindowFeature.TOOL_BAR);
win.removeWindowFeature(WDWindowFeature.MENU_BAR);
//win.open();
win.show();
// wdComponentAPI.getMessageManager().reportSuccess("444444444444");
} catch (Exception e) {
wdComponentAPI.getMessageManager().reportException ("Unable to open window"+e,false);
//@@end
Now finally, design your HTML Page inside the method displayPrint() like this
public java.lang.String displayPrint( java.lang.String strVideoName )
//@@begin displayPrint()
String htmlcontent=null;
htmlcontent="content what you want to show in print window";
use script inside the html content to do a print... like window.print();
return htmlcontent;
//@@end
Regards,
Sunaina Reddy T -
How to disable debugger for sapscript forms.
How to disable debugger for sapscript forms.
Once activated in se71-Utilities-Activate debugger I do not know how to disable itThank you Rich
I assigned you points for good answer on my preavious mail)
. Actually my real problem is a transported the SAP script form znalepke2 , printer definition nale
and device type zststartsp of a thermal printer.
On original system (ak1) the printout is ok but on target system(ak2)
not.
Lateron I transported also :
R3TR SCPD 1403(as the device type uses this character set)
R3TR TABU TSP08 (All entries)
R3TR TABU TSP1D(All entries)
R3TR TABU TSP1T(All entries)
I used also report RSTXSCRP to traport form and device types. L
Lately I discovered that when I performe printout preview I get also eronneous printout If I ssue an printout preview in language "EN" on system "ak1"(only on system ak1 and form preview in "SL" is oK. What steps you suggest me to solve the prolem
Thank you in advance -
How to change the Development Class of the SAPSCRIPT FORM
Hi All,
I have transported the old form which needs to be deleted in Test System. Is that possible to create a TR for deletion and send it to Test enivronment?..
Also is it possible to change the development class for a form?
Please help me on this. Urgent!...
Regards,
Ramkumar.Yes, it is possible to change the development class for forms..
Use SE03, transport organiser tools
goto node OBJECT DIRECTORY ENTRY
select node "Change object directory entries"
Execute
goto the next text box after data element, type FORM, give your SAPSCRIPT form name and tick the check box execute... now rightclick on your form and chenge development class..
Now coming to your second question is is not possible to delete a FORM that it is already transported to QA and Production, only way to do this is by doing client copy.. basis will do it for you..
Close the thread once your question is answered.
Regards,
SaiRam
Maybe you are looking for
-
Working With two files in LSMW
Hi, I am uploading BOM data using a standard object 0030. Here i an trying to upload data using two file one for header and second for item. Can i know how can we relate the files. As for the material BOM header how will it know what items to pick
-
Best way to migrate to a new SSD drive for performance and reliabilility
Hello all, My 2011 15" MacBook Pro is about 3 weeks old and my new OCZ Vertex 3 120GB SSD is coming in tomorrow. What is the best way to move my system over to the new drive? I have Time Machine backups on my external Firewire drive as well as comple
-
Adding BW 3.50 in logical system problems!!
Hi All I am trying to create a landscape for our BW systems and I cannot add our BW.3.5 systems as on each of the elements I get the message 'No system found for this product/main instance' I have also looked and can only find BW 3.1. In SMSY i can s
-
How can I not wait for a RFC response
Hi everyone, i want to execute an RFC and not wait for the response, i don´t care, so, is there a way to achieve this ? thanks
-
10g Sample Schema code missing
Hi...On installation of 10g db (10.1.0.2.0), the expected sample schemas are not provided. I have tried multiple installs in order to try and extract the sql scripts. e.g. hr_main.sql, oe_main.sql and bi_main.sql. These sample schemas are not the sam