Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP Script From the Scratch

Former Member
0 Likes
1,986

I have to develop a SAP Script for "fch7" transaction from the scratch. Please help me what are the step I have follow to develop a new script?

Thanks in Advance

Ananya

15 REPLIES 15
Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,505

Hi Ananya,

If u gimme ur mail id.

I will forward u some docs.

I will be helpful to u.

Goto.

<a href="http://">www.sappoint.com/abap.html</a>

<a href="http://">www.sap-img.com/sapscripts.htm</a>

<a href="http://">www.sapdevelopment.co.uk/sapscript/sapscripthome.htm</a>

I have other docs also.. I will mail u after having ur id.

Regards,

Simha.

Message was edited by: Narasimha Rao Bandla

Read only

Former Member
0 Likes
1,505

Hi Simha,

Even i am interested in knowing more details about creating scripts from the scratch. If possible can you please mail me the required documents at nimsi3@gmail.com Thanks for your help.

regards,

nimsi

Read only

Former Member
0 Likes
1,505

Hi Simha,

I am also interested in knowing more details about creating scripts from the scratch. Can you please mail me them to vijay.ramana@yahoo.com.

regards,

ramana

Read only

Former Member
0 Likes
1,505

1. Take transaction SE71. Give a name starting with Y or Z.

2. Create a window

3. Create a praragraph

3. Create page windows

4. Attach window to page window

5. Write the code in the window text element

6. Activate form

Create a print program. Use the function modules OPEN_FORM, WRITE_FROM and CLOSE_FORM to call the SAPScript created.

Please look at the following site for more info.

http://www.thespot4sap.com/Articles/SAPscript_Introduction.asp

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRPROG/BCSRVSCRPROG.pdf

Rgds.

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,505

Hi Nimsi,vijay

I have sent u the docs..

Check it out...

Cheers,

Simha.

Read only

Former Member
0 Likes
1,505

Hi Simha

My Mail id is ananyadeota@yahoo.com

Plz send me the same document

Regards

Ananya

Read only

Former Member
0 Likes
1,505

Hi Narsimha ,

plz send the script doc to my emailid too.My Id Is subhan_50001@yahoo.com .

Regards,

Mir Subhan

Read only

Former Member
0 Likes
1,505

hi narashima

can u forward the documents to vaccu2001@gmail.com

thank u

venkat

Read only

Former Member
0 Likes
1,505

hi,

plz send other sap script documts to me my id is

<< removed >>

thank you.

Edited by: Rob Burbank on Mar 23, 2009 4:04 PM

Read only

Former Member
0 Likes
1,505

Hi narasimha,

Can you forward the same to << private information removed >>

Here it is not allowing me to enter AT THE RATE OF so i have used 2 instead of that

Thank you

Edited by: Ravi Kumar B on Mar 23, 2009 7:41 PM

Edited by: Rob Burbank on Mar 23, 2009 4:03 PM

Read only

Former Member
0 Likes
1,505

HI

AS PER YOUR REQUIEMENT YOU HAVE TO FOLLOW THE ABOVE PROCESS TO DEVELOP A NEW SAP SCRIPT.

GO TO SE71

GIVE A FORM NAME

DESIGN THE VARIOUS PROPERTIES OF THE REPORT LIKE CHARACTER FORMAT, PARAGRAPH FORMAT AND SCREENS.

WRITE THE DRIVER PROGRAM USING THE TCODE SE38

PASS THE APPROPRIATE VALUE TO THE SAP SCRIPT USING THE DRIVER PROGRAM.

HERE YOU R USING TCODE FCH7

FCH7-REPRINT CHECK

MAIN PROGRAM NAME - SAPMFCHK

NOW YOU HAVE TO CHECK WHT ARE THE REQUIREMENT YOU HAVE TO DO IN THE SAP SCRIPT FORM.

SO IF YOU CAN GIVE ME SOME DETAILS ABOUT YOUR REQUIREMENT THAN I THINK I CAN GIVE YOU SOME MORE IDEAS

THANKS

MRUTYUN

Read only

Former Member
0 Likes
1,505

Hi Ananya,

Here is a link which will be helpful to you.

Shall send you some docs to your mail id too if you give the same.

http://www.sap-img.com/sapscripts.htm

http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm

SAP SCRIPT

-


1- GO TO SE71

2- Set the Character format

3- Set the paragraph format

4- Open the layout set.

5- Design the form as per your requirements.

Main window

Constant Window

Variable Window

6-go to se38

7- write a driver program

8- use the minimum function module of the sap script

OPEN_FORM

WRITE_FORM

CLOSE_FORM.

Here is a driver program you can use this for your reference

============

*& Report ZABC_SCRIPT *

*& *

&----


*& *

*& *

&----


REPORT ABC_SCRIPT .

TABLES: ZSCRIPT_TAB.

data: itab type standard table of ZSCRIPT_TAB with header line.

select * from ZSCRIPT_TAB into corresponding fields of table itab.

DATA: VALUE TYPE I.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

DEVICE = 'PRINTER'

DIALOG = 'X'

FORM = 'ZPS_MROF1'

LANGUAGE = SY-LANGU

  • OPTIONS =

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJECT =

  • RAW_DATA_INTERFACE = '*'

  • IMPORTING

  • LANGUAGE =

  • NEW_ARCHIVE_PARAMS =

  • RESULT =

  • EXCEPTIONS

  • CANCELED = 1

  • DEVICE = 2

  • FORM = 3

  • OPTIONS = 4

  • UNCLOSED = 5

  • MAIL_OPTIONS = 6

  • ARCHIVE_ERROR = 7

  • INVALID_FAX_NUMBER = 8

  • MORE_PARAMS_NEEDED_IN_BATCH = 9

  • SPOOL_ERROR = 10

  • OTHERS = 11

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'TEXT1'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • OTHERS = 9

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at itab.

VALUE = VALUE + ITAB-MY_INCOME.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'TEXT2'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • OTHERS = 9

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endloop.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'TEXT3'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • OTHERS = 9

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE'

  • EXCEPTIONS

  • UNOPENED = 1

  • UNSTARTED = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

  • TABLES

  • OTFDATA =

EXCEPTIONS

UNOPENED = 1

BAD_PAGEFORMAT_FOR_PRINT = 2

SEND_ERROR = 3

SPOOL_ERROR = 4

OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks,

Susmitha

Read only

0 Likes
1,505

Hi Susmitha ,

plz send the script doc to my emailid too.My Id Is subhan_50001@yahoo.com .

Regards,

Mir Subhan

Read only

Former Member
0 Likes
1,505

Hai Ananya

Check the following Codes & Settings

-


Form Z_SREE_EX1

-


Client 810

Language EN

Original lang. EN

Relevant for transl. Yes

Status Active

Package $TMP Temporary Objects (never transported!)

Created by ADCDEV Changed by ADCDEV

Date 02/19/2005 Date 02/20/2005

Time 13:26:58 Time 15:16:57

Release 620 Release 620

Description Material Description

Standard Attributes

First page PAGE1

Default paragr. P1

Tab Stop 1.00 CM

Page Format DINA3

Orientation Landscape

Lines/inch 6.00

Characters/inch 10.00

Font Attributes

Font Family COURIER

Font Size 12.0 Point

Bold No

Italic No

Underline No

-


Characters Attributes

-


C1 Used For Bold

Standard Attributes

Selection No

Font Attributes

Font Size 14.0 Point

Bold Yes

C2 Used For Bold

Standard Attributes

Selection No

Font Attributes

Font Size 20.0 Point

Bold Yes

C3 Used For Bold

Standard Attributes

Selection No

Font Attributes

Font Size 13.0 Point

Italic Yes

-


Paragraphs Attributes

-


P1 Para For Material Details

Standard Attributes

Line Spacing 1.00 LN

Alignment Left-Aligned

Tabs

40.00 CH Left-Aligned

56.00 CH Left-Aligned

58.00 CH Left-Aligned

P2 Para For Material continution

Standard Attributes

Line Spacing 1.00 LN

Alignment Left-Aligned

Tabs

42.00 CH Left-Aligned

50.00 CH Left-Aligned

64.00 CH Left-Aligned

P3 To Print Heading

Standard Attributes

Line Spacing 1.00 LN

Alignment Centered

P4 To Print Heading

Standard Attributes

Line Spacing 1.00 LN

Alignment Centered

P5 For Address

Standard Attributes

Line Spacing 1.00 LN

Alignment Left-Aligned

Tabs

7.00 CH Left-Aligned

-


Windows Attributes

-


ADDRESS To Print Address

Window type VAR

DATE To Print Date

Window type VAR

HEADING To Print Heading

Window type VAR

LOGO Logo Window

Window type VAR

MAIN Main Window

Window type MAIN

PAGENO Page Number

Window type VAR

USERID To Print User Details

Window type VAR

-


Pages Attributes

-


PAGE1 First Page

Standard Attributes

Next Page PAGE2

Page Counter

Mode INC

Numbering type Arabic Numerals

Page Window

MAIN Left Margin 0.40 CM

Upper margin 10.40 CM

Window width 19.30 CM

Window height 15.00 CM

ADDRESS Left Margin 10.30 CM

Upper margin 4.80 CM

Window width 9.50 CM

Window height 2.80 CM

DATE Left Margin 0.50 CM

Upper margin 8.20 CM

Window width 19.10 CM

Window height 1.60 CM

HEADING Left Margin 0.40 CM

Upper margin 2.80 CM

Window width 19.60 CM

Window height 1.50 CM

LOGO Left Margin 0.70 CM

Upper margin 0.50 CM

Window width 2.10 CM

Window height 2.00 CM

USERID Left Margin 0.50 CM

Upper margin 4.80 CM

Window width 9.50 CM

Window height 2.80 CM

PAGE2 Page Number 2

Standard Attributes

Next Page PAGE2

Page Counter

Mode INC

Numbering type Arabic Numerals

Page Window

MAIN Left Margin 0.40 CM

Upper margin 4.40 CM

Window width 19.30 CM

Window height 15.20 CM

HEADING Left Margin 0.40 CM

Upper margin 2.80 CM

Window width 19.60 CM

Window height 1.50 CM

LOGO Left Margin 0.70 CM

Upper margin 0.50 CM

Window width 2.10 CM

Window height 2.00 CM

-


Text Elements for Following Windows:

-


ADDRESS

/: IF &PAGE& = 1

/: BOX FRAME 20 TW INTENSITY 10

  • <C1>ADDRESS:</>

/: ADDRESS

/: TITLE 'ADDRESS' DELIVERY

/: NAME 'INTELLIGROUP'

/: STREET 'SECRETARIAT'

/: POSTCODE '500018'

/: CITY 'HYDERABAD'

/: REGION 'AL'

/: COUNTRY 'IN'

/: ENDADDRESS

/: ENDIF

DATE

/: IF &PAGE& = 1

/: SET DATE MASK = 'DD MMMM,YYYY DDDD'

P1 DATE: <C3> &SY-DATUM& </>

/: ENDIF

HEADING

P3 <c2>Material Report</>

/: BOX XPOS '0.31' CM YPOS '0.8' CM WIDTH '19.6' CM HEIGHT 0 CM FRAME 10 TW

LOGO

/: BITMAP 'ENJOY' OBJECT GRAPHICS ID BMAP TYPE BCOL

MAIN

/* This is Item Element Description

/: TOP

/: IF &PAGE& = '1'

/: BOX XPOS '0.40' CM YPOS '10.4' CM WIDTH '19.3' CM HEIGHT 0 CM FRAME 10 TW

/: ENDIF

P1 <C1>MATERIAL TYPE:</> &IT_MARA-MTART&

/: ENDTOP

/: IF &V_TOP& = 'X' AND &V_TEMP& = 'Y'

/: NEW-PAGE

/: ENDIF

/: PROTECT

P1 &it_mara-matnr(K)& &it_makt-maktx&,,&it_mara-pstat&,,&it_mara-mbrsh&

P2 ,,&it_mara-matkl&,,&it_mara-ntgew(T)&,,&it_mara-volum&

/: ENDPROTECT

/: BOTTOM

P3 PAGE &PAGE& OF &SAPSCRIPT-FORMPAGES&

P3 &uline(70)&

/* BOX XPOS '0.40' CM YPOS '25.9' CM WIDTH '19.3' CM HEIGHT '0' CM FRAME 10 TW

/: ENDBOTTOM

PAGENO

P4 page &page& of &sapscript-formpages&

  • &ULINE(74)&

USERID

/: IF &PAGE& = 1

  • This Report Is Run By:

  • <C1>UserId</> : <c3>&SY-UNAME& </>

  • <C1>Name</> : <c3>Sreekanth </>

  • <C1>Email</> : <c3>sree@intelligroup.com</>

/: ENDIF

Print Program at SE38

&----


*& Report Z_WEEK5_SREEKANTH_EX1 *

*& *

&----


*& *

*& *

&----


REPORT Z_PRINTPRG .

TABLES: MARA, MAKT.

DATA: BEGIN OF IT_MARA OCCURS 0,

MTART LIKE MARA-MTART,

MATNR LIKE MARA-MATNR,

PSTAT LIKE MARA-PSTAT,

MATKL LIKE MARA-MATKL,

MBRSH LIKE MARA-MBRSH,

NTGEW LIKE MARA-NTGEW,

VOLUM LIKE MARA-VOLUM,

END OF IT_MARA.

DATA: BEGIN OF IT_MAKT OCCURS 0,

MATNR LIKE MAKT-MATNR,

MAKTX LIKE MAKT-MAKTX,

END OF IT_MAKT.

DATA: V_TOP TYPE C,

V_TEMP TYPE C VALUE 'X'.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS: P_MBRSH LIKE MARA-MBRSH,

P_NOREC(5) TYPE N DEFAULT '10'.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN.

IF P_MBRSH IS INITIAL.

MESSAGE E004(ZI) WITH 'INDUSTRY SECTOR IS NOT SPECIFIED'.

STOP.

ENDIF.

START-OF-SELECTION.

PERFORM GET_DATA.

PERFORM OPEN_FORM.

PERFORM WRITE_FORM.

PERFORM CLOSE_FORM.

&----


*& Form GET_DATA

&----


FORM GET_DATA .

SELECT MTART

MATNR

PSTAT

MATKL

MBRSH

NTGEW

VOLUM

FROM MARA

UP TO P_NOREC ROWS

INTO TABLE IT_MARA

WHERE MBRSH = P_MBRSH.

IF NOT IT_MARA[] IS INITIAL.

SELECT MATNR

MAKTX

FROM MAKT

INTO TABLE IT_MAKT

FOR ALL ENTRIES IN IT_MARA

WHERE MATNR = IT_MARA-MATNR.

ENDIF.

SORT IT_MARA BY MTART.

ENDFORM. " GET_DATA

&----


*& Form OPEN_FORM

----


FORM OPEN_FORM .

CALL FUNCTION 'OPEN_FORM'

EXPORTING

APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

DEVICE = 'PRINTER'

DIALOG = 'X'

FORM = 'Z_SREE_EX1'

LANGUAGE = SY-LANGU

  • OPTIONS =

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJECT =

  • RAW_DATA_INTERFACE = '*'

  • IMPORTING

  • LANGUAGE =

  • NEW_ARCHIVE_PARAMS =

  • RESULT =

EXCEPTIONS

CANCELED = 1

DEVICE = 2

FORM = 3

OPTIONS = 4

UNCLOSED = 5

MAIL_OPTIONS = 6

ARCHIVE_ERROR = 7

INVALID_FAX_NUMBER = 8

MORE_PARAMS_NEEDED_IN_BATCH = 9

SPOOL_ERROR = 10

CODEPAGE = 11

OTHERS = 12

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " OPEN_FORM

&----


*& Form WRITE_FORM

----


FORM WRITE_FORM .

LOOP AT IT_MARA.

V_TOP = 'Y'.

AT NEW MTART.

V_TOP = 'X'.

ENDAT.

READ TABLE IT_MAKT WITH KEY MATNR = IT_MARA-MATNR.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

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.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

V_TEMP = 'Y'.

ENDLOOP.

ENDFORM. " WRITE_FORM

&----


*& Form CLOSE_FORM

----


FORM CLOSE_FORM .

CALL FUNCTION 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

  • TABLES

  • OTFDATA =

EXCEPTIONS

UNOPENED = 1

BAD_PAGEFORMAT_FOR_PRINT = 2

SEND_ERROR = 3

SPOOL_ERROR = 4

CODEPAGE = 5

OTHERS = 6

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " CLOSE_FORM

Thanks & Regards

Sreenivasulu P

Read only

Former Member
0 Likes
1,505

Hello,

1.The first thing is u have to make ur self clear of the spec.

2.let me know what are u supposed to design.

Mail me ur mail id with details of ur devlopment so that I can give u clear picture.

Regards