cancel
Showing results for 
Search instead for 
Did you mean: 

new script (invoice)requirement urgnet...

Former Member
0 Kudos

Hi All,

I need help on this script,i am developing the first script So i need

help on how to start a script.how to write external subroutines, and how to fetch data to layout.how to write print program?

here i mention the requirement .

<b>requirement</b>

<b>Business Functionality</b>

Printing of the pro-forma invoice is needed to be sent to the customer after the sales order document and purchase order document are created and before the actual delivery and invoicing of the export sales order is done.

Major Features

The pro-forma invoice should include the following in the header section:

-company name and address

- Sales order information

- Bill-to customer information

- Ship-to customer information

- Delivery information

The pro-forma invoice should include the following in the item section:

- Quantity

- Product ID and description

- Line weight in pounds

- Country of origin

- Unit discount

- Unit price

- Total price

The pro-forma invoice sorted by category, by brand and finally in alphabetical order in terms of description.

The pro-forma invoice should include the following in the totals section:

- Subtotal (Total price)

- Applicable taxes

- Quantity allowance discount, if any

- Freight amount

- Total amount of the invoice

The pro-forma invoice should contain, in the last page, some hard-coded text as detailed in the attached form layout.

User Procedures

Describe the user procedures required.

Check Lists

Describe the checklists required.

Restart/Recovery Strategy

Identify the strategy to be used for restart and recovery needs.

<b></b>

Thnks

Arnald.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

For calling Subroutines:

You can use the PERFORM command to call an ABAP subroutine (form) from any program, subject to the normal ABAP runtime authorization checking. You can use such calls to subroutines for carrying out calculations, for obtaining data from the database that is needed at display or print time, for formatting data, and so on.

PERFORM commands, like all control commands, are executed when a document is formatted for display or printing. Communication between a subroutine that you call and the document is by way of symbols whose values are set in the subroutine.

Syntax in a form window:

/: PERFORM <form> IN PROGRAM <prog>

/: USING &INVAR1&

/: USING &INVAR2&

......

/: CHANGING &OUTVAR1&

/: CHANGING &OUTVAR2&

......

/: ENDPERFORM

INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.

OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.

The ABAP subroutine called via the command line stated above must be defined in the ABAP report prog as follows:

FORM <form> TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

...

ENDFORM.

Definition in the SAPscript form:

/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO

/: USING &PAGE&

/: USING &NEXTPAGE&

/: CHANGING &BARCODE&

/: ENDPERFORM

/

/ &BARCODE&

Coding of the calling ABAP program:

REPORT QCJPERFO.

FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA: PAGNUM LIKE SY-TABIX, "page number

NEXTPAGE LIKE SY-TABIX. "number of next page

READ TABLE IN_PAR WITH KEY ‘PAGE’.

CHECK SY-SUBRC = 0.

PAGNUM = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY ‘NEXTPAGE’.

CHECK SY-SUBRC = 0.

NEXTPAGE = IN_PAR-VALUE.

READ TABLE OUT_PAR WITH KEY ‘BARCODE’.

CHECK SY-SUBRC = 0.

IF PAGNUM = 1.

OUT_PAR-VALUE = ‘|’. "First page

ELSE.

OUT_PAR-VALUE = ‘||’. "Next page

ENDIF.

IF NEXTPAGE = 0.

OUT_PAR-VALUE+2 = ‘L’. "Flag: last page

ENDIF.

MODIFY OUT_PAR INDEX SY-TABIX.

ENDFORM.

For more info on developing scripts read this:

You have to create seperate windows for :

- Sales order information

- Bill-to customer information

- Ship-to customer information

- Delivery information

First find out all the revelant fields which u wanna display in each window.

For text related data u can use standard includes in ur script windows n Create standard text in So10.

At first see a few basic things related to scripts n u will b able to follow this out soon.

U can ask me back if any point is unclear or for more info....

Regards,

Sapna A.