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

FORMS/SUBROUTINES

ravi_sirigiri
Participant
0 Likes
566

Type group : CNTL.

-


TYPES: BEGIN OF CNTL_SIMPLE_EVENT,

EVENTID TYPE I,

APPL_EVENT TYPE C,

END OF CNTL_SIMPLE_EVENT.

TYPES: CNTL_SIMPLE_EVENTS TYPE TABLE OF CNTL_SIMPLE_EVENT.

-


Program: ZPROGRAM.

DATA: event_tab_main TYPE cntl_simple_events.

How to pass this event_tab_main (which is define in the type group:CNTL) to a subroutine/form(syntax).when i am using

FORM xyz tables event_tab_main.

ENDFORM.

its giving an error.

Thanks in advance.

Ravi

Type group : CNTL.

-


TYPES: BEGIN OF CNTL_SIMPLE_EVENT,

EVENTID TYPE I,

APPL_EVENT TYPE C,

END OF CNTL_SIMPLE_EVENT.

TYPES: CNTL_SIMPLE_EVENTS TYPE TABLE OF CNTL_SIMPLE_EVENT.

-


Program: ZPROGRAM.

DATA: event_tab_main TYPE cntl_simple_events.

How to pass this event_tab_main (which is define in the type group:CNTL) to a subroutine/form(syntax).when i am using

FORM xyz tables event_tab_main.

ENDFORM.

its giving an error.

Thanks in advance.

Ravi

4 REPLIES 4
Read only

aris_hidalgo
Contributor
0 Likes
527

Hi Ravi,

Here is an example:

TYPES: BEGIN OF T_X,

INCLUDE STRUCTURE SFLIGHT.

TYPES: ADDITION(8) TYPE C,

END OF T_X.

DATA: X TYPE STANDARD TABLE OF T_X WITH NON-UNIQUE DEFAULT KEY

INITIAL SIZE 0,

...

PERFORM U TABLES X.

...

FORM U TABLES X STRUCTURE SFLIGHT.

WRITE: X-FLDATE.

ENDFORM.

Regards!

P.S. Please award points for useful answers

Read only

Former Member
0 Likes
527

Do this

FORM xyz tables event_tab_main <b>STRUCTURE CNTL_SIMPLE_EVET </b>.

ENDFORM.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

Former Member
0 Likes
527

Hi Ravi,

Go through the below link on subroutines,

http://help.sap.com/saphelp_47x200/helpdata/en/9f/db975c35c111d1829f0000e829fbfe/frameset.htm

Also go through the sample programs <b>demo_mod_tech_describe</b>

<b>demo_mod_tech_example_1

demo_mod_tech_example_2

demo_mod_tech_example_3

demo_mod_tech_example_4

demo_mod_tech_example_5

demo_mod_tech_example_6</b>

in your abap editor.

Regards,

Azaz Ali.

Message was edited by: Azaz Ali

Message was edited by: Azaz Ali

Read only

Former Member
0 Likes
527

Hi Ravi,

You can pass an internal table into a Function Module.

Just go through my post in this SDN link...

I think similar case should work with Subroutines also.

Just try this:

DATA: event_tab_main TYPE TABLE OF CNTL_SIMPLE_EVENT.

After filling the internal table with values, you can pass the internal table as

PERFORM CALL_FORM USING event_tab_main.

In the Form statement, do like this

FORM call_form TABLES itab TYPE CNTL_SIMPLE_EVENTS.

ENDFORM.

Create a local structure like this:

data wa_itab type cntl_simple_events.

loop at wa_itab into wa_itab.

endloop.

<b>By the way, what kind of error is occuring...?</b>

Regards,

SP.