Calling ABAP from SAPScript
Hi ,
I am facing some problem in calling a subroutine from Standard Text element (Txn SO10).
I have done the following in a text element.
/: DEFINE &GD_PREV_NAME& = ''
/: PERFORM GET_PREV_NAME IN PROGRAM ZTEST
/: USING &P0001-PERNR&
/: USING &P0002-BEGDA&
/: CHANGING &GD_PREV_NAME&
/: ENDPERFORM
In the ABAP ZTEST,
FORM get_prev_name TABLES tabin STRUCTURE itcsy
tabout STRUCTURE itcsy.
DATA : ld_pernr LIKE pa0001-pernr.
READ TABLE tabin WITH KEY name = 'P0001-PERNR'.
IF sy-subrc = 0.
ld_pernr = tabin-value.
ENDIF.
ENDFORM.
I found in debugging that the both tables TABIN & TABOUT are empty in the FORM get_prev_name !!!!
Can anyone hint on why the values are not passed to ABAP ??
Many thanks in advance.
Regards,
Sandip.
Ph : +44 121 683 2814.
Hi Sandip,
I guess the problem here might be that the values aren't getting flown.
First try this (hardcoding and testing),
/: DEFINE &GD_PREV_NAME& = ''
/: PERFORM GET_PREV_NAME IN PROGRAM ZTEST
/: USING '1000'
/: USING '20050101'
/: CHANGING &GD_PREV_NAME&
/: ENDPERFORM
if it works fine, then figure out whether the variables P0001-PERNR AND P0002-BEGDA are not null when passed. If not then try this
/: DEFINE &GD_PREV_NAME& = ''
/: PERFORM GET_PREV_NAME IN PROGRAM ZTEST
/: USING &P0000-PERNR&
/: USING &P0002-BEGDA&
/: CHANGING &GD_PREV_NAME&
/: ENDPERFORM
ELSE TRY PA0000-PERNR AND PA0002-BEGDA
Cheers,
Sam.
Similar Messages
-
How to Call Function from SAPSCRIPT
I want to Call a function from my SAPSCRIPT to get some data and print the same in the form , Can I get an example for this
Hi Nandan,
U cannot directly call function from SAPScript... For that u have to create one include in which u need to write the code. Using Perform... EndPerform u can call the same from SAPScript. See the below example
u need to write this code in SAPScript
PERFORM formname IN PROGRAM includename
USING &field1&
USING &field2&
CHANGING &field3&
ENDPERFORM
Here includename is your include type program.
u need to write this code in your include type program..
FORM formname TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
data : var1 like field1,
var2 like field2,
var3 like field3.
READ TABLE in_par WITH KEY 'field1'.
CHECK sy-subrc = 0.
var1 = in_par-value.
READ TABLE in_par WITH KEY 'field2'.
CHECK sy-subrc = 0.
var2 = in_par-value.
now u can call corresponding function using local VAR1 and VAR2. Here u can pass N no of USING parameters.
After processing on VAR3...
READ TABLE out_par WITH KEY 'field3'.
out_par-value = VAR3.
MODIFY out_par INDEX sy-tabix.
EndForm.
Here in_par and out_par are the structures which will be used to communicate with SAPScript. And this is the only way as per my view.
I m sure this code will work fine. Here i have used dummy variables that u need to change as per your requirement. If u have more queries write me back.
And yes if this works than dont forget to give the points.
Regards,
Sagar -
Can any one help me in calling an ABAP program from Java.
The version of SAP with me is 4.7.
Thanks in advance.
Regards ,
Nagaraju DonikenaTo call ABAP from Java when I tried doing it from sample code given in help I was getting the following error. Can any one help in this regard.
Exception in thread "main" java.lang.ExceptionInInitializerError: JCO.classIniti
alize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjco
rfc in java.library.path]. java.library.path
at com.sap.mw.jco.JCO.<clinit>(JCO.java:735)
at TestConnect.<init>(TestConnect.java:8)
at TestConnect.main(TestConnect.java:25) -
Hi. how to create Subroutine Pool and call it from sapscript
HI,
Can anyone tell is there any standard subroutine pool available which could fetch the customer number.
how to create an subroutine pool and call it from the sapscript..
please help me
Advance Thanks..
Guhapriyan.Hi Guhapriyan,
1. Create a FORM in your program.
2. call it from sapscript using
/: PERFORM GET_COMPANY_INFO IN PROGRAM YHRR_OFFER_CONTRACT_FORM
/: USING &P0001-BUKRS&
/: CHANGING &COMP_NAME&
/: ENDPERFORM
3. The form in your program should be of the following parameters only.
form GET_COMPANY_INFO tables IN_PAR structure ITCSY
OUT_PAR structure ITCSY.
(important is IN_PAR, OUT_PAR -
where in your read the values passed,
and pass back the values
thru internal table using varname, varvalue)
regards,
amit m. -
Calling subroutines from SAPScript
Hi all,
I have added a piece of code in my MAIN window which calls a subroutine in another program. This works just fine. However, when I moved the code from one <b>window element</b> of MAIN to another, the code is no longer triggered.
What causes this to happen? Is it related to the calling of function module WRITE_FORM in the application program? Any ideas?
All helpful answers will be rewarded!
Regards,
M.V.Hi,
In some case we need to do some mathematical operations in scripts !! Those things we cant do in Script Editor !! thats y the subroutines are there in scripts !!
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.
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.
Regards
Rama.Pammi -
Hi All,
Can anyone pls tell me how can we call an ABAP report from a WAD report.
We have a requirement that is when we click on a tab in a WAD report it should go to the system and execute a ABAP Report.
Pls reply ASAP.
Thanks
KapilHi All,
There is a small change in the requirement..
I'll brief you with the entire scenario again.
We have a reporting requirement that we were not able to achieve through BEx or WAD. So we decided to write a ABAP report for this. Since all the other reports are made in WAD.. we want this report also to be executed through WAD ie. when we execute this particular Web Template it should actually take us to the system and execute the ABAP report.
Pls give your suggestions on achieving this.
Thanks
Kapil -
Hi,
Can anybody give me some info of how to call an ABAP program from a C program.
Thank You,
SB.Hi,
You can use DCOM Connector to generate C program based in BAPI or RFC.
Read about connectors in service.sap.com/connectors -
Problem in calling ABAP Subroutine from SAPSCRIPT
Hi,
I need to get the reason for cancellation of a Business Even in Training & Event Management module, so I am passing Emp_id.
But the reason(CAAATRT) is returned with blank by the code.
please help.
/:DEFINE &EMP_ID&= &PPVAR-TOBJD&
/:PERFORM HR_REASON_PRINT IN PROGRAM ZHR_REASON_PRINT
/:USING &EMP_ID&
/:CHANGING &CAATRT&
REPORT ZHR_REASON_PRINT.
DATA : BEGIN OF in_par OCCURS 10.
INCLUDE STRUCTURE itcsy.
DATA : END OF in_par.
DATA : BEGIN OF out_par OCCURS 0.
INCLUDE STRUCTURE itcsy.
DATA : END OF out_par.
DATA: TOBJD TYPE PPVAR-TOBJD,
ADATANR TYPE HRP1001-ADATANR,
CAATR TYPE HRPAD25-CAATR,
CAATRT TYPE T77CART-CAATRT,
EMP_ID TYPE C.
TABLES : PPVAR,
HRP1001,
HRPAD25,
T77CART.
FORM HR_REASON_PRINT TABLES input output.
in_par[] = input[].
out_par[] = output[].
READ TABLE in_par INDEX 1.
CHECK sy-subrc = 0.
TOBJD = in_par-value.
MOVE in_par-value TO TOBJD.
SELECT ADATANR
into ADATANR
FROM HRP1001
WHERE OBJID EQ TOBJD.
ENDSELECT.
SELECT CAATR
into CAATR
FROM HRPAD25
WHERE ADATANR EQ ADATANR.
ENDSELECT.
SELECT CAATRT
INTO CAATRT
FROM T77CART
WHERE CAATR EQ CAATR.
ENDSELECT.
REFRESH out_par.
out_par-name = 'DREASON'.
move CAATRT To out_par-value.
MODIFY out_par INDEX 1.
APPEND out_par.
output[] = out_par[].
Thanks
RamakrishnaHi ramakrishna,
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. -
Sapscript calling forms from program
Hi experts
I need to write a form in a program to get values.
Here is my code. But i cant seem to succesfully compile it. Need help. I want to take
ernam from sapscript and send name and lastname back. Can u please fill the function.
Also i have an error says itcyy is not a structure ?
thanks.
REPORT ZME23N_SAPSCR_FM.
tables : user_Addr.
form get_Values TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
*READ TABLE IN_PAR WITH KEY 'ERNAM'.
*data firstname like user_addr-name_first.
*select single * from user_Addr
*where bname = ernam.
*firstname = user_Addr-name_first.
*lastname = user_addr-name_last.
endform.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. -
Is it possible to call website from ABAP Program?
Hi Experts,
Is it possible to call website from ABAP Program?
It is very Urgent Help me.
Regards,
Ashok.Hi,
Check the following program:
REPORT ZURL NO STANDARD PAGE HEADING.
DATA: BEGIN OF URL_TABLE OCCURS 10,
L(25),
END OF URL_TABLE.
URL_TABLE-L = 'http://www.lycos.com'.APPEND URL_TABLE.
URL_TABLE-L = 'http://www.hotbot.com'.APPEND URL_TABLE.
URL_TABLE-L = 'http://www.sap.com'.APPEND URL_TABLE.
LOOP AT URL_TABLE.
SKIP. FORMAT INTENSIFIED OFF.
WRITE: / 'Single click on '.
FORMAT HOTSPOT ON.FORMAT INTENSIFIED ON.
WRITE: URL_TABLE. HIDE URL_TABLE.
FORMAT HOTSPOT OFF.FORMAT INTENSIFIED OFF.
WRITE: 'to go to', URL_TABLE.
ENDLOOP.
CLEAR URL_TABLE.
AT LINE-SELECTION.
IF NOT URL_TABLE IS INITIAL.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
program = 'C:\Program Files\Internet Explorer\IEXPLORE.EXE'
commandline = URL_TABLE
INFORM = ''
EXCEPTIONS
PROG_NOT_FOUND = 1.
IF SY-SUBRC <> 0.
WRITE:/ 'Cannot find program to open Internet'.
ENDIF.
ENDIF.
Regards,
Bhaskar -
Hi All,
I need to invoke a static method of an ABAP class from JCo. Is this possible? I am new to JCo. Any help in this regard is highly appreciated.
Thanks,
PraneethHello Praneeth,
i'm not sure about calling ABAP class method from JCo directly, but there is a possibility to call function module from SAP R3. And the shortest way to do so is described in Re: Accessing SAP backend from j2ee without entrprise portal thread, answered by me.
I guess there is no problem to call an class method from an function module.
Please consider rewording points if helpfull.
regards,
mz -
JCo connectivity is used to call RFCs from Java. can i call Java from abap?
thanks in advance.....
regards,
SundararamaprasadHi Sundar ,
This link will surely give u an idea about calling java fro ABAP using Jco.
http://www.thespot4sap.com/Articles/SAP_Netweaver_Java_Connector.asp
regards,
aravindh. -
I want to execute a BSP from ABAP report. The BSP is the standar CRM CASE MANAGEMENT BSP.
I have a CRM CASE list in ABAP report and when I make double-click on one case i want to call BSP to show this case. I don't want to execute the GUI transaction CRMD_CASE. I need to execute the BSP.Hello Ivan,
To call the BSP from the ABAP report following thread will be helpful for you.
Call BSP from SE38 Program ?
Regards
Aashish Garg
Message was edited by:
aashish garg -
Call workflow from ABAP program
created a zbusiness object (ZPRODH)with
one key field product hierarchy,
one attribute level number and
one method display.
I tested that zobject and using this object created workflow to display product hierarchy ,it is displaying it. now I have to call it from one abap program.
In the abap program I am calling the funcion module, I
CALL FUNCTION 'SWW_WI_START_SIMPLE'
EXPORTING
TASK = TASK
IMPORTING
WI_ID = WI_ID
TABLES
AGENTS = AGENTS
WI_CONTAINER = WI_CONTAINER.
It is calling the workflow and subrc is 0, but not passing the value to the workflow. Because of that the method is not working, any idea?
Thanks in advancettpa,
Please check this thread:
Re: Workflow from abap program
Also check that your Fm do requires any explicit commit or not?
Hope it will help u
Cheers
Jai -
Calling GuidedProcess from WebDynpro ABAP
Hi all
can anybody tell me that how to call GP from webdynpro ABAP.
and what are the advantages and disadvantages in this scenario??
if anyone reply then it would be the great help to me
Regards
Suresh babuHey,
You can call a GP from WD ABAP through by implementing a service call from a method that is embedded in your WD. You can refer this link for the same.
http://help.sap.com/saphelp_nwce10/helpdata/en/44/58f9cc0d95311ce10000000a155369/frameset.htm
But you should note here that Data exchange between ABAP WD and GP is not two way but its only one way.
Cheers,
Mandrake
Maybe you are looking for
-
Running Adobe Acrobat 8.1.2 on Mac Leopard Is there any way to set the marquee zoom tool as the default tool like to be able to open a pdf click an drag to zoom in. Without having to find zoom tool top of page. Can not always keep US Sheetfed Coated
-
Hello everyone, I write for a question. We migrated a db from an old Solaris machine with 10G to an Exadata with 11gR2. Now, we would enable EHCC on tables that are the core of our DWH. In compressing tables and partitions, do we need to make some
-
Hi All, Per the query below, I'd like to ONLY output results from entries from the previous month (in this case it's July) based off SYSDATE. I suspect I need a "WHERE" statement that only returns the previous month. That said, I'm having a heck of a
-
Discovered 1st problem with z1 barely a week old
the volume is already weak enough so i always put it to max volume. but then when i receive incoming calls sometimes the volume is max sometimes it is weak. i do know know if this is a hardware problem or a loose wire. it is 4 days old. do replace it
-
N73 me full character keymap:::: info
i want to know about all the keymap numbers those are assigned against every key on n73me. my fw version: v4.0839.42.2.1 RM-133 like this:: (probably it is for n95) key_1 "key 49" key_2 "key 50" key_3 "key 51" key_4 "key 52" key_5 "key 53" key_6 "ke