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 scripts

Former Member
0 Likes
651

what is the statement we use to call an abap program from sap scripts/

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
619

Hi Raj

Here is sample code



/:   DEFINE &TOTALC& = ' '
/:   DEFINE &TOTALD& = ' '
/:   DEFINE &TOTALIC& = ' '
/:   DEFINE &TOTALID& = ' '
/:   DEFINE &TEXT1& = ' '
/:   DEFINE &TEXT2& = ' '
/:   DEFINE &TEXT3& = ' '
/:   DEFINE &GLEXP& = ' '
/:   DEFINE &INVNOS&
/*   DEFINE &W_CHECT&
/E   500
/*   *---------------------------------------------------------------------*
/*   *  Text elements for internal document                                *
/*   *---------------------------------------------------------------------*
/E   510
/*   *- Header text on first page of printed document ---------------------*
/*   &ULINE(72)&
/*   Internal posting document,,,,Page ,,&PAGE&
/*   ,,&PAGE&    &ADRS-LINE0&
AF   &RF140-BEZBSTAT&
/*   &RF140-TITLE&
SR   ,,,,,,               VOUCHER PRINTING
/*   *- Individual memo on internal document ------------------------------*
/:   <b>PERFORM CHEQUE_JNTVENT IN PROGRAM ZFISP0002</b>
/:   USING &BKPF-BELNR&
/:   USING &BSEG-GJAHR&
/:   USING &BSEG-BUKRS&
/:   CHANGING &W_CHECT&
/:   CHANGING &W_HBKID&
/*   CHANGING &W_COMP_DESC&
/:   ENDPERFORM
/*   ENDIF

\

Rewards if helpfull

Regards

Pavan

6 REPLIES 6
Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
619

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&

This Code is to be written in the PO form under ADDRESS window.

-

-


/:DEFINE &A1& = ' '

/:DEFINE &A2& = ' '

/:DEFINE &A3& = ' '

/:DEFINE &A4& = ' '

/:DEFINE &A5& = ' '

/:DEFINE &A6& = ' '

/:PERFORM GET_VENDOR IN PROGRAM ZMFORM_PO

/:USING &EKKO-EBELN&

/:CHANGING &A1&

/:CHANGING &A2&

/:CHANGING &A3&

/:CHANGING &A4&

/:CHANGING &A5&

/:CHANGING &A6&

/:ENDPERFORM

  • &A1&

  • &A2&

  • &A3&

  • &A4&

  • &A5&

  • &A6&

Reward points if useful

Regards,

Sree

Read only

dev_parbutteea
Active Contributor
0 Likes
619

Hi,

/: DEFINE &TOT_PRICE&

/: PERFORM F_GET_PRICE IN PROGRAM <subroutine prog name>

/:USING &KOMVD-KBERT&

/:CHANGING &TOT_PRICE&

/:ENDPERFORM

Then write the variable where ever you want it to be printed (mostly it will be in footer window)

Then create subroutine pool program and you have to write the code.

FORM F_GET_PRICE tables int_cond structure itcsy

outt_cond structure itcsy.

data : value type kbert.

statics value1 type kbert.

Read int_cond table index 1.

value = int_cond-value.

value1 = value1 + value.

Read outt_cond table index 1.

outt_cond-value = value1.

Modify outt_cond index 1.

ENDFORM.

Read only

Former Member
0 Likes
619

Hi,

In ur script write a PERFORM <subroutinename> IN PROGRAM <DRIVER_PGM-NAME>.

Call that report in ur perform which is in the main program using call transaction.

Thanks,

Anitha

Read only

Former Member
0 Likes
619

Hi,

driver program is used to make interface between print program and forms.

Regards

Every SAPScript form has a printer (driver) program. This program collets all data, and fills the script with them. A script contains only the layout, how these data will look on the paper.

SDPACKLI is the standard printer program of the packing list.

Check out NACE transaction, look for the packing list. You'll see the program and its starting form entered here.

You can't start manually a printer program if it is not handling it. You can start it only through its transaction, for example the print of the packing list.

Regards

Read only

Former Member
0 Likes
620

Hi Raj

Here is sample code



/:   DEFINE &TOTALC& = ' '
/:   DEFINE &TOTALD& = ' '
/:   DEFINE &TOTALIC& = ' '
/:   DEFINE &TOTALID& = ' '
/:   DEFINE &TEXT1& = ' '
/:   DEFINE &TEXT2& = ' '
/:   DEFINE &TEXT3& = ' '
/:   DEFINE &GLEXP& = ' '
/:   DEFINE &INVNOS&
/*   DEFINE &W_CHECT&
/E   500
/*   *---------------------------------------------------------------------*
/*   *  Text elements for internal document                                *
/*   *---------------------------------------------------------------------*
/E   510
/*   *- Header text on first page of printed document ---------------------*
/*   &ULINE(72)&
/*   Internal posting document,,,,Page ,,&PAGE&
/*   ,,&PAGE&    &ADRS-LINE0&
AF   &RF140-BEZBSTAT&
/*   &RF140-TITLE&
SR   ,,,,,,               VOUCHER PRINTING
/*   *- Individual memo on internal document ------------------------------*
/:   <b>PERFORM CHEQUE_JNTVENT IN PROGRAM ZFISP0002</b>
/:   USING &BKPF-BELNR&
/:   USING &BSEG-GJAHR&
/:   USING &BSEG-BUKRS&
/:   CHANGING &W_CHECT&
/:   CHANGING &W_HBKID&
/*   CHANGING &W_COMP_DESC&
/:   ENDPERFORM
/*   ENDIF

\

Rewards if helpfull

Regards

Pavan

Read only

Former Member
0 Likes
619

hi,

PERFOM <subroutin name> in Program <Program Name>

ENDPERFORM.

Reward points if it is helpful

Regards,

Sangeetha.a