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

Question about Generate subroutine pool

Former Member
0 Likes
758

codes below is in a enhancement

data: lt_BANF_RS like table of /BSHCN/BANF_RS with header line.

select * from /BSHCN/BANF_RS

into corresponding fields of table lt_banf_rs

where frggr = stn_frggr and

FRGSX = stn_frgst .

LOOP AT lt_banf_rs.

BSH_STRING1 = lt_banf_rs-ifclause.

TAB-LINE = 'PROGRAM subpool.' .

append TAB.

TAB-LINE = `FORM BSH_CHECK_ADD USING CEBAN1 TYPE CEBAN`.

append TAB.

TAB-LINE = ` CHANGING BSH_C TYPE C.` .

append TAB.

TAB-LINE = ` IF ` .

append TAB.

TAB-LINE = BSH_STRING1 .

append TAB.

TAB-LINE = ` . ` .

append TAB.

TAB-LINE = ` BSH_C = 'X'. ELSE. BSH_C = ''. ENDIF. ` .

append TAB.

TAB-LINE = `ENDFORM. ` .

append TAB.

fname = 'BSH_CHECK_ADD'.

*generate subroutine pool TAB name PROG*

*message MESS*

*shortdump-id SID.*

if SY-SUBRC = 0.

perform (FNAME) in program (PROG) USING CEBAN changing bshc if found.

IF SY-SUBRC = 0.

IF bshc = 'X'.

stn_frggr = lt_banf_rs-frggr1.

stn_frgst = lt_banf_rs-frgsx1.

exit.

ENDIF.

ENDIF.

elseif SY-SUBRC = 4.

message MESS type 'S' DISPLAY LIKE 'W'.

elseif SY-SUBRC = 8.

message SID type 'S' DISPLAY LIKE 'W'.

endif.

ENDLOOP.

problem is generation is in a loop, when runing at the 2nd time, it goes wrong

Is there any way of clearing this pool, before I can generate it again?

1 ACCEPTED SOLUTION
Read only

vallamuthu_madheswaran2
Active Contributor
0 Likes
716

Hi WOFR,

Before the select query, clear & Refresh the internal table.

after append TAB give clear tab. like append TAB. clear TAB.

Thanks & Regards,

Vallamuthu M

3 REPLIES 3
Read only

vallamuthu_madheswaran2
Active Contributor
0 Likes
717

Hi WOFR,

Before the select query, clear & Refresh the internal table.

after append TAB give clear tab. like append TAB. clear TAB.

Thanks & Regards,

Vallamuthu M

Read only

0 Likes
716

the error message system gives is that there can only be one "PROGRAM" statement

"Each ABAP program can contain only one "REPORT", "PROGRAM", or "FUNCTION-POOL". statement."

I don't know if there is any way of clearing this whole subroutine pool for another generation?

I am already changing the "if endif" into " if... elseif... elseif.........endif"

hopefully it works

previous question still remains, just for curiosity

Read only

0 Likes
716

Thanks .. It works