Debuggin External subroutine in sapscript
Hi Gurus,
I need to debug external soubroutine written in sapscript.i am not getting how to proceed for this.please help me.
Regards
Sam
Moderator message: sapscript debugging = FAQ, please search before posting.
Edited by: Thomas Zloch on Oct 27, 2010 1:25 PM
Hi,
I think this may help
Place a break point in your subroutine, now activate the sap script debugger.
Press F5 and continue debugging in sap script once it reaches the statement where the routine is called it will take you to the code.
regards
Similar Messages
-
External subroutine in sapscript
hi all
can anyone explain me how to handle an external subroutine in a script with a simple example.
rg
sandeepHi Sandeep,
Try this :
Use PERFORM from SAPSCRIPT
/: PERFORM BIN_LOCATION IN PROGRAM Z_SAPSCRIPT_PERFORMS
/: USING &RESBD-MATNR&
/: USING &CAUFVD-IWERK&
/: USING &RESBD-LGORT&
/: CHANGING &MARD-LGPBE&
/: ENDPERFORM
REPORT z_sapscript_performs.
SUBROUTINES FOR CALLING FROM SAPSCRIPTS
FORM bin_location TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
get default bin location from MARD for this material/plant/storage *
location
DATA: l_matnr TYPE matnr, "material
l_werks TYPE werks, "plant
l_lgort TYPE lgort, "storage location
l_lgpbe TYPE lgpbe. "bin location
Get first parameter in input table.
READ TABLE in_tab INDEX 1.
WRITE in_tab-value TO l_matnr .
Get second parameter in input table
READ TABLE in_tab INDEX 2.
MOVE in_tab-value TO l_werks.
Get third parameter in input table
READ TABLE in_tab INDEX 3.
MOVE in_tab-value TO l_lgort.
read bin location
SELECT SINGLE lgpbe INTO l_lgpbe FROM mard
WHERE matnr = l_matnr
AND werks = l_werks
AND lgort = l_lgort.
IF l_LGPBE IS INITIAL.
l_LGPBE = 'NONE'.
ENDIF.
read & update only parameter in output table
READ TABLE out_tab INDEX 1.
out_tab-value = l_lgpbe.
MODIFY out_tab INDEX 1.
ENDFORM.
Regards,
Lanka -
SAPscript external subroutine - select not pulling data
Hi all,
I am calling an external subroutine in my SAPscript. In this subroutine, I am using a simple select statement:
* get sales order number
SELECT vbelv posnv
FROM vbfa
INTO CORRESPONDING FIELDS OF TABLE it_so
WHERE vbeln = gv_deldoc
AND posnn = gv_posnr.
The problem is no data is being pulled into it_so. I have confirmed in VBFA (through SE16N) that data exists in the system so this isn't the problem. Are there restrictions with using selects in SAPscript?
Thanks,
Edited by: pistols123 on Sep 8, 2011 9:11 PMHi,
Please refer below code.
In SAP Script ,SE71: call the subroutine pool program with the below sysntax.
/: PERFORM GET_DATA IN PROGRAM ZXXXX
/: USING &XXXX-MATNR&
/: CHANGING &V_YYYY&
/: CHANGING &V_YYY2&
/: ENDPERFORM
Using Parameter will be the input in the subroutine pool to fetch the data.
Changing Paramter will be the your output to pass the data into SAP Form.
now goto SE38,and create a subroutine pool program with the name ZXXXX,follow the below code.
FORM get_data TABLES tbl_in STRUCTURE itcsy
tbl_out STRUCTURE itcsy.
READ TABLE tbl_in INDEX 1.
IF sy-subrc EQ 0.
XXXX-Matnr = tbl_in-value.
"Pass it through the conversion exit CONVERSION_EXIT_ALPHA_INPUT before SELECT."
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gv_deldoc
IMPORTING
OUTPUT = gv_deldoc
SELECT vbelv posnv
FROM vbfa
INTO (l_vbelv,l_posnv)
WHERE vbeln = gv_deldoc
AND posnn = gv_posnr.
READ TABLE tbl_out INDEX 1.
IF sy-subrc = 0.
MOVE l_vbelv TO tbl_out-value.
MODIFY tbl_out INDEX 1.
ENDIF.
READ TABLE tbl_out INDEX 2.
IF sy-subrc = 0.
MOVE l_posnv TO tbl_out-value.
MODIFY tbl_out INDEX 2.
ENDIF.
Moderator message - Welcome to SCN. But please do not ask for "rewards"
Regards,
VSNM
Endform.
Edited by: Rob Burbank on Sep 8, 2011 4:18 PM -
Script external subroutine for multiple fileds display
Hi,
can anybody tell
how to write external subroutine in script.
i want to display multiple fields data in script by using external subroutine.
Regards,
Kumar.HI,
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.
Definition in the SAPscript form:
/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM -
my subroutine is written in one program.
I m using it in another program.
i checked with the breakpoint...
The control goes to the subroutine fetches the data in the structure but when the control returns to the main program the structure is empty.
Now wat should i do either write the routine in the same program or have to use import & export memory which is best based on performance.hi
let us also the location of the subroutine..i mean in differnt client no or in the same. If the subroutine is in the same client no..then you can use the Perform statement in the sapscript to call the extra functionality from the print program or in any location but with in the same system(client).
In case of external subroutine, i think you need to use the client-specified statement in the print program while selecting the data.
eg.
select f1
f2
f3
from zzkna1
into i_tab
cleint-specified where mandt = <client no from where you are fetching the data>
this may work.
regards,
shamim. -
Bonjour,
Je cherche à créer un installer portatif utilisant les drivers NI-DAQmx 8.7.1 et NI-CAN 2.6.0.
Je dispose d'un code LV 7.1 et j'ai installé l'application builder 7.1.
Mais une fois l'application installé sur un PC vierge de Labview, j'obtiens le message suivant:
load error code 21: An external subroutine required for execution could not be found.
Ce message est répété plusieurs fois (pour différents VIs) puis le programme ne se lance pas.
J'ai bien veillé à installer les drivers NI-CAN et NI-DAQmx correspondant au préalable sur la machine cible.
En chercant sur le forum, plusieurs pistes m'ont été proposé:
La version NI-DAQ
L'intégration du Run time Engine
Un problème de DLL
J'ai vérifié ces 3 points mais cela n'a pas règlé mon problème.
Résolu !
Accéder à la solution.Bonjour,
Merci de ta réponse.
En fait, j'ai bien inclu le runtime engine de Labview qui était effectivement la source de l'erreur.
L'installation de NI-DAQmx v 8.7.1 provoque la mise à jour de la version du runtime engine (passage de 7.1 à 7.1.1).
J'ai donc désinstallé Le runtime engine 7.1.1 (ce qui a provoqué la désinstallation de labview et NI-DAQ).
Puis je suis passé par une version plus ancienne de NI-DAQ (7.2) que j'ai adapté (inclusions de DLL et de VIs).
Les messages d'erreurs ont alors tout simplement disparus! -
Subroutine in sapscript for net due date
Hi,
This is the first time I am creating a subroutine for sapscript and I could not get it to work. I need to calculate the net due date using the baseline date plus cash discount days. But the form is just printing out 0000000. I am just trying to extract one due date here but I will have to get it for all line items then sort descending to get the latest one. Can anyone help me to see the gap why this is not working?
In the sapscript I have the following:
DEFINE &BASEDATE& = ®UP-ZFBDT&
DEFINE &PAYTERMS& = ®UP-ZBD1T&
PERFORM NET_DUE_DATE IN PROGRAM Z_SAPSCRIPT_FUNCTIONS
USING &BASEDATE&
USING &PAYTERMS&
CHANGING &DUEDATE&
ENDPERFORM
In program Z_SAPSCRIPT_FUNCTIONS
Thanks in advance!
CholenHi Raju!
I am really getting close! I did the conversion for all variables, however for VBLNR, it does not work. It gives leading zeroes but the value starts with a 'P' before the zeroes and the numeric value. I tried to remove that from the where clause and my select finally got something. However the output on the form is in the internal format. I suppose I should use CONVERT_DATE_TO_EXTERNAL which I tried doing after out_tab-value = lv_netduedate which is the variable I am passing to the form.
Raju Shrestha wrote:
Hi Cholen,
I believe your lv_laufd is a 10 character field in format MM/DD/YYY or DD/MM/YYYY. You should move that data to a 8 character variable (say lv_date) in YYYYDDMM format.
Please try this conversion
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = lv_laufd
IMPORTING
date_internal = lv_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
Check in debug, you should get lv_date in YYYYMMDD. Now use lv_date in your WHERE clause.
If you still do not get data after lv_date eq YYYYMMDD, check your LIFNR and KUNNR. They should be 10 charaters with leading zeroes if not 10 .
If needed use the conversion for lv_lifnr and lv_kunnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
date_external = lv_lifnr
IMPORTING
date_internal = lv_lifnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
date_external = lv_kunnr
IMPORTING
date_internal = lv_kunnr.
Cheers,
Raju. -
Select-options as a external subroutine
hi all,
plz solve my problem.
this is my first program.
tables vbak.
select-options x for vbak-vbeln.
types : beginf of ty,
a tupe vbak-vbeln,
b type vbak-ernam,
end of ty.
data : itab type table of ty,
wa type ty.
perform sub(znava) using x.
this is my secomd program
report znava.
form sub using x.
select vbeln ernam from vbak into table itab where vbeln in x.
loop at itab into wa.
write :/ wa-a,wa-b.
endloop.
endform.
in the above two programs are separate,and i am using external subroutine but it will show some error how can i rectify.
anyone plz guide me.
thanks and regards,
navneeth.
Edited by: Navaneetha KRISHNAN on Feb 19, 2008 5:50 PMFirst of all SELECT-OPTIONS are TABLE type.
You just can't use USING keyword, you've to use TABLES keyword.
second point is,, in your second program are you defining ITAB and WA??? otherwise second program is not going to identify ITAB & WA... so I suggest you try like this..
"program 1.
TABLES vbak.
SELECT-OPTIONS x FOR vbak-vbeln.
PERFORM sub(znava) TABLES x .
"program 2
TYPES : BEGIN OF ty,
a TYPE vbak-vbeln,
b TYPE vbak-ernam,
END OF ty.
DATA : itab TYPE TABLE OF ty,
wa TYPE ty.
FORM sub TABLES x.
SELECT vbeln ernam FROM vbak INTO TABLE itab WHERE vbeln IN x.
LOOP AT itab INTO wa.
WRITE :/ wa-a,wa-b.
ENDLOOP.
ENDFORM. "sub -
Using HR_INFOTYPE_OPERATION in external subroutine for Dynamic Actions
Hi,
I am calling an external subroutine in the Dynamic Actions of an Infotype. In this external subroutine, I am using HR_INFOTYPE_OPERATION to modify OTHER records of the same Infotype number.
However, when I tried to trigger the Dynamic Actions in PA30, the other infotypes get modified as intended. But when I refreshed the PA30 screen, the changes were reversed back as if the HR_INFOTYPE_OPERATION were not carried out at all. I have COMMIT WORK after the HR_INFOTYPE_OPERATION, refreshed the buffer. But it doesn't seem to work.
My question is: Can i use HR_INFOTYPE_OPERATION in an external subroutine which is called during dynamic actions? As I have some complicated logic, I do not want to embed the coding in the Dynamic Actions. Is there a way for HR_INFOTYPE_OPERATION to work in the external subroutine with the changes being committed to the database?
Thank you.Hi,
I remember the same problem being faced by some of the forum members.
Suresh Datti had replied that "Call the subroutine in a nother program using a SUBMIT statement. This will create two sessions and will update the DB". This was working fine for the users.
Hope you can try this.
Just call a program using SUBMIT statement and code your form routine inside that.
Hope this helps you.
Regards,
Subbu. -
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. -
Build Applicatio​n problem // external subroutine
Hey,
i was build an stand alone application (.exe) and i have a problem with external subroutine to subVi.
I was trying to add the missing .llb as support file in Source Files but still doesnt work.
It works on my computer, on another computer doesnt work (please look attached file)
I have LV 7.1.
I read on forum about this problem and i didnt find any solution for me.
Thanks for help.
Attachments:
missingSubVi.JPG 12 KBcrossrulz wrote:
Mark, a lot of things changed going to LabVIEW 8. LabVIEW 7 didn't have projects or the fancy build specs. I don't have LabVIEW 7 anywhere, so I can't play around in the menus of the very old build dialog.
I know a lot has changed. I don't recall myself exactly how LV 7 build specs looked. It should have some type of similar option though.
If it doesn't the OP may need to be very specific with his paths for calling the dynamic VIs and makes sure he distributes them and place them into the correct directory where his application will access them.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot -
Visibility of global parameters while working with external subroutines
Hi all,
I am trying to use external subroutines in my current report. But I am not able to access the global variable values of my calling program through the called external subroutines.Please let me know whether the accessibility of global parameters will be possible through the external subroutine calls.Hi Jaya,
It is NOT Possible.
Using the external Subroutine,
1) We can only import some required result only (using the CHANGING option).
2) Or, we can do some other execution on the DB based on the input which we gave as Export
Parameters.
Rgds,
Ramani N -
Passing Currency field to external subroutine from script
Hi,
I am passing one currency field to external subroutine from script. In subroutine we can get that currency in character format. I want to convert that into currency format. how can i do that?
thnk ueasy conversion:
number = character_parameter -
Hi,
Could any one tell me is that possible to use external subroutine. Actually my script is the output of ML83. Driver program which passing the info. to script is Std one. Is there any filed relavent to this driver program is updating when 'Service entry is revoked'. Plz help me out... this is very urgent.
Thanks
Sai.Hi,
'Service entry is revoked' means blocked or released..
Sorry..I am not an expert on Service entry..But I am trying to search for the fields which you are looking for..
Thanks,
Naren -
sir,
Like to know How we pass subroutine in sapscript and how standard texts are added and what is its command and transaction.
Edited by: Alvaro Tejada Galindo on Apr 28, 2008 4:45 PMSubroutines in scripts:
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.
Maybe you are looking for
-
How to Display Purchase Order Number IN G.R.P.O
Hi Guys, i am unable to find solution regarding Getting Purchase order number and displaying in Goods Receipt P.O. Report automatically when we copy from purchase Order ie Copy From button .My problem is we are Expecting Purchase Order Number in Good
-
How to restrict authorization for MMBE
Hi, I need to restrict the authorization for t-code MMBE according to plant wise. Can anybody tell me about the procedure and authorization object used. Regards
-
Rounding - Flash Chart - Stacked Horizontal (Percent)
I have a question about the rounding in the Stacked Horizontal (Percent) Flash Chart I put an example on apex.oracle.com [http://apex.oracle.com/pls/otn/f?p=15:5|http://apex.oracle.com/pls/otn/f?p=15:5] My problem is that the value I should have is n
-
Hi, I work on a migration project : Sybase to Oracle 10g. There are a lot of request INSERT writed in Sybase with data too long to be insert in a table. Example : create table MyTable (txt varchar(10)) insert into MyTable values ('AAAAAAAAAAAAAAAAA')
-
My iTunes appears to be installed on my laptop (25%) and external hard drive (75%). To get it all in 1 place is it simply a copy-paste exercise for the folders?