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

Problem With Function Parameters

Former Member
0 Likes
908

Hi,

I'm trying to call the following function, I have a spool number, which is fine, and can run the function in test mode. The function I am calling is below, but I'm not sure what I need to declare or create for the "TABLES BUFFER" section.

CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB_RAW'

EXPORTING

rqident = 507

  • FIRST_LINE = 1

  • LAST_LINE =

tables

buffer = it

  • EXCEPTIONS

  • NO_SUCH_JOB = 1

  • NOT_ABAP_LIST = 2

  • JOB_CONTAINS_NO_DATA = 3

  • SELECTION_EMPTY = 4

  • NO_PERMISSION = 5

  • CAN_NOT_ACCESS = 6

  • READ_ERROR = 7

  • OTHERS = 8

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Hope someon can help!

Many Thanks.

10 REPLIES 10
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
867

The BUFFER parameter in the TABLES section will accept a table of any structure.

Regards,

Rich Heilman

Read only

0 Likes
867

Hi,

I tried:

data: begin of it occurs 3,

f1(65535) type c,

end of it.

which did work, but then I am restricted to 65535 chars,

I tried defining it as string, and this just crashed.

Is there a better way of doing this? The data is in RDI format.

Thanks.

Read only

Former Member
0 Likes
867

Hi,

This is how you should define your internal table:

data: begin of it OCCURS 0,

precol(1),

data_line(1000),

end of it.

You won't get anything more that 1000 if you're using this FM because SAP extracts only that amount of characters, so defining your 'it' with 65535 won't do anything.

Thanks,

Wojtek

Read only

0 Likes
867

Hi,

thanks for that, it's fixed the problem, not sure if I should be using occurs 0 , because of the memory allocation - any tips?

Read only

0 Likes
867

Tip....don't use OCCURS at all.




Types: begin of it_type,
       precol(1),
       data_line(1000),
       end of it_type.

Data: it type table of it_type with header line.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
867

Hi

Yes, Rich is right. Don't use OCCURS at all. Sorry.

Thanks,

Wojtek

Read only

0 Likes
867

Could you please give some further explanation why "type" syntax is better than the "occurs" one?

Read only

0 Likes
867

Well, I attended an ABAP Objects class, and the instructor said that the OCCURS statement is obselete. Plus, I'm pretty sure that OCCURS syntax is not allow in ABAP Objects.

Regards,

Rich Heilman

Read only

0 Likes
867

Hi

I am trying not to use OCCURS, although it is a habit...The reason behind it is that using TYPE TABLE is more clear and more specific to me. Both work well, though. I can't comment on using OCCURS in ABAP Objects and whether it is obsolete or not.

Many thanks,

Wojtek

Read only

0 Likes
867

Hi,

The use of occurs has become obsolete. In ABAP Objects, you cannot define internal tables using the OCCURS, it won't work in declarative statements like DATA/TYPE. If you go for stricter/extended syntax check, it will give error.

-Tejal