Application Development 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: 

How to use subroutine in other forms/subroutines?

walkerist
Participant
0 Kudos

I want to use this FORM or SUBROUTINE in other forms.

FORM Z_SELECT_STATEMENT
SELECT *
FROM J_1BNFSTX
INTO @DATA(IT_J1BNFSTX).
ENDFORM.

Now, I want to use it in this form:

FORM COMP_TAX.
PERFORM Z_SELECT_STATEMENT. "But how do I get the value of the internal from another form into this form?
"I want to use the it_j1bnfstx and maybe loop it into ls_j1bnfstx.
ENDFORM.
FORM COMP_VAT. PERFORM Z_SELECT_STATEMENT.
"I also want to use the data of Z_SELECT_STATEMENT here in this FORM COMP_VAT. ENDFORM.
4 REPLIES 4

matt
Active Contributor
0 Kudos

FORMS are obsolete for new developments, so you shouldn't be using them anyway.

And have you read the documentation on the abap keywords FORM and PERFORM. That should give you your answer.

matt
Active Contributor

I'd give a more detailed answer, but you edit your last question https://answers.sap.com/questions/13993203/how-to-read-the-character-length-the-value-of-a-fi.html to "wrong question", so I'm not sure it's worth it.

Sandra_Rossi
Active Contributor
0 Kudos

You must NOT do it that way. Please explain the problem you have originally, not the XY problem.

walkerist
Participant
0 Kudos

@Matthew.Billingham WELP. Apologies for that. I have constructed the wrong question.