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

ABAP code

Former Member
0 Likes
786

Hi All,

We have program in R/3 wherin we have the Records which gets stored in the internal table & this internal table is further sent to BW as an IDOC.The internal table is defined to its maximum size.

The problem i think is the number of records are exceeding the internal table's maximum size & becoz of that it gets stuck up & goes in definite loop or something....

I am new to ABAP can anyone give a thougt on it ..like how to fix the problem when the internal table size is exceeding the

maximum size.Do we need to add some kind of code..code would be a great help!!

Thanks!

Pallavi Pande

5 REPLIES 5
Read only

peter_ruiz2
Active Contributor
0 Likes
753

hi,

can you paste your code here so that we can analyze what is wrong on the program.

thanks,

Peter

Read only

0 Likes
753
  • Check DataSource validity

CASE i_dsource.

WHEN 'ZBW_EXTRACT_FORECAST_DATA'.

WHEN OTHERS.

IF 1 = 2. MESSAGE e009(r3). ENDIF.

  • this is a typical log call. Please write every error message like this

log_write 'E' "message type

'R3' "message class

'009' "message number

i_dsource "message variable 1

' '. "message variable 2

RAISE error_passed_to_mess_handler.

ENDCASE.

APPEND LINES OF i_t_select TO s_s_if-t_select.

  • Fill parameter buffer for data extraction calls

s_s_if-requnr = i_requnr.

s_s_if-dsource = i_dsource.

s_s_if-maxsize = i_maxsize.

  • s_s_if-maxsize = 50. "select only 50 work centers at a time

  • Fill field list table for an optimized select statement

  • (in case that there is no 1:1 relation between InfoSource fields

  • and database table fields this may be far from beeing trivial)

APPEND LINES OF i_t_fields TO s_s_if-t_fields.

ELSE. "Initialization mode or data extraction ?

************************************************************************

  • Data transfer: First Call OPEN CURSOR + FETCH

  • Following Calls FETCH only

************************************************************************

  • First data package -> OPEN CURSOR

IF s_counter_datapakid = 0.

  • Fill range tables BW will only pass down simple selection criteria

  • of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'ARBPL'.

MOVE-CORRESPONDING l_s_select TO l_r_arbpl.

APPEND l_r_arbpl.

ENDLOOP.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'WERKS'.

MOVE-CORRESPONDING l_s_select TO l_r_werks.

APPEND l_r_werks.

ENDLOOP.

g_cursor_counter = 0.

  • Determine number of database records to be read per FETCH statement

  • from input parameter I_MAXSIZE. If there is a one to one relation

  • between DataSource table lines and database entries, this is trivial.

  • In other cases, it may be impossible and some estimated value has to

  • be determined.

OPEN CURSOR WITH HOLD s_cursor FOR

SELECT objid arbpl verwe werks kapid veran FROM crhd

WHERE objty = 'A' AND

werks IN l_r_werks AND

arbpl IN l_r_arbpl.

ENDIF. "First data package ?

  • Fetch records into interface table.

  • named E_T_'Name of extract structure'.

DO.

IF g_cursor_counter = 1.

CLOSE CURSOR s_cursor.

RAISE no_more_data.

EXIT.

ENDIF.

FETCH NEXT CURSOR s_cursor

INTO CORRESPONDING FIELDS

OF TABLE it_crhd

PACKAGE SIZE 1.

IF sy-subrc <> 0.

g_cursor_counter = 1.

EXIT.

ENDIF.

PERFORM get_forecast_data.

DESCRIBE TABLE it_output_req_cap LINES s_line_counter.

s_line_counter = s_line_counter + 1000. "buffer value of 1000

REFRESH: it_crhd, it_kbed_plscn, it_kbed, it_plaf, it_tc24,

it_kako, it_crcapacity_exact, it_crcapacity_exact_old.

IF s_line_counter >= s_s_if-maxsize.

EXIT.

ENDIF.

ENDDO.

IF it_output_req_cap[] IS NOT INITIAL.

LOOP AT it_output_req_cap INTO wa_output_req_cap.

CLEAR e_t_data.

MOVE-CORRESPONDING wa_output_req_cap TO e_t_data.

APPEND e_t_data.

ENDLOOP.

ENDIF.

REFRESH: it_output_req_cap.

s_counter_datapakid = s_counter_datapakid + 1.

ENDIF. "Initialization mode or data extraction ?

ENDFUNCTION.

Read only

Former Member
0 Likes
753

first u need to find no of records in internal table using DESCRIBE statment, and store in one variable

u can loop using this variable, then u can solve ur prb

Read only

Sm1tje
Active Contributor
0 Likes
753

are you sure it is the table size?Internal tables can hold a lot of entries. Maybe the problem lies within the internal table LOOP pass. Any select statements, LOOP within LOOP or....

Post your coding and people can have a look.

Read only

Former Member
0 Likes
753

Hi,

there is no definite size to an internal table. if you are exceeding the memory size of an internal table the code will result in a dump and not go into any indefinite loop.

Please paste your code so that we could analyse the exact error.

Reward points if this info seems to help,

Kiran