SAP ABAP/4 Learning---BDC batch input written in the internal table program

Source: Internet
Author: User
Program
*-----------------------------------------------------------------------
* Program ID:ZTEST904_BDC
* Program NAME:ZTEST904_BDC
*-----------------------------------------------------------------------
* CREATED date:2004/09/04
* CREATED By:liugang
* DESCRIPTION: This program is to learn how to use the program to invoke
* The BDC automatically imports data.
*-----------------------------------------------------------------------
* Modification:
* DATE MODIFIED MODIFIED by Transport REQUEST DESCRIPTION
* 2004/09/04 Liugang version:01/01 Learning
*-----------------------------------------------------------------------
The ZTEST904_BDC.


* Define the inner table in the BDC format
**************************************************
Data:begin of i_bdcdata occurs 0,
*BDC's program name, such as the Code MM01 program name SAPLMGMM (SAP standard program)
Program like Bdcdata-program,
*BDC Dynpro Number
Dynpro like Bdcdata-dynpro,
*BDC BDC Dynpro started
Dynbegin like Bdcdata-dynbegin,
*BDC Project Name
Fnam like Bdcdata-fnam,
Added value of *BDC project name
FVal like Bdcdata-fval,
End of I_bdcdata.

Data:begin of itab occurs 0,
A (9),
End of Itab.

itab-a = ' A0010 '.
APPEND Itab.
itab-a = ' A0011 '.
APPEND Itab.




* Start-of-selection
Start-of-selection.
LOOP at Itab.
Perform append_mm01 USING itab-a.
Perform RUN_BDC.
Endloop.


*---------------------------------------------------------------------*
* FORM APPEND_DATA_MM01 *
*---------------------------------------------------------------------*
* Define a subroutine in which to store each step of the operation
*---------------------------------------------------------------------*
FORM append_mm01 USING fval like itab-a.

Clear I_bdcdata.
Clear i_bdcdata[].


* Start a new screen event
*0173 screen
* The name of the program and the BDC Dynpro number, the beginning of the mark to write the table header,
I_bdcdata-program = ' saplmgmm '.
I_bdcdata-dynpro = ' 0060 '.
I_bdcdata-dynbegin = ' X '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' bdc_cursor '.
I_bdcdata-fval = ' Rmmg1-matnr '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' Bdc_okcode '.
I_bdcdata-fval = '/00 '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' Rmmg1-matnr '.
* Newly established item voucher number
* I_bdcdata-fval = ' A004 '.
I_bdcdata-fval = fval.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' Rmmg1-mbrsh '.
I_bdcdata-fval = ' C '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' Rmmg1-mtart '.
I_bdcdata-fval = ' Werb '.
APPEND I_bdcdata.
Clear I_bdcdata.


* Start a new screen event
I_bdcdata-program = ' saplmgmm '.
I_bdcdata-dynpro = ' 0070 '.
I_bdcdata-dynbegin = ' X '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' bdc_cursor '.
I_bdcdata-fval = ' Msichtausw-dytxt (01) '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' Bdc_okcode '.
I_bdcdata-fval = ' =entr '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' Msichtausw-kzsel (01) '.
I_bdcdata-fval = ' X '.
APPEND I_bdcdata.
Clear I_bdcdata.

* Start a new screen event
I_bdcdata-program = ' saplmgmm '.
I_bdcdata-dynpro = ' 4004 '.
I_bdcdata-dynbegin = ' X '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' Bdc_okcode '.
I_bdcdata-fval = ' =bu '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' bdc_cursor '.
I_bdcdata-fval = ' makt-maktx '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' makt-maktx '.
I_bdcdata-fval = ' Test BDC import data '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' mara-meins '.
I_bdcdata-fval = ' 000 '.
APPEND I_bdcdata.
Clear I_bdcdata.

I_bdcdata-fnam = ' Mara-mtpos_mara '.
I_bdcdata-fval = ' NORM '.
APPEND I_bdcdata.
Clear I_bdcdata.


EndForm.


*---------------------------------------------------------------------*
* FORM RUN_BDC *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM RUN_BDC.
* Start calling transaction MM01, pass the good BDC object to the past, and then set the pattern to a,
* That is to say, all windows are visible.
* N means don't see it
Call TRANSACTION ' MM01 ' USING i_bdcdata MODE ' N '.

EndForm.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.