cancel
Showing results for 
Search instead for 
Did you mean: 

Perform statement in sapscript forms

Former Member
0 Kudos

Hello

I'm using standard print program for Dunning letters.

Now I change sapscript form where I need to putt first and last user name.

I have that code (which gets names from SY_USRNAME) already written in another Z-print program (for Invoices).

So Is it possible via PERFORM to get that data (from different print program)?

I need to call/execute only that form in print program which converts sy-usrname to firs/last user name.

Thanks in advance

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos
Former Member
0 Kudos

If your existing subroutine is used in SAPscript already (ie has the structure FORM GET_SOMETHING TABLES IN_PAR STUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.) then you can reuse it.

Because the SAPscript command has the strucutre

/: PERFORM GET_SOMETHING IN PROGRAM Z_PROGNAME you can specify any program name, it doesn't have to be the SAPscript's print program, or a print program at all.

Regards.

Nick

Former Member
0 Kudos

Thanks Nick could you help me little more please?

Te program is called - ZRVADIN01; form is - GET_DATA

Below is part which is needed.

1. So in sapscript for I should putt or ?:

/:PERFORM GET_DATA in program ZRVADIN01

2. Should I use also - USING statement. If Yes which variable should stay after USING.

  • creator's name

name_last = sy-uname.

name_first = ' '.

SELECT SINGLE persnumber FROM usr21 INTO usr21-persnumber

WHERE bname = vbdkr-ernam.

if sy-subrc = 0.

SELECT SINGLE name_first name_last

INTO (adrp_name_first, adrp_name_last)

FROM adrp

WHERE persnumber = usr21-persnumber

and date_from le sy-datum

and nation = ' '

and date_to ge sy-datum.

if sy-subrc = 0.

name_last = adrp_name_last.

name_first = adrp_name_first.

endif.

endif.

Former Member
0 Kudos

In your SAPscript you'll need;

/:PERFORM GET_DATA in program ZRVADIN01

/:USING &USERNAME&

/:CHANGING &LASTNAME&

/:CHANGING &FIRSTNAME&

(the variables &USERNAME& etc are examples, use whatever variable names you have in your SAPscript)

Regards,

Nick

Former Member
0 Kudos

After:

/: PERFORM GET_DATA IN PROGRAM ZRVADIN01

/: USING &USERNAME&

/: CHANGING &NAME_FIRST&

/: CHANGING &NAME_LAST&

/: ENDPERFORM

AS &NAME_FIRST&

I've got dump

Runtime errors PERFORM_TOO_MANY_PARAMETERS

Exception CX_SY_DYN_CALL_PARAM_NOT_FOUND

Occurred on 30.07.2007 at 14:43:42

Error analysis

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class

'CX_SY_DYN_CALL_PARAM_NOT_FOUND', was neither

caught nor passed along using a RAISING clause, in the procedure

"CO_ENDPERFORM" "(FORM)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

A PERFORM was used to call the routine "CO_ENDPERFORM" of the program

"SAPLSTXC".

This routine contains exactly 0 formal parameters, but the current

call contains 4 actual parameters.

parameters.

Former Member
0 Kudos

Does the start of your subroutine GET_DATA in program ZRVADIN01 have the following structure?

FORM GET_DATA TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.

Regards,

Nick

Former Member
0 Kudos

No this structure is missing):

Unfortunately I'm not allowed to change programs):

Could you give me some other advice (only writting in sapforms) how to get first and last user name.

Is it possible to write code for substitution sy-uname with First Last name directlly in sapscript form?

Some gay in similar topic suggested to use v_usr_name database view - FM : BAPI_USER_GET_DETAIL .

If is it usefull could you explain me how can I use it?

Former Member
0 Kudos

Hi,

Unfortunately, the only way to get data not already included in your SAPscript is to call a subroutine in an external program, but there are limitations on how the subroutine can be defined. SAP help has more detail;

<a href="http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb3d07455611d189710000e8322d00/frameset.htm">SAPscript help</a>

But I think you're going to need an ABAPer.

Regards,

Nick