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 program for Other Goods receipts

Former Member
0 Likes
555

Hi all,

I need BDC program for Other goods receipts,

I have data in excel like material, batch id, qty, actual width, length, plant etc. i want to upload this in one short based on the movement type.

Thanks in advance.

Shankar

Hi all,

I need BDC program for Other goods receipts,

I have data in excel like material, batch id, qty, actual width, length, plant etc. i want to upload this in one short based on the movement type.

Thanks in advance.

Shankar

2 REPLIES 2
Read only

Former Member
0 Likes
473

Hi MP ,

try <b>BAPI_GOODSMVT_CREATE</b>and See the Documentation how to use , what to pass.

Regards

Prabhu

Read only

Former Member
0 Likes
473

Hi MP Shankar,

This is a sample BDC program .Use the format to develop your own BDC program.First record your trasnaction and use that recorded program here.Pass your filename here.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_ifile TYPE dxfile-filename.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-002.

PARAMETERS: p_sess RADIOBUTTON GROUP g3 "create session

DEFAULT 'X' USER-COMMAND bdc,

p_ctu RADIOBUTTON GROUP g3. "call transaction

SELECTION-SCREEN END OF BLOCK b3.

DATA : BEGIN OF itab OCCURS 0,

str TYPE string,

END OF itab,

l_file TYPE string,

t_bdcdata TYPE STANDARD TABLE OF bdcdata,

wa_bdcdata LIKE LINE OF t_bdcdata.

*----


  • AT SELECTION SCREEN ON VALUE REQUEST

*----


  • Value request for the filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ifile.

PERFORM help_input_file.

START-OF-SELECTION.

CLEAR l_file.

l_file = p_ifile.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = l_file

filetype = 'ASC'

TABLES

data_tab = itab

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.

*Start new session

IF p_sess = 'X'.

PERFORM bdc_open.

ENDIF.

LOOP AT itab.

PERFORM creat_batch_input.

PERFORM bdc_insert.

IF p_ctu = 'X'.

CALL TRANSACTION 'SE38' USING t_bdcdata MODE 'A'.

ENDIF.

ENDLOOP.

IF p_sess = 'X'.

PERFORM bdc_close .

ENDIF.

&----


*& Form bdc_open

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM bdc_open .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

client = sy-mandt

group = 'ZMUK'

user = sy-uname

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.

ENDFORM. " bdc_open

&----


*& Form creat_batch_input

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM creat_batch_input .

use your own recorded program here.

PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=STRT'.

PERFORM bdc_field USING 'RS38M-PROGRAMM'

itab-str.

PERFORM bdc_field USING 'RS38M-FUNC_EDIT'

'X'.

PERFORM bdc_dynpro USING 'SAPLSLVC_FULLSCREEN' '0500'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=&F03'.

PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BACK'.

PERFORM bdc_field USING 'RS38M-PROGRAMM'

itab-str.

PERFORM bdc_field USING 'RS38M-FUNC_EDIT'

'X'.

ENDFORM. " creat_batch_input

&----


*& Form bdc_insert

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM bdc_insert .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

tcode = 'SE38'

TABLES

dynprotab = t_bdcdata

EXCEPTIONS

internal_error = 1

not_open = 2

queue_error = 3

tcode_invalid = 4

printing_invalid = 5

posting_invalid = 6

OTHERS = 7.

ENDFORM. " bdc_insert

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0168 text

  • -->P_0169 text

----


FORM bdc_dynpro USING p_program TYPE any

p_dynpro TYPE any.

CLEAR wa_bdcdata.

wa_bdcdata-program = p_program.

wa_bdcdata-dynpro = p_dynpro.

wa_bdcdata-dynbegin = 'X'.

APPEND wa_bdcdata TO t_bdcdata.

ENDFORM. " bdc_dynpro

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0179 text

  • -->P_0180 text

----


FORM bdc_field USING p_fnam TYPE any

p_fval TYPE any.

CLEAR wa_bdcdata.

wa_bdcdata-fnam = p_fnam.

wa_bdcdata-fval = p_fval.

CONDENSE wa_bdcdata-fval.

APPEND wa_bdcdata TO t_bdcdata.

ENDFORM. " bdc_field

&----


*& Form bdc_close

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM bdc_close .

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

not_open = 1

queue_error = 2

OTHERS = 3.

ENDFORM. " bdc_close

&----


*& Form help_input_file

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM help_input_file .

DATA: lt_file_table TYPE filetable,

la_file_table LIKE LINE OF lt_file_table,

l_rc TYPE i,

l_pcdsn TYPE cffile-filename.

REFRESH lt_file_table.

CLEAR la_file_table.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

CHANGING

file_table = lt_file_table

rc = l_rc.

READ TABLE lt_file_table INTO la_file_table INDEX 1.

l_pcdsn = la_file_table-filename.

MOVE l_pcdsn TO p_ifile.

ENDFORM. " help_input_file