IF statement in SAPscript
I'm probably making a really simple mistake, but I've got the following code in a SAPscript window:
/: IF ®UD-WRBTR& GT 0
HE <S>DR></>
/: ELSE
HE <S>CR></>
/: ENDIF
I've debugged through the print program and REGUD-WRBTR is 1175.00 but it still prints CR.
Any ideas?
Gill
use
IF REGUD-WRBTR GT 0
without &
Similar Messages
-
Where to do the abap sql statement in sapscript (PO)
Hi, all.
Hope anybody can guide me to find a solution.
My situation now is i have to do a purchase order in SAPSCRIPT starting from a standard po. I already found out all the related details as below:
Program SAPFM06P
FORM routine ENTRY_NEU
Form MEDRUCK
So, now the problem now is I have to add some more data on my print out PO. After figure out for some time, I don't know where to do my abap sql statement. Like example, I want to retriece some data from the ADRC table. I opened the standard program SAPFM06P to add in the some sql statement, but i dun know where should i add in. Bcz if we straight away put the related ADRC field in our sapscript, it is useless, right?
Thanks in advance.Thanks a lot.
So, how should i add in code in order to fetch the data frm ADRC by using that routine. Because i only the codes like below. I don't where should i start add in.
Form entry_neu using ent_retco ent_screen.
data: l_druvo like t166k-druvo,
l_nast like nast,
l_from_memory,
l_doc type meein_purchase_doc_print.
clear ent_retco.
if nast-aende eq space.
l_druvo = '1'.
else.
l_druvo = '2'.
endif.
call function 'ME_READ_PO_FOR_PRINTING'
exporting
ix_nast = nast
ix_screen = ent_screen
importing
ex_retco = ent_retco
ex_nast = l_nast
doc = l_doc
changing
cx_druvo = l_druvo
cx_from_memory = l_from_memory.
check ent_retco eq 0.
call function 'ME_PRINT_PO'
exporting
ix_nast = l_nast
ix_druvo = l_druvo
doc = l_doc
ix_screen = ent_screen
ix_from_memory = l_from_memory
ix_toa_dara = toa_dara
ix_arc_params = arc_params
ix_fonam = tnapr-fonam "HW 214570
importing
ex_retco = ent_retco.
endform.
Or i come wrong place to add in any coding. Plz guide me.
Thanks in advance. -
Adding in Select statement for SAPscript printout
Hi everyone,
I have a new requirement where i would need to output a new field in a sapscript printout.
A summary of the requirements is as follows:
-> If EKPO-PSTYP = '3'
-> select RSNUM
from EKET
where EKET-EBELN = EKPO-EBELN and
EKET-EBELP = EKPO-EBELP
-> select MATNR
from RESB
where RESB-RSNUM = EKET-RSNUM
-> display RESB-MATNR in printout
At the moment, the sapscript is only reading from table EKPO, whereas for the new requirement to work, i'll also need to read from table EKET and RESB. Am i right to understand that sapscript cannot read SELECT statements directly from the Change Editor and i would need to do a PERFORM statement?
The question now is, where do i put this part of the logic? Any ideas?
Message was edited by: Bernard LohHi,
Write a PERFORM in your script.
PERFORM GET_MATNR IN PROGRAM Z_SUBROTINEPOOL
USING W_EBELN W_EBELP
CHANGING W_MATNR
ENDPERFORM.
And check the following to write the FORM in the Z program.
The structure ITCSY is used in relation with SAPScripts. You can call a Routine in any program in SAPScript.
For eg: if you have a subroutine named ADD_INCOME in a program ZSHAIL_BASIC, you can call the subroutine in SAPScript as follows:
/: PERFORM ADD_INCOME IN PROGRAM ZSHAIL_BASIC
/: USING &var1&
/: CHANGING &var2&
/: ENDPERFORM.
Here the input parameter to the subroutine is var1 and the value returned by the subroutine is var2.
In the program ZSHAIL_BASIC, you have to call the subroutine as
FORM ADD_INCOME TABLES IN_TAB STRUCTURE ITCSY OUT_TAB STRUCTURE ITCSY.
ENDFORM.
IN_TAB is a structure of type ITCSY,which has 2 components, NAME and value.
So in the program, var1(which is sent from SAPScript) , will be stored as IN_TAB-NAME and its value will be in IN_TAB-VALUE. You can utilise the IN_TAB-VALUE and after performing the required operations, the return value should be assigned to table OUT_TAB.
This value can thus be obtained in var2 specified in SAPScript.
Also you can search for "SUBROUTINE IN SCRIPT"... "PERFORM IN SCRIPT", "ITCSY"....
Thanks and Regards,
Bharat Kumar Reddy.V -
Problem in Address Endaddress statement in sapscript
Hello Friends,
I have 1 problem in existing sap script for delivery where address is printed using command address endaddress.
Problem is In output while displaying PO BOX text , it is displayed in DE language insted of EN whether logon lang is EN.
Regards,
YogHi
To translate the text in SAP Script :
You can goto transaction SE63 and translate the scripts into different languages.
In SE63, click Translation -> Long Texts -> Sapscripts -> Forms
Those language you can convert to have already been pre-installed in the system.
SE63 is the best way to translate since it offers check options.
Or
Also try to change logon language to korea.
Hope this will solve your problem.
Rewards Points if useful.
Thanks & Regards
Nikunj Shah -
Error in PERFORM statement in SAPSCRIPT...
Hello Experts,
I am having an error in my code below:
SAPSCRIPT:
Begin of insertion DEVK940799 11/10/2008 DEL_HIDALGO
DEFINE <YC_NAME1& = ''.
DEFINE <YC_NAME2& = ''.
DEFINE <YC_STR_SUPPL1& = ''.
DEFINE <YC_STR_SUPPL2& = ''.
DEFINE <YC_STR_SUPPL3& = ''.
DEFINE <YC_POST_CODE1& = ''.
DEFINE <YC_CITY1& = ''.
DEFINE <YC_BEZEI& = ''.
DEFINE <YC_LAND1& = ''.
PERFORM GET_VENDOR_DETAILS IN PROGRAM Z9999RFI_Z2574FFI_RA
USING ®UH-LIFNR&
CHANGING <YC_NAME1&
CHANGING <YC_NAME2&
CHANGING <YC_STR_SUPPL1&
CHANGING <YC_STR_SUPPL2&
CHANGING <YC_STR_SUPPL3&
CHANGING <YC_POST_CODE1&
CHANGING <YC_CITY1&
CHANGING <YC_BEZEI&
CHANGING <YC_LAND1&
ENDPERFORM
<YC_NAME1& <YC_NAME2&
<YC_STR_SUPPL1&
<YC_STR_SUPPL2&
<YC_STR_SUPPL3&
<YC_POST_CODE1&
<YC_CITY1&
<YC_BEZEI&
<YC_LAND1&
End of insertion DEVK940799 11/10/2008 DEL_HIDALGO
PROGRAM:
*& Report Z9999RFI_Z2574FFI_RA
REPORT z9999rfi_z2574ffi_ra.
* Start of Selection event
START-OF-SELECTION.
*& Form get_vendor_details
* text
* -->IM_LIFNR text
* -->CH_NAME1 text
* -->CH_NAME2 text
* -->CH_STR_SUPPL1 text
* -->CH_STR_SUPPL2 text
* -->CH_STR_SUPPL3 text
* -->CH_POST_CODE1 text
* -->CH_CITY1 text
* -->CH_BEZEI text
* -->CH_LAND1 text
FORM get_vendor_details USING im_lifnr
CHANGING ch_name1 TYPE adrc-name1
ch_name2 TYPE adrc-name2
ch_str_suppl1 TYPE adrc-str_suppl1
ch_str_suppl2 TYPE adrc-str_suppl2
ch_str_suppl3 TYPE adrc-str_suppl3
ch_post_code1 TYPE adrc-post_code1
ch_city1 TYPE adrc-city1
ch_bezei TYPE bezei
ch_land1 TYPE t005-land1.
DATA: ltyc_adrnr TYPE lfa1-adrnr.
SELECT SINGLE adrnr
FROM lfa1
INTO ltyc_adrnr
WHERE lifnr = im_lifnr.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ltyc_adrnr
IMPORTING
output = ltyc_adrnr.
SELECT SINGLE name1 name2 str_suppl1
str_suppl2 str_suppl3 post_code1
city1
FROM adrc
INTO (ch_name1, ch_name2, ch_str_suppl1,
ch_str_suppl2, ch_str_suppl3, ch_post_code1,
ch_city1)
WHERE addrnumber = ltyc_adrnr.
ENDIF.
ENDFORM. "get_names
It says that there is an error in perform but they both have the same number of parameters.What do you mean by "Is it ok to customize the standard program RFFOUS_C"? I think you only have to copy a standard SAPScript for checks (if there is any...) and modify it acc. to your requirements. In the system you can customize that the standard print program will call your Z... SAPScript.
On the other hand I believe that all variables you want to use in the SAPScript has to be defined in as global in the print program (except the ones, which you define in the script (with DEFINE)) -
Sap script form perform statement
HI ALL ,
CAN ANYONE HELP ME WITH SAP-SCRIPT FORM AND PERFORM SYNTAX. THAT IS WHEN U NEED TO ADD A FIELD TO AN EXISTING SAPSCRIPT, BY USING AN EXTERNAL SUBROUTINE.
i NEED THE SYNTAX BOTH FOR PERFORM AND ENDPERFORM STATEMENT AND ALSO THE FORM STSEMENT. ANOTHER TRHING IS IF CAN LET ME KNOW HOW TO USE DEFINE STATEMENT IN SAPSCRIPT. WHATS ITS USE AND IS IT RELATED TO THE QUERY ABOVE.
else,
U PLZ LET ME KNOW ANY HELPFUL LINKS TO GO THROUGH.
THANLS IN ADVANCE,
ANUPMA.Hi anupma,
1. while calling subroutines from sapscripts,
there is a special technique,
which has got its own limitations.
2.
FORM abc
TABLES
in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
ENDFORM.
3. The perform in se38 program should be of the
above format only.
4. We cannot pass internal tables.
5. Rather we need to pass
VARIABLE NAME
VARIABLE VALUE
(see the structure of itcsy in se11)
6. In this form, we have to read
the internal table in_tab
to capture the variable name and its value.
7. Similary, to return the values,
we have to put one record (for each variable)
in out_tab.
regards,
amit m. -
Hi All,
Can we use loop in sapscript editor,if yes then plz tell me how.
Thanks in advanceHi Sheelesh,
See below it..
You find loop statement in sapscript.
REPORT ZSUR9.
TABLES:ZST2.
DATA: LANG LIKE SY-LANGU.
Data: itab LIKE zst2 OCCURS 0 WITH HEADER LINE.
select * from zst2 into TABLE itab.
call function 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZFORM4'
LANGUAGE = LANG
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
CODEPAGE = 11.
call function 'WRITE_FORM'
EXPORTING
ELEMENT = 'ZS1'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9.
LOOP at itab.
call function 'WRITE_FORM'
EXPORTING
ELEMENT = 'ZS2'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9 .
ENDLOOP.
call function 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5 .
Reward if useful,
Regards,
S.Suresh. -
How to convert sapscript to excel & send it as attachment in mail?
Hi,
I have a requirement to send the customer statement in excel format with all open items to the customer email address. I am creating the customer statement via sapscript . Then I need to convert that into excel. I tried using CONVERT_OTF. But alignment is not coming properly. I have logo also in the script. That also I want in the excel . When I send the mail, the data is not showing correctly
Has anyone worked in similar scenario? Please tell me what are the ways for doing this?
Thanks in advance,
Jissa.HI,
For sending script output through email
Please check this code it may help u.
FORM send_mail USING p_y16m_rcp_par STRUCTURE y16m_rcp_par.
Have a subject for the mail
g_s_document_data-obj_name = text-t02.
g_s_document_data-obj_descr = text-t03.
Fill receiver information
g_s_receivers-rec_type = p_y16m_rcp_par-rec_type.
g_s_receivers-rec_id = p_y16m_rcp_par-rec_id.
g_s_receivers-express = 'X'.
APPEND g_s_receivers TO g_t_receivers.
Call function to send mail
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = g_s_document_data
document_type = 'RAW'
PUT_IN_OUTBOX = ' '
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
OBJECT_HEADER =
object_content = g_t_object_content
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
receivers = g_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
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " SEND_MAIL
Regards,
Pavan. -
Data Manipulation within SAPscript
Hi All,
I need to change weight from Kg to Tonnes within SAP script form. Can you let me know how can it be done? Is there any command or statement in SAPscript that i can use?
Actually a standard SAP driver program is creating the form and i am required to print weight of material in tonnes rather than in Kg which SAP driver program is giving me directly.
I am new to SAPscript so pls elucidate.
Thanks in advance,
Ananyacopy the standard form in to z form....
and change as per ur requ...........
and assign that zform to the standard print program....through NACE trancation....
if it is usefull....Plz Reward
Regards
Anbu -
Is Query possible in SAPSCRIPT
I want to use select statement inside SAPSCRIPT .
Is it possible ?Yes so in subroutine you can always pass the value and then write the select in subroutine and then pass the value back to sapscript.
-
I want to print a statement usin sapscript but its not printing. when i go to my own spool requests to view the log its giving an error message saying "Output device not available". May you please help
HI,
In most cases, the SAP System already provides the appropriate device type for the printer type for the printer model that you want to use.
These standard device types are completely defined and need no modification or extension before you use them in device definitions.
· You can also download missing device types from the sapserv server. For a current list of the supported device types, see SAP Note 8928 in the SAP Service Marketplace.
· Most printers can be controlled using a generic format, such as PostScript. They can be switched to a mode that is compatible with one of the standard printers for which an SAP device type is available. In this case, a supported model is emulated.
· Almost all printers are delivered with Microsoft Windows printer drivers. The system can control these printers with the generic (device-independent) device type SWIN. The Microsoft Windows spool system then performs the processing of the print data.
· If the specified device types are not available, and generic device types cannot be used, you must create your own device type or edit a copy of an existing device type. We recommend that only those with specialist knowledge of the SAP Spool System and printer driver code do this.
if you want to define a new device type
http://help.sap.com/saphelp_nw04s/helpdata/en/d9/4a956e51ea11d189570000e829fbbd/content.htm
For printing guide
http://help.sap.com/saphelp_nw04s/helpdata/en/d9/4a8eb751ea11d189570000e829fbbd/content.htm
Regards
Sudheer -
Hi all,
User claimed that simplified chinese characters in Customer Statement forms (SAPscript ), are thin in font, and light in color, if compare to some English characters and Numeric characters on the same page, after printed out (hardcopy). However, when print preview it, everything is fine.
I am using font family, CNHEI, in SAPscript , and my printer (device type) has setup with font families, CNHEI and CNSONG respectively.
Can anyone advise of why simplified chinese characters (CNHEI and CNSONG) are thin in font, and light in color as opposed to some normal English characters and Numeric character on the same page? Any resolution for the above mentioned?
FYI, I am using SAP 4.6C.
Thanks and best regards,
PatrickHi Patrick,
Check whether the font size which you are using ( eg. 8 or 12 etc) is available in SE73 against the font CNEI etc.
If its not available, then SAP converts the font to some other font which has the size 8 or 12 etc.
To check whether the font is converted, use following steps :-
1. Goto transaction SP01 and enter the Spool request number -> Execute
2. Tick the check box on left of the spool number
3. Goto -> Display Requests -> Settings -> Change the DISPLAY MODE from Graphical to RAW and come back to Spool list screen
4. Click DISPLAY CONTENTS
5. Now you can check the actual FONT used by SAP during printing
a. If Font is converted from say TIMES to some other font, then Upload necessary font through SE73 transaction - True Type Font Installation
b. If Font size - 16 is to be created then goto SE73 transaction -> Printer Fonts -> Change -> Double click the printer -> Select the font and click on New.
Specify the Font family, size, Bold, Italic as per you requirement.
I assume that the printer supports necessary fonts.
Best regards,
Prashant -
hi all,
Can i write a loop or a statement similar to that in an SAP scripts.
If yes how?
thanks
regards
nayanI did not understand your question correctly..
If you want to write a loop statement in SAPscript then you have to write it down in your driver program, there is no other way you can loop your internal table inside form.
Ex:
OPEN_FORM.
LOOP AT <itab>
WRITE_FORM
ENDLOOP.
CLOSE_FORM
Regards,
SaiRam -
How to clear fields used in SAP SCRIPT
hi all,
i want to clear all fields which i have printed on my sap script.
i have passed the values to these fields by useing function module
'TEXT_SYMBOL_SETVALUE' in se38 abap program.
i have also used clear statement in my abap program to clear those fields but it cant working. is there any statement in SAPSCRIPT to clear fields.
if so then please give me its an urgent.
thanks in advance.
Vinod.hey,
I understand that in a text-symbol when u set the values once, then u print them. for the second time when u want to print with diff values, then it will automatically get refreshed when u open it again.
So use code like this.
PERFORM OPEN_FORM USING FORMNAME.
PERFORM WRITE_FORM USING TEXT_SYM.
PERFORM CLOSE_FORM
for the next run...
at this instant all the text elements will get refreshed.
PERFORM OPEN_FORM USING FORMNAME.
PERFORM WRITE_FORM USING TEXT_SYM.
PERFORM CLOSE_FORM
Cheers,
Sam -
Printing standard text with TAB
Hi Folks,
I am very new to SAP Scripts and need some help here. I am printing some text using Standard Text object (using INCLUDE statement in sapscript). But now I want to print the text after a TAB. I tried with below syntax but no luck.
/: ,,INCLUDE ZTEXT OBJECT TEXT ID ST
Request you to please suggest some approach.
Thank you.
Regards,
SudThanks Christian !
Yes, m using SO10 for creating this text.
But as u suggested, I cannot use tab in ZTEXT, because this will affect the alignment for all the other scripts where I am using this ZTEXT.
For every other script, I do not need this extra tab before the ZTEXT. Only for this one script I want to intorduce a Tab before printing this ZTEXT.
Any other approach?
Thanks
Regards,
Sud
Maybe you are looking for
-
Ok, so. My Uncle recently gave my family an itouch that he had owned previously. Which meant that it came complete with applications and music and such. But as I found out my uncle has a very different taste in music than us, so I am trying to add my
-
Mountain Lion notification center shows no events/items at all!
Okay, so, I've updated Lion to Mountain Lion. I've gone into the Notifications area in the system preferences area and everything is enabled. I've swiped my fingers across to pull the notification window into view. I've sent myself an e-mail from my
-
Can I add or change sections of the template chooser window?
I would like to add more sections that just "My Templates". Anyone know how. I tried to do it in library but wasn't sucessful yet.
-
How to get plugin file for After Effects CC 2014 (just bought creative cloud)
I just bought Creative Cloud, installed it, and then went to the Adobe site to install After Effects, since I couldn't find a way to do this on the CC menu. I have Mac OSx. I downloaded the After Effects CC 2014 app and it installed it onto my deskto
-
[REQUEST] smokinguns, smokinguns-data, smokinguns-mappack
There already is a "smokinguns" package in the AUR, but it's a 32-bit binary and it's the same as the smokinguns-bin package, and unmantained. What's needed is a smokinguns package built from source, smokinguns-data and additionaly smokinguns-mappack