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

BDC call transaction

Former Member
0 Likes
1,182

Hi,

I have done a recording and now want to change the recorded code, saved in a program to include the 4 things,

BDC_OPEN

BDC_CLOSE

BDC_INSERT and

CALL TRANSACTION in the same code.

I believe there are stuff like group and sessid involved which needs to be declared. A sample code wud be greatly appreciated.

Jaydeep.

Hi,

I have done a recording and now want to change the recorded code, saved in a program to include the 4 things,

BDC_OPEN

BDC_CLOSE

BDC_INSERT and

CALL TRANSACTION in the same code.

I believe there are stuff like group and sessid involved which needs to be declared. A sample code wud be greatly appreciated.

Jaydeep.

8 REPLIES 8
Read only

Former Member
0 Likes
1,079
sample code using  call transaction ...



report Z_CALLTRANS_VENDOR_01
no standard page heading line-size 255.

*** Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of it_lfa1 occurs 0,
KTOKK like lfa1-ktokk,
NAME1 like lfa1-name1,
SORTL like lfa1-sortl,
LAND1 like lfa1-land1,
end of it_lfa1.
*** End generated data section ***
data : it_bdc like bdcdata occurs 0 with header line.

*DATA: IT_MESSAGES TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.
*DATA: LV_MESSAGE(255).
data : it_messages like bdcmsgcoll occurs 0 with header line.
data : V_message(255).
data : V_flag.
data : V_datum1 type sy-datum.

data : begin of it_mesg occurs 0,
message(100),
end of it_mesg.

*V_datum1 = sy-datum-1.

parameters : P_Sess like APQI-GROUPID.

start-of-selection.
perform Get_data.
*perform open_group.

loop at it_lfa1.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-KTOKK'
it_lfa1-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-LAND1'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'LFA1-NAME1'
it_lfa1-name1.
perform bdc_field using 'LFA1-SORTL'
it_lfa1-sortl.
perform bdc_field using 'LFA1-LAND1'
it_lfa1-land1.
call transaction 'XK01' using it_bdc
mode 'N'
update 'S'
messages into it_messages.

if sy-subrc <> 0.
if V_flag <> 'X'.
perform open_group.
V_flag = 'X'.
endif.
perform bdc_transaction. "using 'XK01'.
endif.
perform format_messages.


refresh : it_bdc,it_messages.
.

endloop.
if V_flag = 'X'.
perform close_group.
endif.

*&---------------------------------------------------------------------*
*& Form Get_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM Get_data .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:srinu_vendor.txt'
FILETYPE = 'DAT'
TABLES
DATA_TAB = it_lfa1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

ENDFORM. " Get_data
*&---------------------------------------------------------------------*
*& Form bdc_dynpro
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0061 text
* -->P_0062 text
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR it_BDC.
it_BDC-PROGRAM = PROGRAM.
it_BDC-DYNPRO = DYNPRO.
it_BDC-DYNBEGIN = 'X'.
APPEND it_BDC.
ENDFORM.
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
CLEAR it_BDC.
it_BDC-FNAM = FNAM.
it_BDC-FVAL = FVAL.
APPEND it_BDC.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form format_messages
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM format_messages .
loop at it_messages.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = it_messages-MSGID
LANG = 'EN'
NO = it_messages-MSGNR
V1 = it_messages-MSGV1
V2 = it_messages-MSGV2
V3 = it_messages-MSGV3
V4 = it_messages-MSGV4
IMPORTING
MSG = V_message
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write : / V_message.
clear : V_message.
endloop.
ENDFORM. " format_messages
*&---------------------------------------------------------------------*
*& Form open_group
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM open_group .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = P_Sess
* HOLDDATE = V_datum1
KEEP = 'X'
USER = SY-UNAME
.
IF SY-SUBRC = 0.
write : / 'Session Creating wit Name : ',P_Sess.
ENDIF.

ENDFORM. " open_group
*&---------------------------------------------------------------------*
*& Form close_group
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM close_group .
CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDFORM. " close_group
*&---------------------------------------------------------------------*
*& Form bdc_transaction
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0132 text
*----------------------------------------------------------------------*
FORM bdc_transaction. "USING VALUE(P_0132).
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'XK01'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
* SIMUBATCH = ' '
* CTUPARAMS = ' '
TABLES
DYNPROTAB = it_bdc
* EXCEPTIONS
* INTERNAL_ERROR = 1
* NOT_OPEN = 2
* QUEUE_ERROR = 3
* TCODE_INVALID = 4
* PRINTING_INVALID = 5
* POSTING_INVALID = 6
* OTHERS = 7
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

ENDFORM. " bdc_transaction
Read only

former_member206396
Active Participant
0 Likes
1,079

jayadeep,

u will use call transaction or Sesssion ( 3 FMs ) to upload the data into sap. i didn't get ur requirement

do reply...

Read only

Former Member
0 Likes
1,079

Hi Kishan,

Thanks for the code but i need some small things.

I dont have a file upload in this case.

I will simply call it from my program and want to see the flow go from 1 screen to another.

Jay

Read only

0 Likes
1,079

simple.

do the reporting using SHDB.

genrate program code .

it have both call transaction and session method run it with call transaction method.

Read only

0 Likes
1,079

i did the recording ... now wanna remove all the calls to include bdcrex1 .... hence looking for some sample code here ...

Read only

Former Member
0 Likes
1,079

Hi Rama,

I have done the recording and now want to use call transaction for the same.

This is the requirement. In the generated program from the recording there is include bdcrex1 which i dont want and which has the BDC_OPEN etc calls.

These i want to incorporate in the program.

Jay

Read only

Former Member
0 Likes
1,079

Hi,

check this code:

&----


*& Report ZSUDHA_BDC_SESSION1 *

*& *

&----


*& *

*& *

&----


REPORT ZSUDHA_BDC_SESSION1 message-id ztraining .

tables:kna1.

types:begin of s_file,

name1 like kna1-name1,

sortl like kna1-sortl,

stras like kna1-stras,

spras like kna1-spras,

land1 like kna1-land1,

end of s_file.

data:itab type s_file occurs 0 with header line,

it_bdc type bdcdata occurs 0 with header line.

*&----


  • selection screen

&----


selection-screen begin of block b1 with frame title text-001.

parameters:p_file type rlgrap-filename obligatory.

selection-screen end of block b1.

at selection-screen on value-request for p_file.

perform file_help using p_file.

start-of-selection.

perform upload_file using p_file.

perform open_session.

perform populate_bdctable.

perform close_session.

end-of-selection.

write:/ itab-name1.

&----


*& Form file_help

&----


form file_help using p_p_file.

data:l_filepath type ibipparms-path.

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = l_filepath.

p_file = l_filepath.

endform. " file_help

&----


*& Form upload_file

&----


form upload_file using p_p_file.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = p_p_file

FILETYPE = 'ASC'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = sy-uname

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = itab

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11

.

IF sy-subrc <> 0.

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

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

message i001.

ENDIF.

endform. " upload_file

&----


*& Form open_session

&----


form open_session .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = 'sudha'

  • HOLDDATE = FILLER8

KEEP = 'X'

USER = sy-uname

  • RECORD = FILLER1

  • PROG = SY-CPROG

  • IMPORTING

  • QID =

EXCEPTIONS

CLIENT_INVALID = 1

DESTINATION_INVALID = 2

GROUP_INVALID = 3

GROUP_IS_LOCKED = 4

HOLDDATE_INVALID = 5

INTERNAL_ERROR = 6

QUEUE_ERROR = 7

RUNNING = 8

SYSTEM_LOCK_ERROR = 9

USER_INVALID = 10

OTHERS = 11

.

IF sy-subrc <> 0.

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

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

ENDIF.

endform. " open_session

&----


*& Form populate_bdctable

&----


form populate_bdctable .

loop at itab.

perform bdc_dynpro using 'SAPMF02D' '0105'.

perform bdc_field using 'BDC_CURSOR'

'RF02D-KTOKD'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02D-BUKRS'

'0001'.

perform bdc_field using 'RF02D-KTOKD'

'0001'.

perform bdc_dynpro using 'SAPMF02D' '7105'.

perform bdc_field using 'RF02D-KTOKD'

'0001'.

perform bdc_dynpro using 'SAPMF02D' '0110'.

perform bdc_field using 'BDC_CURSOR'

'KNA1-SPRAS'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

perform bdc_field using 'KNA1-NAME1'

itab-name1.

perform bdc_field using 'KNA1-SORTL'

Itab-sortl.

perform bdc_field using 'KNA1-STRAS'

itab-stras.

perform bdc_field using 'KNA1-LAND1'

itab-land1.

perform bdc_field using 'KNA1-SPRAS'

itab-spras.

perform bdc_dynpro using 'SAPMF02D' '0210'.

perform bdc_field using 'BDC_CURSOR'

'KNB1-AKONT'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

perform bdc_field using 'KNB1-AKONT'

'120000'.

perform bdc_dynpro using 'SAPLRSFH' '0100'.

perform bdc_field using 'BDC_OKCODE'

'/EBACK'.

perform bdc_field using 'BDC_CURSOR'

'RSIODYNP4-LOW(01)'.

perform bdc_insert.

clear it_bdc.

refresh it_bdc.

endloop.

endform. " populate_bdctable

&----


*& Form bdc_dynpro

&----


form bdc_dynpro using value(p_program)

value(p_screen).

it_bdc-program = p_program.

it_bdc-dynpro = p_screen.

it_bdc-dynbegin = 'X'.

append it_bdc.

clear it_bdc.

endform. " bdc_dynpro

&----


*& Form bdc_insert

&----


form bdc_insert .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'FD01'

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

  • SIMUBATCH = ' '

  • CTUPARAMS = ' '

TABLES

dynprotab = it_bdc

EXCEPTIONS

INTERNAL_ERROR = 1

NOT_OPEN = 2

QUEUE_ERROR = 3

TCODE_INVALID = 4

PRINTING_INVALID = 5

POSTING_INVALID = 6

OTHERS = 7

.

IF sy-subrc <> 0.

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

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

ENDIF.

endform. " bdc_insert

&----


*& Form close_session

&----


form close_session .

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

NOT_OPEN = 1

QUEUE_ERROR = 2

OTHERS = 3

.

IF sy-subrc <> 0.

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

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

ENDIF.

endform. " close_session

&----


*& Form bdc_field

&----


form bdc_field using value(p_fieldname)

value(p_fieldvalue).

IT_BDC-FNAM = P_FIELDNAME.

IT_BDC-FVAL = P_FIELDVALUE.

APPEND IT_BDC.

CLEAR IT_BDC.

endform. " bdc_field

regards,

keerthi.

Read only

Bema
Active Participant
0 Likes
1,079

hi,

check the following code.

here it uploads the values which u gave while recording.

report YFIIFFA

no standard page heading line-size 255.

*include bdcrecx1.

TABLES : t100.

DATA: messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

DATA : e_group_opened.

DATA: BEGIN OF i_po_header OCCURS 0,

indicator(3),

int_po_number(15),

ext_po_number(15),

po_curr_code(3),

gr_date TYPE datum,

supplier_whno(15),

receiver_whno(15),

stock_trasnfer_ind(1),

vendor_code(10),

END OF i_po_header.

DATA: BEGIN OF i_po_lineitem OCCURS 0,

indicator(3),

int_po_number(15),

gr_date TYPE datum,

line_item_no(3),

item_code(15),

item_desc(30),

quantity(15),

uom(15),

po_price(14),

matcat(4),

taxcode(2),

inventno(15),

bus_area(3),

END OF i_po_lineitem.

----


  • Selection Screen

----


SELECTION-SCREEN BEGIN OF BLOCK input WITH FRAME TITLE text-t01.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 3(20) text-s01 FOR FIELD p_bukrs.

SELECTION-SCREEN POSITION 25.

PARAMETERS: p_bukrs TYPE bukrs OBLIGATORY.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN BEGIN OF BLOCK filedest WITH FRAME TITLE text-t02.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 3(28) text-s03 FOR FIELD apps.

SELECTION-SCREEN POSITION 32.

PARAMETERS apps RADIOBUTTON GROUP file. "Application Server

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 9(27) text-s04 FOR FIELD p_lpath.

SELECTION-SCREEN POSITION 38.

PARAMETERS: p_lpath LIKE filepath-pathintern

DEFAULT 'Z_IF_PROC'.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 9(27) text-s05 FOR FIELD p_logpth.

SELECTION-SCREEN POSITION 38.

PARAMETERS: p_logpth LIKE filepath-pathintern

DEFAULT 'Z_IF_LOG'.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 3(28) text-s06 FOR FIELD pres.

SELECTION-SCREEN POSITION 32.

PARAMETERS pres RADIOBUTTON GROUP file. "Presentation Server

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 9(26) text-s07 FOR FIELD p_file.

SELECTION-SCREEN POSITION 36.

PARAMETERS: p_file LIKE rlgrap-filename.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 3(26) text-s10 FOR FIELD p_dupchk.

SELECTION-SCREEN POSITION 36.

PARAMETERS: p_dupchk AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK filedest.

SELECTION-SCREEN BEGIN OF BLOCK callpara WITH FRAME TITLE text-t03.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 3(20) text-s08 FOR FIELD cupdate.

SELECTION-SCREEN POSITION 25.

PARAMETERS ctumode LIKE ctu_params-dismode DEFAULT 'N'.

"A: show all dynpros

"E: show dynpro on error only

"N: do not display dynpro

SELECTION-SCREEN END OF LINE.

PARAMETERS cupdate LIKE ctu_params-updmode DEFAULT 'S' NO-DISPLAY.

"S: synchronously

"A: asynchronously

"L: local

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 3(20) text-s09 FOR FIELD e_group.

SELECTION-SCREEN POSITION 25.

PARAMETERS e_group(12). "group name of error-session

SELECTION-SCREEN END OF LINE.

PARAMETERS: e_user(12) DEFAULT sy-uname NO-DISPLAY.

"user for error-session

PARAMETERS: e_keep DEFAULT 'X' NO-DISPLAY.

PARAMETERS: e_hdate LIKE sy-datum NO-DISPLAY.

PARAMETERS: nodata DEFAULT '/' LOWER CASE NO-DISPLAY.

"nodata

PARAMETERS: smalllog NO-DISPLAY. "' ' = log all transactions

"'X' = no transaction logging

SELECTION-SCREEN END OF BLOCK callpara.

SELECTION-SCREEN END OF BLOCK input.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

PERFORM f_file_select.

start-of-selection.

PERFORM f_upload_data.

perform open_group.

*loop at itab in to wa.

perform bdc_dynpro using 'SAPLAIST' '0105'.

perform bdc_field using 'BDC_CURSOR'

'RA02S-NASSETS'.

perform bdc_field using 'BDC_OKCODE'

'=MAST'.

perform bdc_field using 'ANLA-ANLKL'

'9500'.

perform bdc_field using 'ANLA-BUKRS'

'5112'.

perform bdc_field using 'RA02S-NASSETS'

'2'.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=TABNX'.

perform bdc_field using 'BDC_CURSOR'

'ANLA-MEINS'.

perform bdc_field using 'ANLA-TXT50'

'test11'.

perform bdc_field using 'ANLA-TXA50'

'test111'.

perform bdc_field using 'ANLA-INVNR'

'1234'.

perform bdc_field using 'ANLA-MENGE'

'2'.

perform bdc_field using 'ANLA-MEINS'

'ea'.

perform bdc_field using 'ANLA-INKEN'

'X'.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=TABNX'.

perform bdc_field using 'BDC_CURSOR'

'ANLZ-KOSTL'.

perform bdc_field using 'ANLZ-GSBER'

'010'.

perform bdc_field using 'ANLZ-KOSTL'

'511211110'.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=TABNX'.

perform bdc_field using 'BDC_CURSOR'

'ANLA-ORD41'.

perform bdc_field using 'ANLA-ORD41'

'1001'.

perform bdc_field using 'RA02S-EQANZ'

'1'.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=TABNX'.

perform bdc_field using 'BDC_CURSOR'

'ANLA-LIFNR'.

perform bdc_field using 'ANLA-LIFNR'

'405111'.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=BUCH'.

perform bdc_field using 'BDC_CURSOR'

'ANLA-ANLN1'.

perform bdc_dynpro using 'SAPLSPO1' '0600'.

perform bdc_field using 'BDC_OKCODE'

'=OPT1'.

perform bdc_transaction using 'AS01'.

*endloop.

*PERFORM show_fanos.

perform close_group.

----


  • Start new screen *

----


FORM bdc_dynpro USING program dynpro.

CLEAR bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

ENDFORM. "BDC_DYNPRO

----


  • Insert field *

----


FORM bdc_field USING fnam fval.

IF fval <> '/'.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

ENDIF.

ENDFORM. "BDC_FIELD

&----


*& Form bdc_transaction

&----


  • text

----


  • -->TCODE text

----


FORM bdc_transaction USING tcode.

DATA: l_subrc LIKE sy-subrc.

CALL TRANSACTION tcode USING bdcdata

MODE 'N'

UPDATE 'S'

MESSAGES INTO messtab.

if sy-subrc = 0.

write : / 'Success'.

endif.

  • l_subrc = sy-subrc.

  • DATA: l_mstring(480).

ENDFORM . "bdc_transaction

&----


*& Form show_fanos

&----


  • text

----


FORM show_fanos.

LOOP AT messtab.

  • SELECT SINGLE * FROM t100 WHERE sprsl = messtab-msgspra

  • AND arbgb = messtab-msgid

  • AND msgnr = messtab-msgnr.

*

IF sy-subrc = 0.

WRITE : / messtab-msgv1,messtab-msgv2,messtab-msgv3,messtab-msgv4.

ELSE.

WRITE: /4 messtab.

ENDIF.

ENDLOOP.

CLEAR messtab.

ENDFORM. "show_fanos

&----


*& Form open_group

&----


  • text

----


FORM open_group.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

client = sy-mandt

group = 'Zerr'

user = sy-uname

keep = 'X'

holddate = sy-datum.

ENDFORM. "open_group

&----


*& Form close_group

&----


  • text

----


FORM close_group.

IF e_group_opened = 'X'.

CALL FUNCTION 'BDC_CLOSE_GROUP'.

ENDIF.

ENDFORM. "CLOSE_GROUP

&----


*& Form F_FILE_SELECT

&----


  • text

----


FORM f_file_select .

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

  • DEF_FILENAME = 'getfile'

def_path = 'C:\'

mask = ',.,..'

IMPORTING

filename = p_file

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE I115.

ENDIF.

ENDFORM. " F_FILE_SELECT

&----


*& Form f_upload_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM f_upload_data .

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

filename = p_file

filetype = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

  • TABLES

  • data_tab = itab

EXCEPTIONS

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

no_authority = 10

OTHERS = 11.

IF sy-subrc <> 0.

  • message e116 with p_file.

ENDIF.

ENDFORM. " f_upload_data