0% found this document useful (0 votes)
349 views

Sapscript Example Report

1. The document describes a sample program for displaying SAP forms using ABAP scripts. It provides code to open a form, write data to different windows of the form, and close the form. 2. The program retrieves data from different tables, stores it in internal tables, and writes the data to the elements in different windows of the form. 3. The code calls SAP form functions like OPEN_FORM, START_FORM, WRITE_FORM, END_FORM, and CLOSE_FORM to display the form with the retrieved data.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
349 views

Sapscript Example Report

1. The document describes a sample program for displaying SAP forms using ABAP scripts. It provides code to open a form, write data to different windows of the form, and close the form. 2. The program retrieves data from different tables, stores it in internal tables, and writes the data to the elements in different windows of the form. 3. The code calls SAP form functions like OPEN_FORM, START_FORM, WRITE_FORM, END_FORM, and CLOSE_FORM to display the form with the retrieved data.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Share

More

Next Blog

Create Blog Sign In

SAP Sample Programs


Tuesday, July 5, 2011
Translate

SAP Scripts Sample Program


Go to SE71 for design the form.

Powered by

Select Language Translate

About Me

Ravindrakvs View my complete profile

Blog Archive

2013 (3) 2012 (15) 2011 (36) October (4) September (2) July (7)
Problem in watermark Bar Code for SmartForms step by step Bar Code for SmartForms Find Exits for Tcode (transaction code) SAP Smart Forms Sample Program SAP Scripts Sample Program Address cannot be maintained, entry in table TSADR...

Create a page and windows

June (10) May (13)


Popular Posts

SAP Scripts Sample Program IDOC Step-by-Step. OUTBOUND process BDC using Call Transaction method. Upload Excel to Internal Tables in ABAP IDOC Step-by-Step. INBOUND process

Followers

converted by Web2PDFConvert.com

again de-select the graphical form painter.

add text to every window

Note:I> Intensity 10 to write on continues line press Shift+F8.

converted by Web2PDFConvert.com

clcik on font "Bold"

Click on standard

converted by Web2PDFConvert.com

-----------------------------------------------------------------Now call the form through driver program create a program in SE38. REPORT ZDEMO_SCRIPTS. TABLES: KNA1, vbrk, t001. TYPES: BEGIN OF T_KNA1, LAND1 TYPE KNA1-LAND1, NAME1 TYPE KNA1-NAME1, ORT01 TYPE KNA1-ORT01, PSTLZ TYPE KNA1-PSTLZ, STRAS TYPE KNA1-STRAS, END OF T_KNA1. TYPES: BEGIN OF T_T001, BUTXT TYPE T001-BUTXT, ORT01 TYPE T001-ORT01, LAND1 TYPE T001-LAND1, END OF T_T001. TYPES: BEGIN OF T_VBRK, VBELN TYPE VBRK-VBELN, FKDAT TYPE VBRK-FKDAT, WAERK TYPE VBRK-WAERK, KUNAG TYPE KUNAG, BUKRS TYPE BUKRS, END OF T_VBRK. TYPES: BEGIN OF T_VBRP, VBELN TYPE VBELN, NETWR TYPE VBRP-NETWR, MATNR TYPE VBRP-MATNR, ARKTX TYPE VBRP-ARKTX, POSNR TYPE POSNR_VF,
converted by Web2PDFConvert.com

END OF T_VBRP. PARAMETERS:s_vbeln TYPE VBRK-vbeln. TYPES: BEGIN OF T_FINAL, VBELN TYPE VBRK-VBELN, FKDAT TYPE VBRK-FKDAT, WAERK TYPE VBRK-WAERK, NETWR TYPE VBRP-NETWR, MATNR TYPE VBRP-MATNR, ARKTX TYPE VBRP-ARKTX, POSNR TYPE POSNR_VF, END OF T_FINAL. DATA: IT_KNA1 TYPE TABLE OF T_KNA1, WA_KNA1 TYPE T_KNA1, IT_T001 TYPE TABLE OF T_T001, WA_T001 TYPE T_T001, IT_VBRK TYPE TABLE OF T_VBRK, WA_VBRK TYPE T_VBRK, IT_VBRP TYPE TABLE OF T_VBRP, WA_VBRP TYPE T_VBRP, IT_FINAL TYPE TABLE OF T_FINAL, WA_FINAL TYPE T_FINAL. Start-of-selection. perform get_data. PERFORM open_form. PERFORM start_form. PERFORM write_form. PERFORM end_form. PERFORM close_form.

*&--------------------------------------------------------------------* *& Form GET_DATA *&--------------------------------------------------------------------* * text: Getting data into final internal table for display *---------------------------------------------------------------------*
FORM GET_DATA. select VBELN FKDAT WAERK KUNAG BUKRS from VBRK INTO CORRESPONDING FIELDS OF TABLE IT_VBRK WHERE VBELN = s_vbeln. SELECT LAND1 NAME1 ORT01 PSTLZ STRAS INTO CORRESPONDING FIELDS OF TABLE IT_KNA1 FROM KNA1 FOR ALL ENTRIES IN IT_VBRK WHERE KUNNR = IT_VBRK-KUNAG. SELECT NETWR MATNR ARKTX POSNR VBELN FROM VBRP INTO CORRESPONDING FIELDS OF TABLE IT_VBRP FOR ALL ENTRIES IN IT_VBRK WHERE VBELN = IT_VBRK-VBELN. READ TABLE IT_VBRK INTO WA_VBRK INDEX 1.

converted by Web2PDFConvert.com

IF SY-SUBRC = 0. SELECT SINGLE BUTXT ORT01 LAND1 FROM T001 INTO CORRESPONDING FIELDS OF WA_T001 WHERE BUKRS = WA_VBRK-BUKRS. ENDIF.

* * * * * *

SELECT BUTXT ORT01 LAND1 FROM T001 INTO CORRESPONDING FIELDS OF TABLE IT_T001 FOR ALL ENTRIES IN IT_VBRK WHERE BUKRS = IT_VBRK-BUKRS.

LOOP AT IT_VBRP INTO WA_VBRP. READ TABLE IT_VBRK INTO WA_VBRK WITH KEY VBELN = WA_VBRP-VBELN. IF SY-SUBRC = 0. MOVE-CORRESPONDING WA_VBRK TO WA_FINAL. MOVE-CORRESPONDING WA_VBRP TO WA_FINAL. ENDIF. APPEND WA_FINAL TO IT_FINAL. ENDLOOP. ENDFORM. FORM OPEN_FORM. CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZDEMO_SCRIPTS'. ENDFORM.

FORM START_FORM. CALL FUNCTION 'START_FORM' EXPORTING FORM = 'ZDEMO_SCRIPTS '. ENDFORM. FORM WRITE_FORM. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'ITEM_HEADER'

* FUNCTION = 'SET' * TYPE = 'BODY'


WINDOW = 'MAIN'. LOOP AT IT_FINAL INTO WA_FINAL. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'ITEM LINE'

* FUNCTION = 'SET' * TYPE = 'BODY'


WINDOW = 'MAIN'. ENDLOOP.

LOOP AT IT_KNA1 INTO WA_KNA1. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'CUST_ADD'

* FUNCTION = 'SET' * TYPE = 'BODY'


WINDOW = 'CUSTADDR'. ENDLOOP.

converted by Web2PDFConvert.com

* LOOP AT IT_T001 INTO WA_T001.


CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'OUR_ADD'

* FUNCTION = 'SET' * TYPE = 'BODY'


WINDOW = 'OUR_ADDR'.

* ENDLOOP.
ENDFORM. FORM END_FORM. CALL FUNCTION 'END_FORM'

* * * * * * * *

IMPORTING RESULT = EXCEPTIONS UNOPENED = 1 BAD_PAGEFORMAT_FOR_PRINT = 2 SPOOL_ERROR = 3 CODEPAGE = 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. ENDFORM. 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.

----------------------------------------------------------execute it.

click on print preview

converted by Web2PDFConvert.com

output

Done!.. Posted by Ravindrakvs at 5:42 PM


+1 Recommend this on Google

No comments: Post a Comment


Enter your comment...

Comment as: Select profile...

Publish

Preview

Newer Post
Subscribe to: Post Comments (Atom)

Home

Older Post

Simple template. Template images by merrymoonmary. Powered by Blogger.

converted by Web2PDFConvert.com

You might also like