cancel
Showing results for 
Search instead for 
Did you mean: 

how to add a field to standard script?

Former Member
0 Kudos

Hi everybody,

I hope u enjoying great weekends!

Im getting confusion in the following concept,

can anybody sort it out for m

how to add a field to standard script?,I know we have to call a subroutine in form

editor,but could u pls provide me a detailed example .

waiting for reply,

thanks

Mr.Reddy

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

<b>Definition in the SAPscript form:</b>

/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO

/: USING &PAGE&

/: USING &NEXTPAGE&

/: CHANGING &BARCODE&

/: ENDPERFORM

/ &BARCODE&

<b>Coding of the calling ABAP program:</b>

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.

<b>To know more about subroutine pool see below link</b>

Former Member
0 Kudos

Hi Srikanth Reddy,

Thanks for ur reply,

I have gone through ur example but dint understand the purpose of that ,

can u pls explain me in a clear way beacuse Im new to adding new fields to scripts

waiting for u r reply,

Mr.Reddy.

Former Member
0 Kudos

/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO

/: USING &PAGE&

/: USING &NEXTPAGE&

/: CHANGING &BARCODE&

/: ENDPERFORM

/ &BARCODE&

<b>In the textelement of sapscript i am calling subroutine GET_BARCODE present in program QCJPERFO and passing PAGE , NEXTPAGE as input parameters and Barcode as changing parameter (output)</b>

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

<b>// Here in_par is table for input parameters is of type itcsy , so contains name and value as fields.

// 1st record of in_par in_par-name = PAGE in_par-value = the current page number

// (eq. 1 or 2 etc ... )

// 2nd record of in_par in_par-name = NEXTPAGE in_par-value = the Next page //number (eq. if page = 1 then next page = 2 etc ... )

// Here out_par is table for changing parameters ( output ) is of type itcsy .

// since i am passing only one changing parameter it contains only one record

// 1st record of out_par out_par-name = BARCODE out_par-value = ...(some value)

</b>

READ TABLE IN_PAR WITH KEY ‘PAGE’.

<b>// reading the records from in_par where field name is PAGE , so first record is selected from our table</b>

CHECK SY-SUBRC = 0.

PAGNUM = IN_PAR-VALUE.

<b>// Page number is stored in variable PAGNUM</b>

READ TABLE IN_PAR WITH KEY ‘NEXTPAGE’.

<b>// reading the records from in_par where field name is NEXTPAGE , so second record is selected from our table</b>

CHECK SY-SUBRC = 0.

NEXTPAGE = IN_PAR-VALUE.

<b>// Next Page number is stored in variable NEXTPAGE</b>

READ TABLE OUT_PAR WITH KEY ‘BARCODE’.

<b>// reading the records from out_par where field name is BARCODE , so first record is selected from our table</b>

CHECK SY-SUBRC = 0.

IF PAGNUM = 1.

OUT_PAR-VALUE = ‘|’. "First page

<b>// if the variable PAGNUM value is one then i am storing | in OUT_PAR-VALUE ie, BARCODE</b>

ELSE.

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

<b>// if the variable PAGNUM value is not one then i am storing || in OUT_PAR-VALUE ie, BARCODE</b>

ENDIF.

IF NEXTPAGE = 0.

<b>// if the variable NEXTPAGE value is Zero then i am storing L in OUT_PAR-VALUE ie, BARCODE</b>

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

ENDIF.

MODIFY OUT_PAR INDEX SY-TABIX.

<b>// After changing the field value of output table , i am modifying to reflect the changes.

// Now barcode contains the changed value ie, either | or || or L depending on the condition satified </b>

ENDFORM.

<b>That changed value i am printing in sapscript

/ &BARCODE&</b>

Former Member
0 Kudos

I appreciate u r paitence.

I will be in touch with u through mail.

Thankyou Srikanth Reddy.

Regards,

Sridhar Reddy

Former Member
0 Kudos

Thanks a lot,but I forgot to ask ur mailid?

mine is abapdoubts@gmail.com.

pls send me a blank mail

Former Member
0 Kudos

HI

Can anyone please tell me how to add a <b>PO number field</b> for the RVINVOICE01 form.this form already has <b>contract number, the order number and item number</b> So i need to add an extra field i.e <b>PO number field</b> in the same line.

Please give me a sample code for this. as i havent worked before on scripts.Very urgent. will be rewarded for this. my yahoo id is kumars_sap@yahoo.co.in

thanks.

rallabandi.

Answers (0)