cancel
Showing results for 
Search instead for 
Did you mean: 

Perform for the SAPScript

Former Member
0 Kudos

Hi Friends,

I need to get the address for the company and print as test 'REMIT TO:........'

I tried to get the name,street,region and post_code1 from table ADRC.

I tested it but only one value is passed to the form.

please let me know how to write to get the above for values by using the compnay code BUKRS.

using BUKRS'

changing 'NAME1'

'STREET'

'REGION'

POST_CODE1'.

thanks&regards

SK

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Naren,

I have done the same. but I can only get the value for V_NAME1.

the output_tab only has V_name1 entry.

please see the coding below.

please check and correct me where I am wrong.

<b>From Form</b> :

/:DEFINE &V_BUKRS& = &BKORM-BUKRS&

/:DEFINE &V_NAME1& = 'ABCSDED 123limited1311131313113 '

/:DEFINE &V_STREET& = '11111111111111111111111111111 '

/:DEFINE &V_REGION& = 'NC'

/:DEFINE &V_POSTCODE1& = '13111-0000'

/:PERFORM GET_COMP_NAME IN PROGRAM ZACC_STATEMNT_COMP

/:USING &V_BUKRS&

/:CHANGING &V_NAME1&

/:CHANGING &V_STREET&

/:CHANGING &V_REGION&

/:CHANGING &V_POSTCODE1&

ENDPERFORM

REMIT TO:&v_NAME1&,,&V_STREET&,,&V_REGION&,,&V_POSTCODE1&,,

<S>Page &PAGE& of &SAPSCRIPT-FORMPAGES&

</>

program:

FORM get_comp_name TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

READ TABLE in_tab WITH KEY 'v_bukrs'.

SELECT b~name1

b~street

b~region

b~post_code1

INTO TABLE gt_adrc

FROM t001 AS a INNER JOIN adrc AS b

ON aadrnr = baddrnumber

WHERE bukrs = in_tab-value.

READ TABLE OUT_TAB WITH KEY 'V_NAME1'.

IF sy-subrc EQ 0.

MOVE gt_adrc-name1 TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

READ TABLE OUT_TAB WITH KEY 'V_STREET'.

IF sy-subrc EQ 0.

MOVE gt_adrc-street TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

READ TABLE OUT_TAB WITH KEY 'V_REGION'.

IF sy-subrc EQ 0.

MOVE gt_adrc-region TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

READ TABLE OUT_TAB WITH KEY 'V_POSTCODE1'.

IF sy-subrc EQ 0.

MOVE gt_adrc-post_code1 TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

ENDFORM. " get_comp_name

thanks

SK

Answers (5)

Answers (5)

Former Member
0 Kudos

I hsve solved problem.

thanks

SK

Former Member
0 Kudos

Hi

About Syntax in a form window:

/: PERFORM <form> IN PROGRAM <prog>

/: USING &INVAR1&

/: USING &INVAR2&

......

/: CHANGING &OUTVAR1&

/: CHANGING &OUTVAR2&

......

/: ENDPERFORMINVAR1 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.

The values of the SAPscript symbols passed with /: USING... are now stored in the internal table IN_TAB . Note that the system passes the values as character string to the subroutine, since the field Feld VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR 80). See the example below on how to access the variables.

The internal table OUT_TAB contains names and values of the CHANGING parameters in the PERFORM statement. These parameters are local text symbols, that is, character fields. See the example below on how to return the variables within the subroutine.

From within a SAPscript form, a subroutine GET_BARCODE in the ABAP program QCJPERFO is called. Then the simple barcode contained there (‘First page’, ‘Next page’, ‘Last page’) is printed as local variable symbol.

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.

Thanks

Ravi

Former Member
0 Kudos

Hi,

Sorry the above post is not clear..Please post the subroutine code..

Thanks,

Naren

Former Member
0 Kudos

Hi,

Have the changing as variables...

Ex..

1)

/: DEFINE &V_NAME& := ''

/: DEFINE &V_STREET& := ''

/: DEFINE &V_REGION& := ''

/: DEFINE &V_POST_CODE& := ''

/: PERFORM <form> IN PROGRAM ZREPORT1

/: USING &V_BUKRS&

/: CHANGING &V_NAME&

/: CHANGING &V_STREET&

/: CHANGING &V_REGION&

/: CHANGING &V_POST_CODE&

/: ENDPERFORM

2)

The subroutine should have the following formal parameters..

FORM <form> TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

...

ENDFORM.

Check this link for more details..

http://help.sap.com/saphelp_46c/helpdata/EN/d1/802fd3454211d189710000e8322d00/frameset.htm

Thanks,

Naren

Former Member
0 Kudos

Sorry I didn't look on varaible side.. editing message.

ignore this

Message was edited by:

Sujamol Augustine