Perform a form routine within a sap script form
Hi!
How can I
perform a form routine within a sap script form.
Regards
sas
OK,
many thanks for your kindly reply.
But basically there is a matter which I don't understand.
Which way is the better way to loop at internal table:
Solution1:
FORM xxx.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
FORM = 'ZSD_PACKING_LIST'
LANGUAGE = SY-LANGU .
LOOP AT gt_versand_plan INTO gw_versand_plan.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'SHELEM'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN' .
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'.
ENDFORM.
Solution 2:
Having the LOOP within the sapscript form -> 'ZSD_PACKING_LIST'
Regards
sas
Similar Messages
-
What is sub routine pool in sap script? when it is used?
hi ,
i am new to sap-abap can any one clarify my doubt .Hi Praveen,
If you modify the sap standard script according to that you have to modify the print program also....
But its not advisable to modify the print program directly so, for the changes what ever u have made in the scripts you have to write the logic in a subroutine with in report program and you have to call this subroutine with PERFORM statement in the scripts.....
Reward points if it is helpful..
Regards,
Omkar. -
Subroutine call from SAP Script
Hi,
I need to calculate required/outstanding qty. hence am passing existing values of reservation#/item# and issued qty.
both req/out qty are returned blank by the code. please help.
Following is my code segment for a external routine call from SAP Script.
/: PERFORM P_GET_QTY IN PROGRAM ZTEST
/: USING &MSEG-RSNUM&
/: USING &MSEG-RSPOS&
/: CHANGING &REQ_QTY&
/: CHANGING &MSEG-MENGE&
/: CHANGING &OUT_QTY&
/: ENDPERFORM
REPORT ztest .
TABLES resb.
DATA: wa_resb TYPE resb,
req_qty TYPE resb-bdmng,
isd_qty TYPE mseg-menge,
out_qty TYPE resb-bdmng.
FORM p_get_qty TABLES input STRUCTURE itcsy
output STRUCTURE itcsy.
DATA: avlbl TYPE resb-bdmng.
READ TABLE input WITH KEY 'MSEG-RSNUM'.
CHECK sy-subrc = 0.
wa_resb-rsnum = input-value.
READ TABLE input WITH KEY 'MSEG-RSPOS'.
CHECK sy-subrc = 0.
wa_resb-rspos = input-value.
READ TABLE input WITH KEY 'REQ_QTY'.
CHECK sy-subrc = 0.
req_qty = input-value.
READ TABLE input WITH KEY 'MSEG-MENGE'.
CHECK sy-subrc = 0.
isd_qty = input-value.
SELECT SINGLE * INTO wa_resb
FROM resb
WHERE rsnum = wa_resb-rsnum
AND rspos = wa_resb-rspos.
CHECK sy-subrc = 0.
avlbl = wa_resb-bdmng - wa_resb-enmng.
req_qty = avlbl - out_qty.
out_qty = req_qty - isd_qty.
output-name = 'REQ_QTY'.
output-value = req_qty.
MODIFY output TRANSPORTING name value WHERE name = 'REQ_QTY'.
APPEND output.
output-name = 'OUT_QTY'.
output-value = out_qty.
MODIFY output TRANSPORTING name value WHERE name = 'OUT_QTY'.
APPEND output.
ENDFORM.
Thanks,
Ram.Hi Ram,
I think you have to use MODIFY instead of append for the OUTPUT table.
MOdify the table with KEY. This should resolve the problem.
Ram, you can check this code and see how the MODIFY is to be used.
REPORT YLSD999A.
DATA W_LENGTH TYPE I.
* GENERAL PURPOSE SUBROUTINES FOR CALLING FROM SAPSCRIPTS
FORM DISPLAY_POUND TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
DATA: COUNT TYPE P VALUE 16.
DATA: W_VALUE(17) TYPE C. "defined as 7 chars to remove pence
DATA: W_CHAR TYPE C.
DATA: W_DUMMY TYPE C.
DATA: W_CURR(3) TYPE C.
* Get first parameter in input table.
READ TABLE IN_TAB INDEX 1.
WRITE IN_TAB-VALUE TO W_VALUE .
* get second parameter in input table
READ TABLE IN_TAB INDEX 2.
MOVE IN_TAB-VALUE TO W_CURR.
IF W_CURR = 'GBP'.
W_CURR = '£'.
ENDIF.
W_LENGTH = STRLEN( W_CURR ).
* look for first space starting at right.
WHILE COUNT > -1.
W_CHAR = W_VALUE+COUNT(1).
* W_CHAR = IN_TAB-VALUE+COUNT(1).
IF W_CHAR = ' '.
COUNT = COUNT - W_LENGTH + 1.
W_VALUE+COUNT(W_LENGTH) = W_CURR.
COUNT = -1.
ELSE.
* W_VALUE+COUNT(1) = W_CHAR.
COUNT = COUNT - 1.
ENDIF.
ENDWHILE.
* read only parameter in output table
READ TABLE OUT_TAB INDEX 1.
OUT_TAB-VALUE = W_VALUE.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDFORM.
Cheers
VJ -
Calling subroutine from SAP script
I am using the below code within my SAP script form that prints GR/GI Slips but its not working. And the only way I can issue the output is from MB02 whcih doesn't seem to allow to call the debuger, so I'm at a lost as to what to do.
Code in SAP script
/: PERFORM GET_BINS IN PROGRAM ZMM_SAPSCRIPT_FORMS
USING &MSEG-MATNR&
/: USING &MSEG-LGNUM&
/: CHANGING &MABDR-LGPBE&
/: ENDPERFORM
CODE from my subroutine program:
FORM get_bins TABLES input_table STRUCTURE itcsy
output_table STRUCTURE itcsy.
DATA: lc_matnr TYPE matnr,
lc_lgnum TYPE lgnum,
lc_lgpla TYPE lgpla,
lc_index TYPE sy-tabix.
* Material no
READ TABLE input_table WITH KEY name = 'MSEG-MATNR'.
MOVE input_table-value TO lc_matnr.
* Warehouse number
READ TABLE input_table WITH KEY name = 'MSEG-LGNUM'.
MOVE input_table-value TO lc_lgnum.
* Get BIN
SELECT SINGLE lgpla INTO lc_lgpla
FROM mlgt
WHERE matnr = lc_matnr
AND lgnum = 'CPT' "lc_lgnum
AND lgtyp = '001'.
IF sy-subrc = 0.
READ TABLE output_table WITH KEY name = 'MABDR-LGPBE'.
lc_index = sy-tabix.
MOVE lc_lgpla TO output_table-value.
MODIFY output_table INDEX lc_index.
ENDIF./: PERFORM GET_BINS IN PROGRAM ZMM_SAPSCRIPT_FORMS
/: USING &MSEG-MATNR&
/: USING &MSEG-LGNUM&
/: CHANGING &MABDR-LGPBE&
/: ENDPERFORM
FORM get_bins TABLES input_table STRUCTURE itcsy
output_table STRUCTURE itcsy.
DATA: lc_matnr TYPE matnr,
lc_lgnum TYPE lgnum,
lc_lgpla TYPE lgpla,
lc_index TYPE sy-tabix.
Material no
READ TABLE input_table WITH KEY name = 'MSEG-MATNR'.
MOVE input_table-value TO lc_matnr.
Warehouse number
READ TABLE input_table WITH KEY name = 'MSEG-LGNUM'.
MOVE input_table-value TO lc_lgnum.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = lc_matnr
IMPORTING
OUTPUT = lc_matnr .
Get BIN
SELECT SINGLE lgpla INTO lc_lgpla
FROM mlgt
WHERE matnr = lc_matnr
AND lgnum = 'CPT' "lc_lgnum
AND lgtyp = '001'.
IF sy-subrc = 0.
READ TABLE output_table WITH KEY name = 'MABDR-LGPBE'.
lc_index = sy-tabix.
MOVE lc_lgpla TO output_table-value.
MODIFY output_table TRANSPORTING VALUE WHERE NAME = 'MABDR-LGPBE'.
ENDIF. -
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. -
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 -
My question is that How to add a report into the SAP-SCRIPT .
by using PERFORM ......ENDPERFORM
I don't know how to used it .Hi Sandeep,
Please check this link
http://help.sap.com/saphelp_40b/helpdata/en/d1/803279454211d189710000e8322d00/content.htm
http://www.allinterview.com/showanswers/37425.html
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.
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 (u2018First pageu2019, u2018Next pageu2019, u2018Last pageu2019) 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 u2018PAGEu2019.
CHECK SY-SUBRC = 0.
PAGNUM = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY u2018NEXTPAGEu2019.
CHECK SY-SUBRC = 0.
NEXTPAGE = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY u2018BARCODEu2019.
CHECK SY-SUBRC = 0.
IF PAGNUM = 1.
OUT_PAR-VALUE = u2018|u2019. "First page
ELSE.
OUT_PAR-VALUE = u2018||u2019. "Next page
ENDIF.
IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = u2018Lu2019. "Flag: last page
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.
Best regards,
raam -
Please help for using perform in SAP script
As subject.
My sap script code as below:
/: PERFORM GET_CHAMT_DATE IN PROGRAM ZRAP004
/:USING &SPELL-WORD&
/:CHANGING &SPELL-WORD&
/:ENDPERFORM
My program ZRAP004 code as below:
FORM get_chamt_date USING u_iword TYPE spell-word
CHANGING u_oword TYPE spell-word.
CONCATENATE u_iword '元整'(t01) INTO u_oword.
endform.
This form is for check printing.
It's by standard function 'F110' to excute check printing.
But when i finished this transaction. System return error message as below:
<b>This routine contains 2 formal parameters, but the current call
contains 4 actual parameters.</b>
Please help. Thanks a lot!!Hiii
PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
/:USING &EKKO-EBELN&
/:CHANGING &CDECENT&
/:ENDPERFORM
The report :
REPORT zkrpmm_perform_z1medruck .
DATA : BEGIN OF it_input_table OCCURS 10.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_input_table.
déclaration de la table output_table contenant les
variables exportées
DATA : BEGIN OF it_output_table OCCURS 0.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_output_table.
DATA : w_ebeln LIKE ekko-ebeln,
w_vbeln LIKE vbak-vbeln,
w_zcdffa LIKE vbak-zcdffa.
FORM CDE_CENT
FORM cde_cent TABLES input output.
it_input_table[] = input[].
it_output_table[] = output[].
READ TABLE it_input_table INDEX 1.
MOVE it_input_table-value TO w_ebeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_ebeln
IMPORTING
output = w_ebeln.
SELECT SINGLE zcdffa FROM ekko
INTO w_zcdffa
WHERE ebeln = w_ebeln.
it_output_table-name = 'CDECENT'.
MOVE w_zcdffa TO it_output_table-value.
MODIFY it_output_table INDEX 1.
output[] = it_output_table[].
ENDFORM. -
Currency field in PERFORM, -- SAP Script
Hi,
I am calling a zperform from SAP Script and sending two currency values as input and after doing subtraction , I want the result value from the Zperform.
When I send 1,000,000.00 as input to PERFORM. I am getting a dump when I try to assign the in_par-value to a currency field in FORM.
The error is "Unable to interpret "1,000,000.00 " as a number." Please let me know how to handle this case. I mean is there any converstion routine to convert the external currency value to internal format?You must remove the commas.
Warren -
How to pass tables data from SAP script to the routine.
Hi,
I have standard program RPCTEAL0_01 which calls a SAP script form(Custom) to print the form.
Now I have to add some additional functionality to change the values in the form. Since it is custom form I can add ROUTINE and then pass the values to the custom program to modify the variables.
My concern here, I would like to pass the tables like RT,CRT to the custom program via form.
Is this possible? RT and CRT filled by standard progam.
Regarsd
Eswar
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Jan 20, 2009 9:06 AMHi, The suggested option is not working.
Actually I am using the below code in SCRIPT
/: PERFORM CAL_2008 IN PROGRAM ZHR_TEST1
/: USING &PER_NO&
/: CHANGING &W12&
/: ENDPERFORM
and calling form in ZHR_TEST1. But this will pass only variables. Now my requirement is to pass tables also. -
hi ,
If I am calling a subroutine from a SAP SCRIPT ....and I want the name of the sap script which is calling it ... means there is a subroutine which more that one script calls ...if I want to find out which one is calling it how can we find that out.for example like sy-cprog or sy-repid..is there anything????? pls adviseHi,
I hereby attach the source code of a pgm which may be used to do a 'search' operation in source code of the SAP Script.Please note that this is not my pgm, I had downloaded from one of the sites. Unfortunately I neither remember the name of teh site nor the name of the author. However I have been using it without any problems.
REPORT ZSEARCH_ITEMS_IN_SAPSCRIPT
NO STANDARD PAGE HEADING LINE-SIZE 208.
*=======================================================================
* Omschrijving : Searching different items (e.g. strings, field, text,
* program-names etc..) in sapscript forms
* Auteur : Angelo Hoppenbrouwer
* Datum : 07-11-2001
*======================================================================*
TABLES: STXL,
TLINE.
DATA BEGIN OF BDCDATA OCCURS 100.
INCLUDE STRUCTURE BDCDATA.
DATA END OF BDCDATA.
DATA BEGIN OF LINES OCCURS 100.
INCLUDE STRUCTURE TLINE.
DATA END OF LINES.
DATA: BEGIN OF STXL_ID,
TDOBJECT LIKE STXL-TDOBJECT,
TDNAME LIKE STXL-TDNAME,
TDID LIKE STXL-TDID,
TDSPRAS LIKE STXL-TDSPRAS,
END OF STXL_ID.
DATA: BEGIN OF KOP,
TXT(208),
END OF KOP.
DATA: I_STXL LIKE STXL OCCURS 10 WITH HEADER LINE,
I_TAB(40) OCCURS 10 WITH HEADER LINE,
CLIENT LIKE SY-MANDT,
H_FIELD(40),
H_VALUE(40),
H_LINE LIKE SY-LINNO,
H_OFFSET TYPE I,
H_REGEL(70) TYPE C,
H_TEL TYPE I,
H_TOT TYPE I,
H_POS TYPE I,
H_POS1 TYPE I,
H_POS2 TYPE I,
H_LEN TYPE I,
VORIGE_TDSPRAS_TDNAME(71) TYPE C,
HUIDIGE_TDSPRAS_TDNAME(71) TYPE C,
P_NAAM LIKE RSEUX-CP_VALUE,
H_TXT1(40),
H_TXT2(40),
H_WINDOW(132),
H_STRING(40),
H_STRING1(40),
H_STRING2 LIKE H_STRING1,
H_LINE1 LIKE LINES-TDLINE,
H_LINE2 LIKE H_LINE1.
SELECTION-SCREEN BEGIN OF BLOCK ZOEK_ITEM
WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: PA_ITEM1 RADIOBUTTON GROUP ITEM DEFAULT 'X'.
SELECTION-SCREEN COMMENT 4(16) TEXT-011.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: PA_ITEM2 RADIOBUTTON GROUP ITEM.
SELECTION-SCREEN COMMENT 4(16) TEXT-012.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: PA_ITEM3 RADIOBUTTON GROUP ITEM.
SELECTION-SCREEN COMMENT 4(16) TEXT-013.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: PA_ITEM4 RADIOBUTTON GROUP ITEM.
SELECTION-SCREEN COMMENT 4(16) TEXT-014.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: PA_ITEM5 RADIOBUTTON GROUP ITEM.
SELECTION-SCREEN COMMENT 4(16) TEXT-015.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK ZOEK_ITEM.
SELECTION-SCREEN BEGIN OF BLOCK ITEM_WAARDE
WITH FRAME TITLE TEXT-002.
PARAMETERS: PA_STR(40) OBLIGATORY,
PA_MANDT LIKE SY-MANDT DEFAULT SY-MANDT.
SELECTION-SCREEN END OF BLOCK ITEM_WAARDE.
SELECTION-SCREEN BEGIN OF BLOCK FORM
WITH FRAME TITLE TEXT-003.
SELECT-OPTIONS: SO_NAME FOR STXL-TDNAME NO INTERVALS
DEFAULT 'Z*'
OPTION CP,
SO_SPRAS FOR STXL-TDSPRAS NO INTERVALS
DEFAULT 'NL'.
SELECTION-SCREEN END OF BLOCK FORM.
START-OF-SELECTION.
CLIENT = SY-MANDT.
CLEAR: H_STRING1, H_STRING2.
IF NOT PA_ITEM1 IS INITIAL. " Standaardtekst
CONCATENATE 'include' PA_STR INTO H_STRING1 SEPARATED BY ' '.
H_TXT1 = 'standard text'.
ENDIF.
IF NOT PA_ITEM2 IS INITIAL. " Tabel (+veld)
CONCATENATE '&' PA_STR INTO H_STRING1.
H_TXT1 = 'table (+field)'.
ENDIF.
IF NOT PA_ITEM3 IS INITIAL. " Hulpveld
CONCATENATE '&' PA_STR '&' INTO H_STRING1.
H_TXT1 = 'variable'.
ENDIF.
IF NOT PA_ITEM4 IS INITIAL. " Programma
CONCATENATE 'in program' PA_STR INTO H_STRING1 SEPARATED BY ' '.
H_TXT1 = 'program'.
ENDIF.
IF NOT PA_ITEM5 IS INITIAL. " String
H_STRING1 = PA_STR.
H_TXT1 = 'string'.
ENDIF.
CONCATENATE '"' PA_STR '"' INTO H_TXT2.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
CONCATENATE 'Use of'
H_TXT1
H_TXT2
'in forms'
INTO KOP SEPARATED BY ' '.
WRITE: / KOP.
ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
WRITE: / 'Clt',
005 'Form',
036 'Lang',
041(030) 'Window',
072(002) 'Fm',
077(132) 'Row'.
ULINE.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
STXL_ID-TDOBJECT = 'FORM'.
STXL_ID-TDID = 'TXT'.
SELECT * FROM STXL CLIENT SPECIFIED
WHERE MANDT = PA_MANDT
AND RELID EQ 'TX'
AND TDOBJECT EQ 'FORM'
AND TDID EQ 'TXT'
AND TDNAME IN SO_NAME
AND TDSPRAS IN SO_SPRAS.
MOVE-CORRESPONDING STXL TO I_STXL.
APPEND I_STXL.
ENDSELECT.
SORT I_STXL.
CLEAR HUIDIGE_TDSPRAS_TDNAME.
CLEAR VORIGE_TDSPRAS_TDNAME.
LOOP AT I_STXL.
STXL_ID-TDNAME = I_STXL-TDNAME.
STXL_ID-TDSPRAS = I_STXL-TDSPRAS.
STXL_ID-TDID = I_STXL-TDID.
CONCATENATE STXL_ID-TDSPRAS STXL_ID-TDNAME
INTO HUIDIGE_TDSPRAS_TDNAME.
IF HUIDIGE_TDSPRAS_TDNAME <> VORIGE_TDSPRAS_TDNAME.
CONCATENATE STXL_ID-TDSPRAS STXL_ID-TDNAME
INTO VORIGE_TDSPRAS_TDNAME.
REFRESH LINES.
CLEAR H_TEL.
IMPORT TLINE TO LINES FROM DATABASE STXL(TX)
CLIENT I_STXL-MANDT
ID STXL_ID.
LOOP AT LINES.
IF LINES-TDFORMAT = '/W'.
H_WINDOW = LINES-TDLINE.
ENDIF.
SEARCH LINES-TDLINE FOR H_STRING1.
IF SY-SUBRC <> 0 AND H_STRING2 <> SPACE.
SEARCH LINES-TDLINE FOR H_STRING2.
ENDIF.
IF SY-SUBRC EQ 0 AND LINES-TDFORMAT NE '/*'.
H_POS = SY-FDPOS.
IF NOT PA_ITEM1 IS INITIAL.
ADD 8 TO H_POS.
ENDIF.
IF NOT PA_ITEM4 IS INITIAL.
ADD 11 TO H_POS.
ENDIF.
H_LEN = STRLEN( PA_STR ).
H_STRING = LINES-TDLINE+H_POS(H_LEN).
IF H_TEL EQ 0.
HIDE I_STXL-MANDT.
HIDE STXL-TDNAME.
HIDE I_STXL-TDSPRAS.
WRITE: /001 I_STXL-MANDT,
005 STXL-TDNAME HOTSPOT ON,
036 I_STXL-TDSPRAS,
041 H_WINDOW(30).
CLEAR STXL-TDNAME.
ELSE.
WRITE: /041 H_WINDOW(30).
ENDIF.
WRITE: 072 LINES-TDFORMAT.
H_POS1 = 77 + H_POS.
H_POS2 = H_POS + STRLEN( H_STRING ).
IF H_POS EQ 0.
CLEAR H_LINE1.
ELSE.
H_LINE1 = LINES-TDLINE(H_POS).
ENDIF.
H_LINE2 = LINES-TDLINE+H_POS2.
H_POS2 = H_POS2 + 77.
WRITE: 077 H_LINE1,
AT H_POS1 H_STRING COLOR COL_HEADING,
AT H_POS2 H_LINE2.
H_TEL = H_TEL + 1.
H_TOT = H_TOT + 1.
ENDIF.
ENDLOOP.
IF NOT H_TEL IS INITIAL.
ULINE.
ENDIF.
ENDIF.
ENDLOOP.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
SKIP 1.
WRITE: / 'Number of hits:', H_TOT.
AT LINE-SELECTION.
CHECK STXL-TDNAME <> SPACE.
GET CURSOR FIELD H_FIELD
VALUE H_VALUE
LINE H_LINE
OFFSET H_OFFSET.
CHECK H_FIELD = 'STXL-TDNAME'.
CHECK I_STXL-MANDT = SY-MANDT.
REFRESH BDCDATA.
PERFORM BDC_DYNPRO USING 'SAPMSSCF' '1102'.
PERFORM BDC_FIELD USING 'RSSCF-TDFORM' STXL-TDNAME.
PERFORM BDC_FIELD USING 'RSSCF-TDSPRAS' I_STXL-TDSPRAS.
CALL TRANSACTION 'SE71' USING BDCDATA.
CLEAR STXL-TDNAME.
*& Form BDC_DYNPRO
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDFORM. " BDC_FIELD
*Comment Angelo:
*Selection-texts:
*PA_ITEM1
*PA_ITEM2
*PA_ITEM3
*PA_ITEM4
*PA_ITEM5
*PA_MANDT Client
*PA_STR Search-item
*SO_NAME Form
*SO_SPRAS Language
*Text-symbols:
*001 Selection search-item
*002 Value
*003 Selection form(s)
*011 Standard text
*012 Table (+ field)
*013 Variable
*014 Program
*015 String
Once you copy the above mentioned program.Just run this pgm with the parameters:-
Selection search text: String
Search text: PERFORM name_of_the_subroutine
Selection Forms: Z*
Language: E
& it will display all the SAP Scripts from where this routine is being called.
I hope this helps,
Regards
Raju Chitale -
HI,
I AM USING FOLLOWING CODE IN SAP SCRIPT
/: PERFORM SUM IN PROGRAM ZSUM
/: USING ®UD-WRBTR&
/: USING ®UD-WABZG&
/: CHANGING &VAR&
/: ENDPERFORM
AND PROGRAM
FORM SUM USING TABLES IN_PAR STRUCTURE ITCSY
changing OUT_PAR STRUCTURE ITCSY.
READ TABLE IN_PAR WITH KEY NAME = VAR1.
var1_sc = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY NAME = VAR2.
var2_sc = IN_PAR-VALUE.
tot = var1_sc - var2_sc.
READ TABLE OUT_PAR WITH KEY NAME = VAR.
Out_PAR-VALUE = tot.
ENDFORM.
NOW ITS GIVING DUMP TELLING "This routine contains 3 formal para , but the current call contains 4 actual parameters." IF I COMMENT CODE IN FORM.
IF I REMOVE CODE IN FORM THEN IT GIVE SYSTAX ERROR :
& ALSO in_PAR IS NOT INTERNAL TABLE\
PLEASE HELP MEHi
You are using 2 parameters ®UD-WRBTR&
®UD-WABZG& only with perform
see the sample code and do accordingly
How to call a subroutine form SAPscripts
The Form :
/:PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
/:USING &EKKO-EBELN&
/:CHANGING &CDECENT&
/:ENDPERFORM
The report :
REPORT zkrpmm_perform_z1medruck .
DATA : BEGIN OF it_input_table OCCURS 10.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_input_table.
déclaration de la table output_table contenant les
variables exportées
DATA : BEGIN OF it_output_table OCCURS 0.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_output_table.
DATA : w_ebeln LIKE ekko-ebeln,
w_vbeln LIKE vbak-vbeln,
w_zcdffa LIKE vbak-zcdffa.
FORM CDE_CENT
FORM cde_cent TABLES input output.
it_input_table[] = input[].
it_output_table[] = output[].
READ TABLE it_input_table INDEX 1.
MOVE it_input_table-value TO w_ebeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_ebeln
IMPORTING
output = w_ebeln.
SELECT SINGLE zcdffa FROM ekko
INTO w_zcdffa
WHERE ebeln = w_ebeln.
it_output_table-name = 'CDECENT'.
MOVE w_zcdffa TO it_output_table-value.
MODIFY it_output_table INDEX 1.
output[] = it_output_table[].
ENDFORM.
REPORT ZMPO1 .
form get_freight tables in_par structure itcsy out_par structure itcsy.
tables: ekko,konv,t685t.
data: begin of itab occurs 0,
ebeln like ekko-ebeln,
knumv like ekko-knumv,
end of itab.
data: begin of itab1 occurs 0,
knumv like konv-knumv,
kposn like konv-kposn,
kschl like konv-kschl,
kbetr like konv-kbetr,
waers like konv-waers,
kwert like konv-kwert,
end of itab1.
data: begin of iout occurs 0,
kschl like konv-kschl,
vtext like t685t-vtext,
kbetr like konv-kbetr,
kwert like konv-kwert,
end of iout.
data v_po like ekko-ebeln.
read table in_par with key 'EKKO-EBELN'.
if sy-subrc = 0.
v_po = in_par-value.
select
ebeln
knumv
from ekko
into table itab
where ebeln = v_po.
if sy-subrc = 0.
loop at itab.
select
knumv
kposn
kschl
kbetr
waers
kwert
into table itab1
from konv
where knumv = itab-knumv and
kappl = 'M'.
endloop.
loop at itab1.
if itab1-kposn <> 0.
select single * from t685t
where kschl = itab1-kschl
and kappl = 'M'
and spras = 'EN'.
iout-vtext = t685t-vtext.
iout-kschl = itab1-kschl.
iout-kbetr = itab1-kbetr.
iout-kwert = itab1-kwert.
append iout.
clear iout.
endif.
endloop.
sort itab1 by kposn.
loop at iout.
sort iout by kschl.
if ( iout-kschl eq 'GSDC' OR
iout-kschl eq 'GSFR' OR
iout-kschl eq 'GSIR' ).
at end of kschl.
read table iout index sy-tabix.
sum.
write:/ iout-kschl,iout-vtext,iout-kwert.
out_par-name = 'A1'.
out_par-value = iout-vtext.
append out_par.
out_par-name = 'A2'.
out_par-value = iout-kwert.
append out_par.
endat.
endif.
endloop.
endif.
endif.
endform.
IN THE FORM I AM WRITING THIS CODE.
/:DEFINE &A1& = ' '
/:DEFINE &A2& = ' '
/:PERFORM GET_FREIGHT IN PROGRAM ZMFORM_PO1
/:USING &EKKO-EBELN&
/:CHANGING &A1&
/:CHANGING &A2&
/:ENDPERFORM
&A1&
&A2&
Reward points for useful Answers
Regards
Anji
Message was edited by:
Anji Reddy Vangala -
SAP Scripts : Multiple Performs in same program
dear All,
I am working on SAP Script. I had user a perform statement and written a Code in Sub-routine. that works well, Now I have to use other perform to a carry other operation, Can I use same program, and Add new code to it or Create other program.
I will try to explain more clearly ..
PERFORM <b>GET_TEXT</b> IN <b>PROGRAM ZGET_STEXT</b>
Using var1
using Var2
Changing Var3.
Now if I tooo Add other perform to my Script.
Can I use
PERFORM <b>GET_STtext</b> IN PROGRAM <b>ZGET_STEXT</b>
Using var4
using Var5
Changing Var6.
and Add extra code to do extra operation for same ZGET_Stext program,
Please advice me.
Thanking you.
With kind regards
VenkatThanks Rich & Sandip,
I will get back if I have some problems,
As I am worried about Int_cond Value.
In first form I have assigned
text = Sgtext.
So I guess I have to clear int_cond and assign new value for second form .
Am I right ??
Thanks & Regards
Venkat -
What is the diff b/w Sap Scripts and Smart Forms
Hi,
Whats the diff b/w SAP Scripts and Smart Forms..
I need the internal explanation for both Smart Forms and SAP Scripts mean when we execute what happens whether Print Program r Forms starts execution 1st and SIMILARLY FOR SMARTFORMS WHETHER FM'S R FORMS.
Thanks & Regards,
Gopi.Hi
Difference with SMARTFORMS vs. SapScript(SE71)
The Following are the differences :-
a) Multiple page formats are possible in smartforms which is not the case in SAPScripts
b) It is possible to have a smartform without a main window .
c) Labels cannot be created in smartforms.
d) Routines can be written in smartforms tool.
e) Smartforms generates a function module when activated.
f) Unlike sapscripts (RSTXSCRP), you cannot upload/download Smartform to your local harddisk.
It was said that it was provided in CRM 3.0 version, but not available in R/3. You can download smartforms into Local PC in a XML format. In the same way you can upload this XML format into Smartform. From the smartform editor itself you can call download option, if you are working in CRM 3.0 environment.
In R3 also, you can download into XML format. However, it's not sure about uploading. Refer to the program 'SF_XSF_DEMO'.
In 4.7 Enterprise, other have seen this utlity which is completey missing in 4.6c. There is functionality to downlaod a complete form or only a particular node. (Utilities -> Download form). It will create a XML file and save it in the hard disk.
For others, if you want to download/upload the Smartforms source, you will need the help from the Basis people. What you can do is to create a Transport and then FTP down to your local harddisk. When you need the Smartform source in another system, you have FTP up the Smartforms file back to the SAP server. Finally, the Basis team, will tp it into your system.
g) The protect and endprotect command in sapscript doesn't work with smartforms. For example on a invoice: First data of position no 80. is printed on page one, other data of position no 80 is printed on page 2. And there's nothing you can do about it. Actually, there is something you can do about it. By using a folder node and checking the 'protect' checkbox, everything in that folder will be page protected.
check out this link:
http://www.sap-img.com/smartforms/sap-smart-forms.htm
Reward points if helpful.
Regards,
Swathi. -
Calculation of values in a dunning form (SAP Script)
Hi Experts!
I want to add values to a sum (dunning-amount + dunning-fee + interest) in a dunning form (SAP Script; Z150_DUNN_02).Therefore I'm using a subroutine (Z_FI_KX_DUNN_02_INTEREST) to summarize. Problem is the format of the output-field &Z_FAEBT&. It's not similar to field &MHNK-FAEBT& which was formerly printed (without calculation of interest and dunning-fees.
/: DEFINE &Z_FAEHW& := &MHNK-FAEHW&
/: DEFINE &Z_ZINHW& := &MHNK-ZINHW&
/: DEFINE &Z_MHNGH& := &MHNK-MHNGH&
/: DEFINE &Z_FAEBT& := &MHNK-FAEBT&
/: PERFORM ZFAEBT IN PROGRAM Z_FI_KX_DUNN_02_INTEREST
/: USING &Z_FAEHW&
/: USING &Z_ZINHW&
/: USING &Z_MHNGH&
/: CHANGING &Z_FAEBT&
/: ENDPERFORM
/: ENDIF
A3 &MHNK-WAERS& &Z_FAEBT(C)&
It would be fine to get a hint how to format the field &Z_FAEBT& correctly. Must be done in the subroutine Z_FI_KX_DUNN_02_INTEREST by a special WRITE-command? Is it possible to add these values only in the form?
Thanks for support!
Regards, Berndhi!
I defined the field like you said! After moving this field to a numeric field to add the different amounts the
following error occurred:
Runtime errors CONVT_NO_NUMBER
Exception CX_SY_CONVERSION_NO_NUMBER
Occurred on 16.06.2009 at 15:15:25
Unable to interpret " 1.316,59" as a number.
Definition:
FORM zfaebt TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
TABLES: mhnk.
DATA: z_faehw_num LIKE mhnk-faehw,
z_zinhw_num LIKE mhnk-zinhw,
z_mhngh_num LIKE mhnk-mhngh,
z_faebt_num LIKE mhnk-faebt.
DATA: z_faehw TYPE string,
z_zinhw TYPE string,
z_mhngh TYPE string,
z_faebt TYPE string.
statement:
READ TABLE in_par WITH KEY 'Z_FAEHW'.
CHECK sy-subrc = 0.
z_faehw = in_par-value.
z_faehw_num = z_faehw.
I suppose a type-conflict.
Regard, Bernd
Maybe you are looking for
-
How do I get my stuff back?
A long time ago my friend gave me his music that was imported from CDs and such way back in 2004ish. I had all the songs that i have purchased through itunes and the ones he gave me on my ipod and i got a new computer. I managed to get use the DVD di
-
Calling Javascript function in setOnBlur is throwing error
Hi , I have a requirement to open a popup window using javascript.I have tried to achieve this using the following code in the PR of that extended CO. StringBuffer l_buffer = new StringBuffer(); StringBuffer l_buffer1 = new StringBuffer(); l_buffer.a
-
Podcast submitted but not showing up in iTunes
I submitted my podcast to iTunes two weeks ago. When I try to resbumit to iTunes, it says that the feed has already been submitted. But the podcast does not show up in iTunes when I search for it. http://feeds.feedburner.com/IBozo Any ideas? Thanks,
-
How can you make an smart playlist that uses another smart playlist when I can't see them all
My whole family uses itunes. I want to make a playlist that uses other playlist. However, when I start a smart playlist and click playlist is I get a dropdown menue that doesn't show all my playlists. My wife's name happens to start with a V so al
-
Hi there Since a software update all my iPad apps don't work anymore. Restart didn't solved the problem. Problem occurs with both free and purchased apps. Problem doesn't occure on iPhone etc. Any help? Appreciate