cancel
Showing results for 
Search instead for 
Did you mean: 

Problems using PERFORM in SAPScript

Former Member
0 Kudos

Hi all,

I have entered the following code in my SAPScript:


/E   T1
/:    DEFINE &V_DESCRIPTION& = ' '
/:    PERFORM GET_DESCRIPTION IN PROGRAM ZGET_DESCRIPTION
/:    USING &MSEG-MATNR&
/:    CHANGING &V_DESCRIPTION&
/:    ENDPERFORM
*     &V_DESCRIPTION&

However, the form GET_DESCRIPTION/the program ZGET_DESCRIPTION is not called at all... I have tried to move the PERFORM statement around a bit to see if another location in the script would trigger the call, but unfortunately this did not work.

Does anyone have any tips on how to solve this...? <REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>

Regards,

MV

<MOVED BY MODERATOR TO THE CORRECT FORUM>

Edited by: Alvaro Tejada Galindo on Aug 18, 2008 4:58 PM

Accepted Solutions (0)

Answers (12)

Answers (12)

antony_paul2
Active Participant
0 Kudos

Hi,

Is the program ZGET_DESCRIPTION Active ???

Regards,

Antony

Former Member
0 Kudos

Hi Mari,

in Sapscript the right use from the perform- statement is :

/: PERFORM 'GET_DESCRIPTION' IN PROGRAM 'ZGET_DESCRIPTION'

you have to put the Form-Routine and the Programm in brights

and the Form-Routine must be in upercase in sapscript and in the programm

i hope i could help you

maria

Former Member
0 Kudos

Hi,

In the Perform Command Put the program name ZGET_DESCRIPTION withi Quotes like

PERFORM GET_DESCRIPTION IN PROGRAM 'ZGET_DESCRIPTION'

--Neha

Former Member
0 Kudos

Hi Mari,

In your form - endform... executable program...use conversion exit for material

read table in_tab index 1.

call function conversion_exit_matn1_input.

This should work

any queries revert back

regards

padma

former_member196280
Active Contributor
0 Kudos

I guess, the element T1 is not getting triggered in your case, so that is the reason it is not calling your sub-routine. To test whether your sub-routine pool is getting called or not, try to shift your sub-routine call under, to the first line of your main window, that is the lines that are getting displayed in your main window.

/: DEFINE &V_DESCRIPTION& = ' '

/: PERFORM GET_DESCRIPTION IN PROGRAM ZGET_DESCRIPTION

/: USING &MSEG-MATNR&

/: CHANGING &V_DESCRIPTION&

/: ENDPERFORM

Now, keep debugger in your sub-routine pool, make sure your sub-routine pool is active.

Also, note.. this could occur because of other reasons, make sure all your if statments inside your Form main window or other windows are concluded with endif. Sometimes, because of this it may not trigger the sub-routine calls.

Close the thread once your question is answered.

Regards,

SaiRam

jj
Active Contributor
0 Kudos

The best way is to debug sapscript and also put a break-point in the report program.

and check whether the control to going to that program where the form is written

former_member585060
Active Contributor
0 Kudos

Hi,

Debug the SAPScript and see whether ur ELEMENT T1 is triggering or not.

Try to declare ur perform statement in main window where ur items fields r displaying, its only to check wether ur perform working or not.

For text description u defined, check in the SAPScript which u r modifying for a variable which has a Text value in it or add any value to ur Defined V_DESCRIPTION.

Create a subroutine type program in SE38

No need to put period'.', after PERFORM or ENDPERFORM statement.

Former Member
0 Kudos

Hi again,

As I wrote above, the T1 element is triggered - I know this because the rest of the text output in element T1 is displayed correctly when running the script.

If I comment out the PERFORM statement in the SAPScript, and only use the following:


/:	 	DEFINE &V_DESCRIPTION& = '(description)'
*	 	&V_DESCRIPTION&

...the text "(description)" is displayed correctly when running the script.

Can there be any other reasons why the PERFORM statement isn't triggered...?

Regards,

MV

former_member585060
Active Contributor
0 Kudos

Check if the MATNR has any value, try to Delete all the lines of PERFORM statement and write it again in new lines.

Ur statement is correct, just try to delete and write again,

Check wether any difference.

Former Member
0 Kudos

Hi again,

I have tried to put the PERFORM statement in various positions in the T1 element, also at the very beginning - but the form is still not called... I have also checked that the MSEG-MATNR field actually does contain a value.

Is there anything else, e.g. a setting in the script, that might cause the PERFORM statement not to be called...?

Regards,

MV

Former Member
0 Kudos

Hi,

Your text element is executing means your perform should execute. Did you placed break point in between form and endform and concluded that your perform does not executing. If not place break point between them and execute the script if the execution stops at that break point then problem is with your code written between form and endform which brings value to description variable. Please check that. There may be other reason for perform not calling check the program name you have written that correctly or not.

Hope this will give you some idea.

Regards,

Aswini.

Former Member
0 Kudos

Hello,

I have placed a breakpoint in the program ZGET_DESCRIPTION, in the form GET_DESCRIPTION. This does not trigger the debugger, so I guess that means that the PERFORM statement is not called. Also, I have double checked both the names of the program and the form in the PERFORM statement...

Regards,

MV

Sougata
Active Contributor
0 Kudos

Hi,

Activate the SAPScript Debugger and continue debugging to the PERFORM statement then as far as I remember there is an option in one of the menubars of the sapscript debugger that lets you get into the SAP standard ABAP behind the SAPScript i.e. the Print Program behind the sapscript. You need to single step till this point to confirm if your routine is called by your sapscript - then if it is being called see that its got some value in the V_DESCRIPTION field that you are trying to print. If all fails search this forum well and you will find an answer!

Cheers,

Sougata.

Former Member
0 Kudos

Hi,

Check the program name but not the form name. means the name of the program you have written in perform statement and the actual name of the program. If both are same your perform will definitely triggers please check that. though they are same there may be no data found for selected input, check the data given for input and the conversion routines.

Regards,

Aswini.

narin_nandivada3
Active Contributor
0 Kudos

Hi Virik,

Check whether your text element is getting triggered first or not,.... or else just comment the text element and try directly triggering the Perform statement..

What you had written is syntactically and logically sounds correct ...

try specifying that if you hadn't.

Just specify the below code in Executable program ZGET_DESCRIPTION.

FORM GET_DESCRIPTION Tables in_tab structure itcsy
                                                out_tab structure itcsy.  

ENDFORM

Hope this would help you,.

Good luck

Narin

Former Member
0 Kudos

Put '.' after end perform.

Former Member
0 Kudos

did you create ZGET_DESCRIPTION with sub routine pool or excutable program ?..

we need to create ZGET_DESCRIPTION with sub routine pool .

Tks .. venkat

Former Member
0 Kudos

Hi all,

Thanks for your quick replies!

Here is my program:


REPORT  zget_description.

FORM get_description TABLES i_in STRUCTURE itcsy i_out STRUCTURE itcsy.

...

ENDFORM.

- The program is of the type "Executable program".

- The T1 text element in the SAPScript is triggered.

- Putting a period "." after ENDPERFORM did not work.

Any other ideas...?

Regards,

MV

former_member585060
Active Contributor
0 Kudos

Try to code the PERFORM statement immediately after the TEXT emement T1.

try this code.

FORM get_description TABLES i_in STRUCTURE itcsy i_out STRUCTURE itcsy.

DATA : w_matnr type MSEG-MATNR,

w_agtxt TYPE tmamt-agtxt.

READ TABLE in_tab INDEX 1.

w_matnr = in_tab-value.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = w_matnr

IMPORTING

output = w_matnr.

SELECT query.

READ TABLE out_tab INDEX 1.

MOVE w_agtxt TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDFORM.

Former Member
0 Kudos

Looks like you are using the subroutine call from a text element T1. Is this text element triggered?

Sougata
Active Contributor
0 Kudos

Hello Mari,

Please make sure that the subroutine is coded in an Executable program i.e. in program attributes the Type is 1->Executable Program, and also make sure your ABAP routine is passing TABLES that is LIKE STRUCTURE ITCSY. See an example below.


FORM get_work_centre TABLES input   STRUCTURE itcsy
                            output  STRUCTURE itcsy.

  TABLES: afih,
          crhd.

  CONSTANTS: c_order_no(10)    TYPE c VALUE 'MSEG-AUFNR',
             c_work_centre(12) TYPE c VALUE 'CAUFVD-VAPLZ',
             c_plant(12)       TYPE c VALUE 'CAUFVD-VAWRK'.

  DATA:      v_order_no        TYPE aufnr,
             v_work_centre     LIKE crhd-arbpl,
             v_plant           LIKE crhd-werks.


* read value of Order number and move to a variable
  READ TABLE input WITH KEY c_order_no.
  CHECK sy-subrc = 0.
  v_order_no = input-value.

* convert Order Number to internal format
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
       EXPORTING
            input  = v_order_no
       IMPORTING
            output = v_order_no.

* read Work Centre number & Plant values for the order
  SELECT SINGLE iwerk pm_objty gewrk FROM afih
         INTO  (v_plant, afih-pm_objty, afih-gewrk)
         WHERE aufnr = v_order_no.
  CHECK sy-subrc = 0.

  SELECT SINGLE arbpl FROM crhd
         INTO  v_work_centre
         WHERE objty = afih-pm_objty
         AND   objid = afih-gewrk.
  CHECK sy-subrc = 0.

* pass & modify the values to transfer table back to SAPSCRIPT
  LOOP AT output.
    CASE output-name.
      WHEN c_plant.
        output-value = v_plant.
      WHEN c_work_centre.
        output-value = v_work_centre.
    ENDCASE.
    MODIFY output INDEX sy-tabix.
  ENDLOOP.

ENDFORM.

Hope this helps.

Cheers,

Sougata.