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

Exporting an internal table from BAPI

Former Member
0 Likes
1,447

Hi,

I want to export an internal table from a remote enabled function module.

But it is not allowing me to have a reference parameter which refers to a structure.

So what should i do to export that table?

Thanks in advance.

Message was edited by:

Vijay

5 REPLIES 5
Read only

Former Member
0 Likes
933

hi vijay

Bapi won't allow the reference parameters basically

it is call by value only

create a global variable in the global repository and

take the value of refference variable into global varible

send this variable's value.....

Read only

0 Likes
933

Create a 'Z' type(Custom ) structure of the type of table you require for export paramter as use it as export parameter.

Regards,

Amit R.

Read only

0 Likes
933

Thanks for your info sudhakar..

but i've to pass a table which contains more than 10 fields...

is it possible to create a structure globally?

Read only

Former Member
0 Likes
933

TYPES : BEGIN OF TY_PO,

CO_AREA TYPE BAPI0015ID2-CO_AREA,

PROFIT_CTR TYPE BAPI0015ID2-PROFIT_CTR,

VALIDFROM TYPE BAPI0015_3-DATE,

VALIDTO TYPE BAPI0015_3-DATE,

PRCTR_NAME TYPE BAPI0015_4-PRCTR_NAME,

IN_CHARGE TYPE BAPI0015_4-IN_CHARGE,

END OF TY_PO.

DATA : IT_PO TYPE TABLE OF TY_PO,

WA_PO LIKE LINE OF IT_PO,

PROFITCENTERID LIKE BAPI0015ID2,

VALIDFROM LIKE BAPI0015_3-DATE,

VALIDTO LIKE BAPI0015_3-DATE,

BASICDATA LIKE BAPI0015_4,

RETURN LIKE BAPIRET2.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'D:\AMD.TXT'

  • FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = '#'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = IT_PO

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_READ_ERROR = 2

  • NO_BATCH = 3

  • GUI_REFUSE_FILETRANSFER = 4

  • INVALID_TYPE = 5

  • NO_AUTHORITY = 6

  • UNKNOWN_ERROR = 7

  • BAD_DATA_FORMAT = 8

  • HEADER_NOT_ALLOWED = 9

  • SEPARATOR_NOT_ALLOWED = 10

  • HEADER_TOO_LONG = 11

  • UNKNOWN_DP_ERROR = 12

  • ACCESS_DENIED = 13

  • DP_OUT_OF_MEMORY = 14

  • DISK_FULL = 15

  • DP_TIMEOUT = 16

  • OTHERS = 17

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

LOOP AT IT_PO INTO WA_PO.

MOVE-CORRESPONDING WA_PO TO PROFITCENTERID.

MOVE-CORRESPONDING WA_PO TO BASICDATA.

VALIDFROM = WA_PO-VALIDFROM.

VALIDTO = WA_PO-VALIDTO.

CALL FUNCTION 'BAPI_PROFITCENTER_CREATE'

EXPORTING

PROFITCENTERID = PROFITCENTERID

VALIDFROM = VALIDFROM

VALIDTO = VALIDTO

BASICDATA = BASICDATA

  • ADDRESS =

  • COMMUNICATION =

  • INDICATORS =

  • TESTRUN =

  • LANGUAGE =

IMPORTING

RETURN = RETURN

  • PROFITCENTER =

  • CONTROLLINGAREA =

  • TABLES

  • COMPANYCODES =

.

WRITE 😕 RETURN-MESSAGE.

ENDLOOP.

try this and your question is not clear

Read only

Former Member
0 Likes
933

Thanks for the info guys....