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

Form rotuine for script

Former Member
0 Likes
523

Hi Gurus,

How to attch or code form routine into driver program for Script?

Plz reply fast its very urgent

Martin

4 REPLIES 4
Read only

Former Member
0 Likes
492

Hi ,

The Report where you write open_form, close_form, and write_form is called the print program for that particular script.

Driver program is something which would hold the subroutines declared in the script.

see the below sample code for example:

This is the code written in script

/: IF sales org (condition satisfied).

/: DEFINE &G_STD_TEXT& = ' '

/: PERFORM GET_STANDARD_TEXT IN PROGRAM YTEST

/: CHANGING &G_STD_TEXT&

/: ENDPERFORM

/: INCLUDE &G_STD_TEXT& OBJECT TEXT ID ST LANGUAGE &EKKO-SPRAS&

/: ENDIF.

Now YTEST will be the driver program for the script.

In Driver Program: YTEST (Se38) write the following logic

FORM get_standard_text TABLES tbl_input STRUCTURE itcsy

tbl_output STRUCTURE itcsy.

DATA : l_stdtext(128) TYPE c.

CONSTANTS : c_stdtxt(128) TYPE c VALUE 'ZV_STANDARD_TEXT' .

MOVE c_stdtxt TO l_stdtext.

tbl_output-value = l_stdtext.

MODIFY tbl_output INDEX 1 TRANSPORTING value.

ENDFORM.

Hope this helps you.

Please do reward incase this is useful to you.

Regards,

Read only

Former Member
0 Likes
492

U can use

OPEN_FORM

WRITE_FORM

CLOSE_FORM

FUNCTION MODULES

Read only

Former Member
0 Likes
492

Hi Martin,

Lets suppose if u want to fetch the payment due for an invoice.

Code this form routine in your script.

/: PERFORM GET_PYMT_DUE_IN IN PROGRAM ZSROINVOICE

/: USING &VBDKR-VBELN&

/: USING &VBDKR-FKDAT&

/: USING &VBDKR-ZTERM&

/: CHANGING &PYMNTDUE&

code it in ur driver program to fetch the details.

FORM get_pymt_due TABLES i_intpar STRUCTURE itcsy

i_outpar STRUCTURE itcsy.

DATA : wa_fkdat LIKE sy-datum,

wa_ztag2 LIKE t052-ztag2,

wa_pymnt LIKE sy-datum.

READ TABLE i_intpar WITH KEY name = 'VBDKR-FKDAT'.

IF sy-subrc = 0.

CONCATENATE i_intpar-value6(4) i_intpar-value3(2)

i_intpar-value+0(2)

INTO wa_fkdat.

ENDIF.

READ TABLE i_intpar WITH KEY name = 'VBDKR-ZTERM'.

IF sy-subrc = 0.

Payment Terms

SELECT SINGLE ztag2

INTO wa_ztag2

FROM t052

WHERE zterm = i_intpar-value.

ENDIF.

wa_pymnt = wa_fkdat + wa_ztag2.

MOVE 'PYMNTDUE' TO i_outpar-name.

CONCATENATE wa_pymnt6(2) '.' wa_pymnt4(2) '.' wa_pymnt+0(4) INTO

i_outpar-value.

APPEND i_outpar.

CLEAR i_outpar.

ENDFORM.

Hope this will help you.

Revert back for furthe rassistance

Read only

Former Member
0 Likes
492

Hi ,

I think you need form routine like PRINT_PAPER or ENTRY.

If that is the case Use this one . T

hese are standard includes you need to include.

INCLUDE riprid01. " General DATA and TABLE struct.

INCLUDE riprif01. " General PRINT routines

PERFORM print_paper.

Main Form which is called.

FORM print_paper.

Import Data ---Copied From SAP Program

PERFORM data_import. * This you have to copy from standard SAP program

*&-- Populate internal table for header part of form.

PERFORM data_population.

Your scrpit printing logic will be done in this.

*&--Script printing.

PERFORM main_print. " Print the PAPER now

Do reward.

Thanks,

Madhura