on 04-16-2007 3:35 PM
Hi Peers,
I am working on the report which calling the Form from SAP Script and displaying the form.
I wanted a selection screen in which if the user enters some value it should automatically preview in the form.
I am really new to the ABAP Pls some help on this .
Any code is appreciated.
Every answers will be rewarded.
Pls peers help on this.
Seema.
Hi,
where is a simple example:
PARAMETERS: KUNNR(10).
PARAMETERS: PREVI AS CHECKBOX DEFAULT 'X'.
START-OF-SELECTION.
PERFORM OPEN_FORM.
PERFORM START_FORM.
PERFORM PRINT_DATA.
PERFORM END_FORM.
PERFORM CLOSE_FORM.
*&----
*
*& Form OPEN_FORM
*&----
*
FORM OPEN_FORM.
CLEAR ITCPO.
ITCPO-TDCOPIES = 1.
ITCPO-TDDEST = PRINTER.
IF PREVI = 'X'.
ITCPO-TDPREVIEW = 'X'.
ENDIF.
ITCPO-TDNEWID = 'X'.
ITCPO-TDDATASET = 'test'.
ITCPO-TDSUFFIX1 = PRINTER.
ITCPO-TDSUFFIX2 = 'test'.
ITCPO-TDDELETE = ' '. " Não eliminar imediatamente
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
DIALOG = ' '
FORM = 'YOUR_FORM_NAME'
LANGUAGE = SY-LANGU
OPTIONS = ITCPO
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
OTHERS = 6.
ENDFORM. " OPEN_FORM
*&----
*
*& Form START_FORM
*&----
*
FORM START_FORM.
CALL FUNCTION 'START_FORM'
EXPORTING
LANGUAGE = SY-LANGU.
ENDFORM. " START_FORM
*&----
*
*& Form PRINT_DATA
*&----
*
FORM PRINT_DATA.
SELECT * FROM KNA1 WHERE KUNNR EQ KUNNR.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TEST'
WINDOW = 'MAIN'.
ENDFORM. " PRINT_DATA
*&----
*
*& Form END_FORM
*&----
*
FORM END_FORM.
CALL FUNCTION 'END_FORM'.
ENDFORM. " END_FORM
*&----
*
*& Form CLOSE_FORM
*&----
*
FORM CLOSE_FORM.
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
OTHERS = 2.
ENDFORM. " CLOSE_FORM
Then, you must create your SapScript in order to print some information.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Seema,
Please use the below code.
Print Program:
Report zprg no standard page heading.
selection-screen begin of block b1.
parameters : name(20) type c,
designa(20) type c,
signatu(20) type c.
selection-screen end of block b1.
start-of-selection.
call function 'OPEN_FORM'
exporting
form = 'Z_TESTING1'
language = sy-langu.
call function 'START_FORM'
exporting
form = 'Z_TESTING1'
language = 'E'
startpage = 'PAGE1' .
call function 'WRITE_FORM'
exporting
element = 'MAIN'
type = 'BODY'
window = 'MAIN' .
call function 'END_FORM' .
call function 'CLOSE_FORM'.
SAPScript:
Create a Main Window, a Paragraph as 'A' and Page as 'PAGE1' and use the below code in the text element of the Main Window.
/E MAIN
A &NAME&
A &DESIGNA&
A &SIGNATU&
Hope this helps.
Thanks,
Srinivasa
Hi Manoj
It came in the form still it is giving little problem other side , I tried your no. , But you are busy .
Pls more help is required.
seema.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Seema ,
Here is the simplest Code for your requirement:
It is just a replica of Srinivas Code with little additions & deletionsl.
REPORT ZPRINTPROGRAM no standard page heading.
selection-screen begin of block b1.
parameters : name(20) type c,
designation (20) type c,
signature (20) type c.
selection-screen end of block b1.
start-of-selection.
call function 'OPEN_FORM'
exporting
form = 'ZFORM'
language = sy-langu
call function 'WRITE_FORM'
exporting
element = 'MAIN'
type = 'BODY'
window = 'MAIN' .
call function 'END_FORM' .
call function 'CLOSE_FORM'.
END of the Print Program **********************
Now, goto SE71
Create Form 'ZFORM'.
Go to PAGES , define page : Page1 and the description.
Then goto Window you will find MAIN window ---> Goto Page Windows
---> Click on EDIT ---> Create Element ---> Double click on Main Window .
The Main Window is include in the Page Windows.
when the Main Window is selected(Indication: Blue color)
go to EDIT -
> Text Elements.
In Text Editor:
/E : MAIN
P1: Name: &NAME&
P1: Desination: &DESIGNATION&
P1: Signature: &SIGNATURE&.
Goto Basic Settings.
Page Format : DINA4
First Page : Page1
Default Paragraph: P1
Just Copy & Paste the code it will work.
Regards,
Daniel.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
Here's a working example to run a SAPScript from a report program. You have to create the SAPScript in SE71 (in the program it is called Z_NYT), with the right window names.
REPORT ZTESZT.
DATA: gv_index LIKE sy-index.
BREAK-POINT.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DIALOG = 'X'
FORM = 'Z_NYT'
LANGUAGE = SY-LANGU
EXCEPTIONS
CANCELED = 1.
IF SY-SUBRC <> 0. ENDIF.
CALL FUNCTION 'START_FORM'
EXPORTING
FORM = 'Z_NYT'
LANGUAGE = sy-langu
EXCEPTIONS
FORM = 1.
IF SY-SUBRC <> 0. ENDIF.
DO 10 TIMES.
MOVE sy-index TO gv_index.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ELEM'
FUNCTION = 'SET' "set, append, delete
TYPE = 'BODY' "body, top, bottom
WINDOW = 'MAIN' "main
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10.
IF SY-SUBRC <> 0. ENDIF.
ENDDO.
CALL FUNCTION 'END_FORM'.
IF SY-SUBRC <> 0. ENDIF.
CALL FUNCTION 'CLOSE_FORM'.
IF SY-SUBRC <> 0. ENDIF.
Regards
Tamá
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
do you mean, creating a report, that call's a SapScript? (and not the oposite)
If yes, you would like to create a zreport, with a selection screen parameters, and after executing the report, the SapScript preview will appear?
Regards
Message was edited by:
Pedro Rosa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.