2007 Sep 14 11:31 AM
hi all,
I am making a BDC program, for tcode MM01
I have done the recording, and generated the program.
I have a txt file on my desktop, and i am filling the internal table declared in the program from that txt file.
Its working fine uptill now. Can any one help me how to proceed from here.
I want to execute the program through call transasction method.
<b>Points will be rewarded.</b>
2007 Sep 14 11:46 AM
Hi!
In your generated program there is a DO...ENDDO statement.
Change it to a
LOOP AT your_internal_table INTO wa.
ENDLOOP.
Change the variables to your wa fields within the LOOP.
Go to SM35 and play it in online mode, and you'll see how the fields get their values...
Thats all.
Regards
Tamá
2007 Sep 14 11:46 AM
Hi!
In your generated program there is a DO...ENDDO statement.
Change it to a
LOOP AT your_internal_table INTO wa.
ENDLOOP.
Change the variables to your wa fields within the LOOP.
Go to SM35 and play it in online mode, and you'll see how the fields get their values...
Thats all.
Regards
Tamá
2007 Sep 14 12:06 PM
After making the changes, that is adding work area fields in the loop end loop and i create a session, and execute the program.
In SM35, i select the session and then click process.
But in the very first screen on MM01, in the material num filed, it fills the complete row, i want it to pick only the material num from the internal table.
the txt file is separated by spaces.....
I am using upload FM to load data to internal table
Message was edited by:
Runal Singh
2007 Sep 14 12:51 PM
hi,
i am giving u code of report with Call Transaction method.
Hope it will b useful.
REPORT zbdc_call
NO STANDARD PAGE HEADING LINE-SIZE 255.
DATA: BEGIN OF record OCCURS 0,
data element: MATNR
matnr_001(018),
data element: BRGEW
brgew_008(017),
END OF record.
End generated data section ***
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETER:file LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK blk1.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = file.
START-OF-SELECTION.
PERFORM data_upload.
PERFORM bdcdata.
CALL TRANSACTION 'MM02' USING BDCDATA MODE 'A' UPDATE 'A'.
&----
*& Form data_upload
&----
text
----
FORM data_upload.
DATA:loc_file TYPE string.
loc_file = file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = loc_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = record
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.
ENDFORM. "data_upload
&----
*& Form bdc_dynpro
&----
text
----
-->PROGRAM text
-->DYNPRO text
----
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "bdc_dynpro
&----
*& Form bdc_field
&----
text
----
-->FNAM text
-->FVAL text
----
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "bdc_field
&----
*& Form bdcdata
&----
text
----
FORM bdcdata.
LOOP AT record.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-MATNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=AUSW'.
PERFORM bdc_field USING 'RMMG1-MATNR'
record-matnr_001.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARA-BRGEW'.
PERFORM bdc_field USING 'MARA-BRGEW'
record-brgew_008.
ENDLOOP.
ENDFORM. "bdcdata