Skip to Content
author's profile photo Former Member
Former Member

Perform in script

Dear All,

I am using perform statement in script.

the code for subroutine in separate program type (e).

But unable to get the output.

Following is my code of subroutine & form.

Regards,

Dilip

Script code

/:PERFORM GET_VAL IN PROGRAM ZGET_VAL

/:USING &IT_MARA-MATNR&

/:CHANGING &DESCR&

/:ENDPERFORM

Subroutine code

Form get_val tables in_tab structure itcsy

out_tab structure itcsy.

select * from makt into table it_makt

where matnr = in_tab-value.

data temp(40).

loop at it_makt.

temp = it_makt-maktx.

out_tab-name = 'maktx'.

out_tab-value = temp.

append out_tab.

endloop.

endform.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 09, 2005 at 11:30 AM

    Dear Brad,

    Thanks for u r prompt reply.

    in_tab-name = it_mara-matnr

    but in_tab-value is blank.

    becoz of that it is not executing the query , is there any reason that in_tab-value is ''.

    is there is wrong in calling of subroutine.

    /:PERFORM GET_VAL IN PROGRAM ZGET_VAL

    /:USING &IT_MARA-MATNR&

    /:CHANGING &DESCR&

    /:ENDPERFORM

    Regards,

    Dilip

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 09, 2005 at 11:10 AM

    Hi Diliip,

    Try the following addition in your subroutine before your select statement:

      CLEAR: in_tab
      READ TABLE in_tab WITH KEY name = 'IT_MARA-MATNR'.
      IF not in_tab-value IS INITIAL.
         SELECT .....
      ENDIF.
    

    Then when you are setting the text, handle it like this:

      CLEAR: out_tab.
      READ TABLE out_tab WITH KEY name = 'DESCR'.
      out_tab-value = it_makt-maktx.
      MODIFY out_tab index sy-tabix.
    

    Also, you should pass the SAPscript language to the subroutine to make sure you select the correct language for the material description.

    Cheers,

    Brad

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.