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

SapScript Userexit

dmi
Participant
0 Likes
1,005

Hi together

I may create the SD forms with SapScript for a customer.

It's possible to insert my own code without to copy the original program to a Z-program? (rvador01, rvadin01, rvaddn01)

I want to have my own modul for reading additional data in a separate include program.

Is there a user-exit, or do you know an other way?

I try to avoid, that I have to change my Z-program if SAP will change the original programm.

Thanks a lot for your anwser

Daniel

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
750

Hi

Yes you can!

Infact you can insert PERFORM statament in your SAPSCRIPT: see the help:

http://help.sap.com/saphelp_46c/helpdata/en/d2/cb3d07455611d189710000e8322d00/frameset.htm

Anyway this is an extrac of the help:

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.

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.

...........

So for example:

/: PERFORM MY_FORM IN PROGRAM ZMY_PROGRAM

/: USING &INVAR1&

/: CHANGING &OUTVAR1&

/: ENDPERFORM

REPORT ZMY_PROGRAM

FORM MY_FORM TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

DATA: INVAR1 LIKE ...

  • Get the input data:

READ TABLE IN_TAB WITH KEY NAME = 'INVAR1'.

IF SY-SUBRC = 0.

MOVE IN_TAB-VALUE TO INVAR1.

IF INVAR1 = 'A'.

OUTVAR1 = 'B'.

  • Update output data

READ TABLE OUT_TAB WITH KEY NAME = 'OUTVAR1'.

IF SY-SUBRC = 0.

MOVE OUTVAR1 TO OUT_TAB-VALUE.

MODIFY OUT_TAB INDE SY-TABIX.

ENDIF.

ENDIF.

ENDIF.

ENDFORM.

Max

Message was edited by: max bianchi

2 REPLIES 2
Read only

Former Member
0 Likes
751

Hi

Yes you can!

Infact you can insert PERFORM statament in your SAPSCRIPT: see the help:

http://help.sap.com/saphelp_46c/helpdata/en/d2/cb3d07455611d189710000e8322d00/frameset.htm

Anyway this is an extrac of the help:

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.

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.

...........

So for example:

/: PERFORM MY_FORM IN PROGRAM ZMY_PROGRAM

/: USING &INVAR1&

/: CHANGING &OUTVAR1&

/: ENDPERFORM

REPORT ZMY_PROGRAM

FORM MY_FORM TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

DATA: INVAR1 LIKE ...

  • Get the input data:

READ TABLE IN_TAB WITH KEY NAME = 'INVAR1'.

IF SY-SUBRC = 0.

MOVE IN_TAB-VALUE TO INVAR1.

IF INVAR1 = 'A'.

OUTVAR1 = 'B'.

  • Update output data

READ TABLE OUT_TAB WITH KEY NAME = 'OUTVAR1'.

IF SY-SUBRC = 0.

MOVE OUTVAR1 TO OUT_TAB-VALUE.

MODIFY OUT_TAB INDE SY-TABIX.

ENDIF.

ENDIF.

ENDIF.

ENDFORM.

Max

Message was edited by: max bianchi

Read only

0 Likes
750

dear Max

many thanks, thats a very good and easy soloution,

have a good time

Daniel