Use of IF statement in SAP Scripts
Can u tell me how to use IF statement in SAP Scripts.
The problem is
if &sy-tabix& eq '1'
total
else
total1.
endif.
this sy-tabix is not working
i think sy-tabix will not work here....
do like this..
data : vtabix type i.
loop at itab.
vtabix = sy-tabix.
write_form...for the text element..
endloop.
in form layout
/: if &vtabix(c)& eq 1
/:endif
regards
shiba dutta
Similar Messages
-
How to use perform statements in sap scripts
how to use perform statements in sap scripts . and pls send me one progam for this
thnaks
rajaHi Raja,
<b>PERFORM</b> key work is used to include subroutine in sapscript form...
But the processing is lttle bit different form the one we use in ABAP.
Here the paramters passed to form is stored in internal table of name-value table. there are two table one for inbound parameter and other for outbound parameters.
Check out the example below to see how this is used..
<b>Definition in the SAPscript form:</b>
/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM
/ &BARCODE&
<b>Coding of the calling ABAP program:</b>
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.
Hope this is clear to understand...
Enjoy SAP.
Pankaj Singh. -
Hi All,
I have written the below If statement in SAP scripts but when i execute the same the controll doent check the second line entries. If firtst line doesnot satisfy it goes to the else part. Kindly suggest what is wrong in this..
/: IF &T156T-BWART& = '321' OR &T156T-BWART& = '322' OR
/: &T156T-BWART& = '349' OR &T156T-BWART& = '350' OR
/: &T156T-BWART& = '312' OR &T156T-BWART& = '326' OR
/: &T156T-BWART& = '343' OR &T156T-BWART& = '344'.
/: ELSE
/: ENDIF.Hi neha,
Try to use the '/E' fo rnext line
/E->Extended line
Here is a code:
/: IF &T156T-BWART& = '321' OR &T156T-BWART& = '322' OR
/E &T156T-BWART& = '349' OR &T156T-BWART& = '350' OR
/E &T156T-BWART& = '312' OR &T156T-BWART& = '326' OR
/E &T156T-BWART& = '343' OR &T156T-BWART& = '344'.
/: ELSE
/: ENDIF.
Hope this helps you.
Regards,
Rajani -
How to debugg particular statement in sap script
hi friends,
i want to know How to debugg particular statement in sap script.
plz reply.
thanks in advance,
regards
bhaskarhi
execute rstxdbug to activate script debugger...once the driver program reaches open_form, a popup box will come where u can mention the name of a command, call functinon, text element, etc to place a break point...once it gets into the debugging mode, double click on any line to set a break point, after that pressing f8 will get you to that line
if helpful, reward
Sathish. R -
How to use msword as editor in sap script and smart form..
how to use msword as text editor in sap scripts and smartforms..
Hi
Go through the link given below :
Saptechnical. com
tutorials
smartforms
you will find solution for how to use MS word as editior.
Or
Call transaction I18N
go to I18N Customizing -> MS Word as Editor.Choose the Help-Button and follow the instructions.
If transaction I18N is not available in your system yet (see SAP Note 848036), you can also enable this feature via program RSCPINST.
Call transaction SE38, enter program RSCPINST and press F8. On the next screen,select Goto -> Set MS Word as Editor.
With Regard
Nikunj shah -
How to use Symbols or icons in SAP script
Hai ,
I am facing one problem in sap script , I want to display one of my field as icon (or )symbol ( tick mark ) in sap script . how to do . Particular transfer order ( check LTAP table ) having 10 line items . In 8 line items are confirmed ( pquit = 'X') others not confirmed . if LTAP-pquit = 'X' then instead of 'X' i need tick mark symbol .Icons and symbols in SAPscript texts
To print these, use output devices whose device type uses one of the following printer drivers:
· HPL2 (PCL-5 printers, such as HPLJ4, HPLJ5, HPLJ5SI, or HPLJ4000)
· POST (PostScript printers, such as POSTSCPT, or POST2)
· PRES (PRESCRIBE printers, such as KYOFS150, or KYOFS170)
· SWIN (device types SAPWIN/SWIN and country-specific versions)
Icons and symbols in ABAP lists
If you also want to print these characters in lists, you must define an output device with one of the following device types:
· HPLJ4000/HPLJ5000/HPLJ1100: Device types for PCL-5-printers
· KYOFS170: Device type for Prescribe II printers
· POST2: Device type for PostScript Level 2 printers
· SAPWIN/SWIN and the country-specific versions: generic, that is, device-independent device type for printing using Microsoft Windows -
Perform statement in SAP scripts
Hi experts,
My requirement is that I don't want to display line items for particular customer with a particular item category, For this purpose I was asked to create a Z table with fields customer number(KUNNR) and Item category(PSTYV) and I have to make changes only in layout but not in driver program. So how do i do it? How to write preform statement in form layout which satisfies my requirement. And also in this perform statement I have to check if that customer and item category exists in that Z table. If so then I should not display the line item in the output else the line item should be displayed.
Thanks in Adv.
VasuHi,
write this in script (Ex:Main Window)
/: PERFORM GET_COMM_CODE_DESC IN PROGRAM ZVPPACKL
/: USING &VBDPL-MATNR&
/: USING &VBDPL-WERKS&
/: USING &VBDPL-STAWN&
/: USING &VBDKL-ALAND&
/: CHANGING &STAWN&
/: CHANGING &TEXT1&
/* Begin of Insert -- PRAVIKAN -- DV2K933249 -- PR091808
/: CHANGING &W_COMMODITY_EU&
/: CHANGING &W_COMMODITY_DESC_EU&
/* End of Insert -- PRAVIKAN -- DV2K933249 -- PR091808
/: ENDPERFORM
Driver program (ZVPPACKL)
FORM get_comm_code_desc TABLES intab STRUCTURE itcsy
outtab STRUCTURE itcsy.
DATA: stawn LIKE t604t-stawn,
matnr LIKE marc-matnr, "CL060501
werks LIKE marc-werks, "CL060501
land1 LIKE t604t-land1,
text1 LIKE t604t-text1,
w_commodity_eu TYPE stawn, "PR092908
w_commodity_desc_eu TYPE bezei40. "PR092908
READ TABLE intab WITH KEY name = 'VBDPL-MATNR'. "CL060501
matnr = intab-value. "CL060501
READ TABLE intab WITH KEY name = 'VBDPL-WERKS'. "CL060501
werks = intab-value. "CL060501
land1 = intab-value.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = matnr
IMPORTING
output = matnr.
CLEAR: stawn,
text1.
SELECT SINGLE stawn
INTO stawn
FROM marc
WHERE matnr = matnr
AND werks = '3101'.
IF NOT stawn IS INITIAL.
SELECT SINGLE text1
INTO text1
FROM t604t
WHERE spras = 'EN'
AND land1 = 'US'
AND stawn = stawn.
ENDIF.
CLEAR: w_commodity_eu,
w_commodity_desc_eu.
SELECT SINGLE stawn
INTO w_commodity_eu
FROM marc
WHERE matnr = matnr
AND werks = '0010'.
IF NOT w_commodity_eu IS INITIAL.
SELECT SINGLE text1
INTO w_commodity_desc_eu
FROM t604t
WHERE spras = 'EN'
AND land1 = 'GB'
AND stawn = w_commodity_eu.
ENDIF.
READ TABLE outtab WITH KEY name = 'STAWN'. "CL060501
outtab-value = stawn. "CL060501
MODIFY outtab INDEX sy-tabix.
READ TABLE outtab WITH KEY name = 'TEXT1'.
outtab-value = text1.
MODIFY outtab INDEX sy-tabix.
READ TABLE outtab WITH KEY name = 'W_COMMODITY_EU'.
IF sy-subrc EQ 0.
outtab-value = w_commodity_eu.
MODIFY outtab INDEX sy-tabix.
ENDIF.
READ TABLE outtab WITH KEY name = 'W_COMMODITY_DESC_EU'.
IF sy-subrc EQ 0.
outtab-value = w_commodity_desc_eu.
MODIFY outtab INDEX sy-tabix.
ENDIF.
ENDFORM. "GET_COMM_CODE_DESC
Regards
Krishna -
Include statement in SAP Scripts
HI
1)Could you send syntax of logo in header window of layout.
2)We have 2 printers, while i give the print request Purchase order, one printer is working and coming logo along with details of the form, but other printer is working, then logo is not coming in header.Please give me details as early as possible.
Thank you
sriniHi,
Command in your Sapscript
/: INCLUDE Z_YOUR_LOGO OBJECT TEXT ID 'ST' LANGUAGE 'E'
These are the steps to be followed for uploading graphics in R/3 system
1. First save the file as BMP
2. Open the BMP file in IMaging (Goto -> Programs -> Accessories -> Imaging) and
make it Zoom as 100% and save as *.TIFF
3. Open SE38 and execute program RSTXLDMC
4. Give your TIFF file path name
5. Select Bcol (for Color)
6. TEXT ID will be ZHEX-MACRO-*.
7. Inplace of * write your own logo name (ZCOMPANYLOGO)
8. Execute the program
9. Now Goto SE71 create your ZFORM
10. Create logo window
11. Goto text element of logo window
Thanks,
NN. -
Problem in PO SAP Script, producing a PDF format.
Hi,
Description: We have developed a Purchase Order script. Both the Print Program and SAP Script are customised i.e., we are no longer using the standard MEDRUCK. The print preview is fine and when we take a print out the output looks good.
Problem: When the output type is changes to External Send using the Messages tab in the transaction ME23N, the output is given to a PDF file. In this output the vertical lines are not coming properly. The vertical lines are printed using the VLINE statement of sap script.
Solution Required for: Could any one please tell me why are we getting this problem and a possible solution for this.
Code:
M9 &VLINE&,,>_EKPO-EBELP(Z)&,,&VLINE&,,<TX>>_EKPO-IDNLF(C14)&</>
= ,,&VLINE&,,<TX>>_EKPO-TXZ01(C40)&</>,,&VLINE&,,>_EKPO-MENGE(C.0)&
= ,,>_EKPO-MEINS(3)&,,&VLINE&,,
= >_EKPO-NETPR(9.2)&
= ,,&VLINE&,,>_EKPO-NETWR(9.2)&,,&VLINE&
Thanks and Regards,
Raghavendra Goutham.
NOTE: Helpfull answers will be rewarded definitely.Hi,
Best practise is 1st you FRAME the window with boxes.........
Example.....
/* BEGIN OF CHANGE LDEEPAK 09/12/2005.
/: IF &VBDKR-VBTYP& = 'O' OR &VBDKR-VBTYP& = 'S' OR &VBDKR-VBTYP& = '6'.
/: BOX YPOS '0.0' CM WIDTH '25.4' CM HEIGHT '0.85' CM FRAME 4 TW
/: BOX YPOS '0' CM XPOS '4.4'CM WIDTH '0'CM HEIGHT '0.85'CM FRAME 4 TW
/: BOX YPOS '0' CM XPOS '8.35'CM WIDTH '0'CM HEIGHT '0.85'CM FRAME 4 TW
/: BOX YPOS '0' CM XPOS '11.6'CM WIDTH '0'CM HEIGHT '0.85'CM FRAME 4 TW
/: BOX YPOS '0' CM XPOS '19.65'CM WIDTH '0'CM HEIGHT '0.85'CM FRAME 4 TW
B <K>CUSTOMER NO.</> <K> CONTRACT NO. / SALES ORDER NO.</>
= <K> ORIGINAL INVOICE NO.</> ,,<K> CUSTOMER PO.</>
= ,,,,<K>TERMS</>
/: BOX YPOS '3.25'CM WIDTH '25.4'CM HEIGHT '0.95'CM FRAME 0 TW INTENSITY 8
/: BOX YPOS '5.1'CM WIDTH '25.4'CM HEIGHT '0.95'CM FRAME 0 TW INTENSITY 8
/: BOX YPOS '6.95'CM WIDTH '25.4'CM HEIGHT '0.95'CM FRAME 0 TW INTENSITY 8
/: BOX YPOS '8.85'CM WIDTH '25.4'CM HEIGHT '0.95'CM FRAME 0 TW INTENSITY 8
/: BOX YPOS '10.6'CM WIDTH '25.4'CM HEIGHT '0.95'CM FRAME 0 TW INTENSITY 8
Like this you can give commands.
Later you can code for getting the values in to window.
Here while populating the values you need to use TABS to place the value in correct position.
Thanks.
If this helps you reward with points.
Message was edited by: Deepak333 k -
Using Function Module in SAP Script
Dear Friends,
how can i use function modules in sap scripts?. i want to use call function SPELL_AMOUNT in sap script?
in text element using perform statement hw can i use?
Regarding i search related articles but, i am not getting any solution.
Plz help Me.
Regards,
K.S.KannanDear Kanan,
You can do it in two ways:
Way1
your Amount will be in some variable say VAR_AMT1 and want in words in field say VAR_SPELL.
In your report program you can use the function module SPELL_AMOUNT and pass the VAR_AMT1 to it and you will get the words in VAR_SPELL.
So now in your sap script you can use the variable VAR_SPELL to print the amount in words.
we normally use this above method.
WAY2
You are inside Sap script and you can write the following code in the sap Script window.
/: PERFORM AMT_TEXT IN PROGRAM ZF_REPORT USING &VAR_AMT1& CHANGING &VAR_SPELL&
/: ENDPERFORM
In the Tag Column when you press F4 you can see various symbols like
/: = ( / /= /( /: /* /E
. Select
In the program ZF_REPORT (any report) you should have the perform AMT_TEXT where you should use the function module SPELL_AMOUNT to convert the amount into words.
Hope its Clear. -
Sap script perform statement.
hi all,
i have a problem with modifying standard sap script form. i have added a field in the line item of my form using perform statement in sap script. but only the corresponding to last line item is getting displayed for all.please help me on this issue my code and sap script is as follows.
**& Form material_wt
-->IN_TAB text
-->OUT_TAB text
FORM MATERIAL_WT TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
DATA : BEGIN OF IT_MAT OCCURS 0,
ZEILE LIKE J_1IEXCDTL-ZEILE,
MENGE LIKE J_1IEXCDTL-MENGE,
MATNR LIKE J_1IEXCDTL-MATNR,
NTGEW TYPE MARA-NTGEW,
END OF IT_MAT.
DATA : V_DOCNO TYPE J_1IEXCDTL-DOCNO,
V_NTWT TYPE CHAR20.
READ TABLE in_tab WITH KEY name = 'J_1IEXCDTL-DOCNO'.
CHECK sy-subrc = c_zero.
V_DOCNO = in_tab-value.
SELECT ZEILE MATNR MENGE INTO CORRESPONDING FIELDS OF TABLE IT_MAT FROM J_1IEXCDTL
WHERE DOCNO = V_DOCNO AND TRNTYP = '57FC'.
LOOP AT IT_MAT.
SELECT SINGLE NTGEW INTO IT_MAT-NTGEW FROM MARA WHERE MATNR = IT_MAT-MATNR.
modify it_mat.
ENDLOOP.
loop at it_mat.
IF not it_mat[] IS INITIAL.
READ TABLE out_tab WITH KEY name = 'NETWT'.
IF sy-subrc = 0.
V_NTWT = IT_MAT-NTGEW * IT_MAT-MENGE.
CONDENSE:V_NTWT.
out_tab-value = V_NTWT.
MODIFY out_tab INDEX sy-tabix.
ENDIF.
ENDIF.
endloop.
endform.
and my perform statement is as follows,
/E ITEM_VALUES
/: PERFORM MATERIAL_WT IN PROGRAM ZMM_RPT_CHALLAN
/: USING &J_1IEXCDTL-DOCNO&
/: CHANGING &NETWT&
/: ENDPERFORM
I1 &J_1IEXCDTL-ZEILE&,,&J_1IEXCDTL-MATNR&,,&NETWT&answered
-
How we can use Bar codes in Sap-script?
Hi,.
Can any body please tell me how we can use <b>Bar codes in Sap-script</b>?
Please tell me the steps .
Regards,
PrabhuduttaHi,
Check this link
http://help.sap.com/saphelp_nw04/helpdata/en/de/ee0769ebd211d18e370000e83dd9fc/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/d9/4a94fc51ea11d189570000e829fbbd/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/68/4a0d5b74110d44b1b88d9b6aa1315b/content.htm
Regards,
Sonika -
How to write a perform in Sap Script
Hi Guys,
Can anyone let me know how to write a perform statement in Sap Script.
Thanks,
RameshI just took this example from SAP Help
=======================================
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. -
how should i call a perform statement in SAP script
I have been trying to use it in sap script but it is giving me a dump
the code extract looks as follows:
iN DRIVER'S PROGRAM
FORM POP_ADD USING V_parvw like vbpa-parvw.
READ TABLE i_addr WITH KEY WF_PARVW = 'WE'.
ENDFORM.
IN SAP SCRIPT
/: DEFINE &V_PARVW& = &VBPA-PARVW&
/: PERFORM POP_ADD IN PROGRAM ZSD_SCR_INVOICE
/: USING &V_PARVW&
/: ENDPERFORM
/ &i_addr-WF_PARVW&
IT IS GIVING SHORT DUMP SAYING
In a subroutine call, there were more parameters than in the
routine definition.
Error in ABAP application program.
The current ABAP program "ZSD_SCR_INVOICE " had to be terminated because one of
the
statements could not be executed.
This is probably due to an error in the ABAP program.Hi,
The PERFORM in your program should have the following syntax:
FORM POP_ADD TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
READ TABLE in_tab WITH KEY 'V_PARVW'.
CHECK sy-subrc EQ 0.
ENDFORM.
Take a look at http://www.sapfans.com/forums/viewtopic.php?t=131082&highlight=perform for an example of the required syntax.
Hope this helps.
Regards -
Printing address in chinese char- sap script
Hi
I have a requirement to print address in chinese(ZH language).
currently we need to write down the Chinese address manually on envelop if mailing address is in China.
we would like to have the logic for the output. if there is Chinese name/address maintained in customer master, then use Chinese name/address. otherwise, use original English name/address to print on statement.
in sap script they are passing address number to get this address
/: ADDRESS PARAGRAPH AF PRIORITY P LINES 10
/: ADDRESSNUMBER &DKADR-ADRNR&
/: FROMCOUNTRY &T001-LAND1&
/: ENDADDRESS
Anyone help me out
Regards
KumarHi,
you can use this with this format
/: ADDRESS [DELIVERY] [TYPE t] [PARAGRAPH a] [PRIORITY p] [LINES l]
/: TITLE title
/: NAME name1[,name2[,name3[,name4]]]
/: PERSON name of natural person [TITLE form of address]
/: PERSONNUMBER number of the personen
/: DEPARTMENT department
/: STREET street name HOUSE house number
/: LOCATION additional location information
/: POBOX po box [CODE post code / zip code] [CITY city]
/: POSTCODE post code / zip_code
/: CITY city1[,city2]
/: NO_UPPERCASE_FOR_CITY
/: REGION county / state
/: COUNTRY recipient country [LANGUAGE language code]
/: COUNTRY_IN_REC_LANG
/: LANG_FOR_COUNTRY language key
/: FROMCOUNTRY sender country
/: ADDRESSNUMBER address number
/: ENDADDRESS
In detail
COUNTRY_IN_REC_LANG
This flag tells the system to use the recipient language for the country name.
( COUNTRY_IN_REC_LANG u2018Xu2018 )
( Default: Recipient language is not used: COUNTRY_IN_REC_LANG u2018 u2018 )
LANG_FOR_COUNTRY
Default = Space
Use this parameter to explicitly set the language in which to print the country name of a foreign address. By default, the system uses the language of the sending country.
LANGUAGE
Language code of the language of the recipient country, if it differs from that of the recipient COUNTRY. Example: addresses in Switzerland. Standard SAP language codes are used; you can display these in the initial SAPscript text processing screen or in table T002.
FROMCOUNTRY
Specifies the language to be used for formatting the name of the recipient country. For most European countries, the recipient country is specified by placing the international car registration letters in front of the post code and separating them from the post code with a hyphen. You must always specify the sender country.
Maybe you are looking for
-
I saw a post from awhile ago that you can't change the session timeout in iTunes U. Is this still true? Our users are having timeout issues and we have an unfortunately lengthy login process to get back into iTunes U so I had some thoughts on the Sit
-
Billing plan (Downpayment) for saved and open sales orders at header level?
Hi gurus, I have configured billing plan in my SD environment at Item Level. I want to change it to header level. Questions: 1- When I make the changes to update the system to have billing plan at header level for future sales orders, is that possibl
-
Oracle Query Performance While calling a function in a View
Hi, We have a performance issue in one of our Oracle queries. Here is the scenario We use a hard coded value (which is the maximum value from a table) in couple of DECODE statements in our query. We would like to remove this hard coded value from the
-
Preview not showing characters correctly
I've noticed that the vast majority of the time, Preview doesn't properly render special or "foreign" characters. Up / down arrows to denote increases or decreases in items appear as black blocks, and Greek characters do something similar ("µg" rende
-
Variable myConnection might not have been initialized
I'm getting a strange exception I don't understand. Can anyone help me out? "variable myConnection might not have been initialized" DataSource dataSource; Connection myConnection; ResultSet rs; Statement pStmt;