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

how to write BDC in bound and outbound code

Former Member
0 Likes
1,325

Hi,

Could you please help me in writing code for BDC inbound and Outbound with some examples.

Thanking you

Ravi Kumar

Hi,

Could you please help me in writing code for BDC inbound and Outbound with some examples.

Thanking you

Ravi Kumar

3 REPLIES 3
Read only

Former Member
0 Likes
877

Hi,

For BDC inbound and outbound.

see the below steps for outbound processing IDOCS

->1 Outbound Interface

PROCESS DIAGRAM

Outbound Interface

1. Analyse Hierarchy Levels

2. Create New segment

3. Create New IDoc Type

4. Create New Message Type

5. Link Message with IDoc Type

6. Create an entry in EDP13 via transactions WE20 and BD64

7. Populate the Custom IDoc via ABAP Program

7b Error Handling

7c. Send Status Email

8. Test the Population of the Custom IDoc

Step 1 – Analyse Hierarchy Levels:

Analyse the data relationships being processed in the interface. Define the appropriate hierarchical Parent-to-Child relationships.

Navigate to transaction code WEDI

Transaction WEDI displays the IDOC main menu. This allows navigation around the various development and control areas to create a customised IDOC.

Step 2 – Create a new segment:

via wedi : Development - IDOC Segments or Transaction code WE31.

• Enter segment name and click on Create.

 The name of the segment type must start with Z1 , and have a maximum of eight characters.

• Enter description and enter the relevant field names and data elements.

 The segment should represent a structure in the program so for each field in the segment a field name and a data element must be defined.

• Save the segment and enter Person Responsible and Processing Person .

• Go to Edit and Set Release.

• Repeat this procedure for each new Segment in the IDOC.

Step 3 – Create a new IDOC Type

via wedi Development - IDOC Types or Transaction WE30.

• Enter segment name (starting with Z), click on Basic Type and then Create.

• Create as new, enter Person Responsible and Processing Person and enter description.

• On ‘Create Basic Type’ screen decide where segments should be inserted and go to Edit/Create Segment.

• Complete relevant fields in the Maintain Attributes screen:

• From the relevant segments created in Step 2 enter the Segment type and if mandatory segment.

• The Minimum and Maximum number of segments to be allowed in the sequence. (One minimum and one maximum if segment is mandatory).

• The Parent Segment and Hierarchy Level will be automatically created depending on where in the IDOC tree you decided to create that particular segment.

• Repeat this process for each segment needed in the IDOC type, deciding whether to add the next segments at the same level or as a ‘Child’.

• When IDOC created return to initial screen. Go to Edit and Set Release.

• Go to Transaction WE60 to view the IDoc Type you have created.

Step 4 – Create new Message Type

via wedi Development - Message Types or Transaction WE81.

• Display/Change and click on New Entries

• Create a new Message Type and Save.

Step 5 – Link Message Type to IDOC Type

via wedi Development - IDOC Type/Message or Transaction WE82.

• Display/Change and then click on New Entries.

• Enter Message Type, Basic Type (IDOC Type) and Release (46C) and Save.

Step 6 – Create an entry in EDP13 via transactions WE20 and BD64.

The partner profile for the Idoc must be set up and generated in the transaction BD64 and transaction WE20.

• WE20 – Add Message Type to appropriate Partner Type, Enter Message Type, Receiver Port and Idoc Type and Save.

• BD64 – Create a Model View, Enter Sender and Receiver Ports, Attach Message Type. Go to ‘Environment’ on Menu and click on Generate Partner Profiles and generate (not save) profile.

Step 7 – Populate the custom IDOC via ABAP Program

See Test Program ZOUTBD_IDOC_TEMPLATE, Appendix IV.

• Create an Internal Table for each segment type, this should be exactly the same structure as the segment type.

• The control record is filled into a structure like EDIDC. The message type and the Idoc type for the Idoc must be populated into the eddic structure.

PERFORM populate_Control_structure USING c_mestyp

c_SEGMENT_type1.

• The data segments are filled into a structure like edidd-sdata; sdata and the segment name are populated into the edidd structure.

PERFORM transfer_Parent_data_to_seg.

• The standard SAP function module MASTER_IDOC_DISTRIBUTE is called to pass the populated IDOC to the ALE Layer.

PERFORM master_idoc_distribute.

• NOTE: This function module is only called for stand alone programs and Shared Master Data programs (SMD). It is not called when using extensions or output determination.

• The ALE Layer handles the sending of the IDOC to the receiving system.

• Error Handling (see Step 7b).

• Commit work.

Project SpecificStep 7b – Error Handling

• Analyse which fields in the interface are mandatory for the receiving system and who needs to receive error notification.

• Declare a structure of type ‘MCMAILOBJ’ for sending instructions.

• Enter values for the internal table based on structure ‘MCMAILOBJ’

• For selection processes, on SY-SUBRC checks and where fields are mandatory for the receiving system; insert Function Module ‘MC_SEND_MAIL’.

• Enter values in the following parameters: -

MS_MAIL_SENDMODE = ‘B’ (Batch Mode)

MS_MAIL_TITLE = 'Mail Title'

MS_MAIL_DESCRIPTION = ‘Error description’ (e.g. MATNR not given)

MS_MAIL_RECEIVER = ‘Name of Receiver’ (To be determined)

MS_MAIL_EXPRESS = ‘E’ (Express Delivery)

MS_MAIL_DLINAME = Leave Blank

MS_MAIL_LANGU = 'E' (Language)

MS_MAIL_FUNKOBJ_NAME = Leave Blank

TABLES

MS_MAIL_CONT = I_MCMAILOBJ

Note:

It has to be determined separately for each interface how these errors and mail notifications are to be grouped – dependant upon the number of errors that are potentially likely. One possible approach is to send an email for each reason for rejection and include all the records that failed for that reason in the mail notification. Another possible approach is to send an email for every failure.

When error checking for mandatory fields it is common SAP practice to reject a record on its first failure (irrespective of subsequent errors in that record)

Step 7c – Send status mail

• Append to table I_MCMAILOBJ details of the time the interface was processed, how many Idocs were created and how many of these produced a status of 03.

• Select the user to receive the mail from ZINT_RECEIVER, using the name of the program as a key (SY-CPROG).

• Use function Module ‘MC_SEND_MAIL’ to send a mail to the user containing the contents of I_MCMAILOBJ at the end of the interface processing.

Step 8 – Test the population of the custom IDOC

via wedi IDoc - Display IDoc or Transaction WE02.

• Enter your message type and execute.

• Status should be green, double click on one of the Idocs you have created to view its contents.

• If a problem has occurred click on Status which will give you a description of the error.

• Drop down Data Records arrow and this should list the data in the IDoc in the correct hierarchical structure.

• Click on each individual segment and view the content to check that the correct data has been read.

• If you have UNIX access by using AL11 you can view the file that you have created.

Note:

For some interfaces it may be valid to send an empty file to SAP. This empty file is converted to the custom IDOC format expected by SAP. This custom IDOC will contain dummy information. In the inbound processing code, if the dummy information is identified then the processing of the IDOC is considered to be complete and the IDOC should then be assigned a successfully processed status of 53, even though it has not been processed at all.

For Outbound ALE Configurations: (Example)

IDoc definitions and necessary ALE configurations settings for the outbound .

Create Idoc segments – Transaction WE31.

Create Idoc type – Transaction WE30.

Create Message Type – Transaction WE81.

Assign Message Type to Idoc type – Transaction WE82.

Create a distribution Model - Transaction BD64

Update outbound parameters of the Partner profile – Transaction WE20

For the Logical system A for the above two message types update the partner profile.

For each message type specify the Port and the IDoc types.

( Note : Port definition need to maintained using transaction WE21 and

it has to be defined as a Transactional RFC port with RFC destination for

system specified, which need to be maintained using SM59 ).

->2 Inbound Interface

Follow steps 1 to 5 inclusive as detailed above in outbound interface.

Step 6

Write a custom function module to handle custom inbound processing. This custom function module must

• Check for the correct message type

• Read the IDoc data segment

• Perform data conversion and validate the data as appropriate

• Post the data to the database

• Handle any error situations

• Set the correct return values for the status record

Note that the Function Module must not make a commit to the database. This is because the status record is not written until control returns to the ALE layer. So if you commit work in the Function Module and an error occurs in returning to the ALE Layer, the status record must not be updated with a successful outcome.

The commit work is executed in the ALE Layer after the status records are updated, via the standard SAP function module IDOC_INBOUND_PROCESS. This attributes of this function module are set up in (Transaction BD51), click on ‘New Entries’ and fill in data; the main input parameters being ‘Input Type’ and ‘Dialog Allowed’.

Take care as some standard SAP transactions contain a Commit Work as part of their processing. Therefore using a BDC to process inbound data to SAP may not be acceptable. You need to check that the SAP transaction is ALE enabled.

Step 7

(Transaction WE57)

Assign the custom function module to the IDoc type and the message type.

Set function module to type ‘F’ and direction ‘2’ for inbound.

Step 8

(Transaction WE42)

Create a new process code and assign it to the function module. The process code determines how the incoming IDoc is to be processed in SAP.

Step 9

(Transaction BD67)

Assign the function module to the process code created above. Got to ‘New Entries’ and enter the process code and the function module name.

Step 10

(Transaction WE20 and Transaction BD64)

Create a partner profile for your message and ensure that in transaction WE20 the process code is the one that points to your function module. (See step 6 of creating Outbound Idocs).

Step 11

Ensure that error handling functionality is present.

Note:

If an interface is expecting a file every day, and a custom IDoc may only be output from SAP periodically, it would be necessary to create some kind of output from SAP on a daily basis to pass to Mercator to allow it to map to an empty file. As we are dealing with custom IDoc types we can design the IDoc so that the data segments are not mandatory. Therefore the SAP program, on finding no data to populate the custom IDoc, would only need to create the control record. The empty IDoc containing the control record would be passed to Mercator. Mercator will map this to an empty file format.

Useful Transaction Codes:

WEDI : IDoc Menu

WE02 : IDoc List (can enter IDoc number to select on)

WE05 : IDoc List

WE19 : Transaction WE19 can be used to test the IDoc

WE30 : IDoc Type Development: Initial Screen

WE31: Development Segments: Initial Screen

WE60 : Documentation for IDoc Types. This allows you to view the IDoc you have created.

WE81 : Display View ‘EDI: Logical Message Types’: Overview

WE82: Display View ‘Message Types and Assignment to IDoc Types’: Overview

Just check out these links for ref :

http://help.sap.com/saphelp_nw04/helpdata/en/04/25fbb89e3511d188da0000e8216438/frameset.htm

http://www.allsaplinks.com/idoc_sample.html

http://www.sapgenie.com/sapedi/idoc_abap.htm

Thanks,

Sakthi C

*-Rewards if useful*

Read only

Former Member
0 Likes
877

Hi,

refer the the below code for call transaction.

the input file format is:

material(MATNR),industry sector(MBRSH),material type(MTART),Material text(MAKTX),Base unit of measure (MEINS)

TEST_SRI1,C,VERP,TEST MAT,KG

TEST_SRI2,C,VERP,TEST MAT,KG

DATA : BEGIN OF IT_DATA OCCURS 0,

DATA(255),

END OF IT_DATA .

data : begin of it_MAT occurs 0,

MATNR like RMMG1-MATNR,

MBRSH LIKE RMMG1-MBRSH,

MTART LIKE RMMG1-MTART,

MAKTX LIKE MAKT-MAKTX,

MEINS LIKE MARA-MEINS,

end of it_MAT.

DATA : BEGIN OF IT_ERROR OCCURS 0,

MATNR LIKE MARA-MATNR,

MESS(255),

END OF IT_ERROR.

DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE,

V_TEXT(200).

PERFORM UPLOAD.

LOOP AT IT_DATA.

PERFORM POP_MAT.

ENDLOOP.

LOOP AT IT_MAT.

PERFORM POP_BDCDATA.

REFRESH IT_BDCMSGCOLL.

CLEAR IT_BDCMSGCOLL.

CALL TRANSACTION 'MM01' USING IT_BDCDATA

UPDATE 'S'

MODE 'N'

MESSAGES INTO IT_BDCMSGCOLL.

IF SY-SUBRC <> 0.

LOOP AT IT_BDCMSGCOLL WHERE MSGTYP = 'E' OR

MSGTYP = 'A' OR

MSGTYP = 'S'.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = IT_BDCMSGCOLL-MSGID

LANG = sy-langu

NO = IT_BDCMSGCOLL-MSGNR

V1 = IT_BDCMSGCOLL-MSGV1

V2 = IT_BDCMSGCOLL-MSGV2

V3 = IT_BDCMSGCOLL-MSGV3

V4 = IT_BDCMSGCOLL-MSGV4

IMPORTING

MSG = V_TEXT

  • 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.

concatenate IT_ERROR-MESS V_TEXT INTO IT_ERROR-MESS.

ENDLOOP.

IT_ERROR-MATNR = IT_MAT-MATNR.

APPEND IT_ERROR.

CLEAR IT_ERROR.

ENDIF.

ENDLOOP.

LOOP AT IT_ERROR.

WRITE : IT_ERROR-MATNR, it_error-mess.

ENDLOOP.

&----


*& Form UPLOAD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM UPLOAD .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'D:\MM01_DATA.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_DATA

  • 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. " UPLOAD

&----


*& Form POP_MAT

&----


  • text

----


FORM POP_MAT .

SPLIT IT_DATA AT ',' INTO IT_MAT-MATNR

IT_MAT-MBRSH

IT_MAT-MTART

IT_MAT-MAKTX

IT_MAT-MEINS.

APPEND IT_MAT.

CLEAR IT_MAT.

ENDFORM. " POP_BDCDATA

&----


*& Form POP_BDCDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM POP_BDCDATA .

REFRESH IT_BDCDATA.

CLEAR IT_BDCDATA.

PERFORM FILL_SCREEN USING 'SAPLMGMM' '0060' 'X'.

PERFORM FILL_VALUS USING 'RMMG1-MATNR' IT_MAT-MATNR.

PERFORM FILL_VALUS USING 'RMMG1-MBRSH' IT_MAT-MBRSH.

PERFORM FILL_VALUS USING 'RMMG1-MTART' IT_MAT-MTART.

PERFORM FILL_VALUS USING 'BDC_OKCODE' '=ENTR'.

PERFORM FILL_SCREEN USING 'SAPLMGMM' '0070' 'X'.

PERFORM FILL_VALUS USING 'MSICHTAUSW-KZSEL(01)' 'X'.

PERFORM FILL_VALUS USING 'BDC_OKCODE' '=ENTR'.

PERFORM FILL_SCREEN USING 'SAPLMGMM' '4004' 'X'.

PERFORM FILL_VALUS USING 'MAKT-MAKTX' IT_MAT-MAKTX.

PERFORM FILL_VALUS USING 'MARA-MEINS' IT_MAT-MEINS.

PERFORM FILL_VALUS USING 'BDC_OKCODE' '=BU'.

ENDFORM. " POP_BDCDATA

&----


*& Form FILL_SCREEN

&----


  • text

----


  • -->P_0112 text

  • -->P_0113 text

  • -->P_0114 text

----


FORM FILL_SCREEN USING P_PROG

P_DYNPRO

P_DYNBEGIN.

IT_BDCDATA-PROGRAM = P_PROG.

IT_BDCDATA-DYNPRO = P_DYNPRO.

IT_BDCDATA-DYNBEGIN = P_DYNBEGIN.

APPEND IT_BDCDATA.

CLEAR IT_BDCDATA.

ENDFORM. " FILL_SCREEN

&----


*& Form FILL_VALUS

&----


  • text

----


  • -->P_0118 text

  • -->P_IT_MAT_MATNR text

----


FORM FILL_VALUS USING P_FNAM

P_FVAL.

IT_BDCDATA-FNAM = P_FNAM.

IT_BDCDATA-FVAL = P_FVAL.

APPEND IT_BDCDATA.

CLEAR IT_BDCDATA.

ENDFORM. " FILL_VALUS

Session method.

DATA : BEGIN OF IT_DATA OCCURS 0,

DATA(255),

END OF IT_DATA .

data : begin of it_MAT occurs 0,

MATNR like RMMG1-MATNR,

MBRSH LIKE RMMG1-MBRSH,

MTART LIKE RMMG1-MTART,

MAKTX LIKE MAKT-MAKTX,

MEINS LIKE MARA-MEINS,

end of it_MAT.

DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

PERFORM UPLOAD.

LOOP AT IT_DATA.

PERFORM POP_MAT.

ENDLOOP.

PERFORM SESS_OPEN.

LOOP AT IT_MAT.

PERFORM POP_BDCDATA.

PERFORM BDC_INSERT.

ENDLOOP.

PERFORM SESS_CLOSE.

&----


*& Form UPLOAD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM UPLOAD .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'D:\MM01_DATA.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_DATA

  • 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. " UPLOAD

&----


*& Form POP_MAT

&----


  • text

----


FORM POP_MAT .

SPLIT IT_DATA AT ',' INTO IT_MAT-MATNR

IT_MAT-MBRSH

IT_MAT-MTART

IT_MAT-MAKTX

IT_MAT-MEINS.

APPEND IT_MAT.

CLEAR IT_MAT.

ENDFORM. " POP_BDCDATA

&----


*& Form POP_BDCDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM POP_BDCDATA .

REFRESH IT_BDCDATA.

CLEAR IT_BDCDATA.

PERFORM FILL_SCREEN USING 'SAPLMGMM' '0060' 'X'.

PERFORM FILL_VALUS USING 'RMMG1-MATNR' IT_MAT-MATNR.

PERFORM FILL_VALUS USING 'RMMG1-MBRSH' IT_MAT-MBRSH.

PERFORM FILL_VALUS USING 'RMMG1-MTART' IT_MAT-MTART.

PERFORM FILL_VALUS USING 'BDC_OKCODE' '=ENTR'.

PERFORM FILL_SCREEN USING 'SAPLMGMM' '0070' 'X'.

PERFORM FILL_VALUS USING 'MSICHTAUSW-KZSEL(01)' 'X'.

PERFORM FILL_VALUS USING 'BDC_OKCODE' '=ENTR'.

PERFORM FILL_SCREEN USING 'SAPLMGMM' '4004' 'X'.

PERFORM FILL_VALUS USING 'MAKT-MAKTX' IT_MAT-MAKTX.

PERFORM FILL_VALUS USING 'MARA-MEINS' IT_MAT-MEINS.

PERFORM FILL_VALUS USING 'BDC_OKCODE' '=BU'.

ENDFORM. " POP_BDCDATA

&----


*& Form FILL_SCREEN

&----


  • text

----


  • -->P_0112 text

  • -->P_0113 text

  • -->P_0114 text

----


FORM FILL_SCREEN USING P_PROG

P_DYNPRO

P_DYNBEGIN.

IT_BDCDATA-PROGRAM = P_PROG.

IT_BDCDATA-DYNPRO = P_DYNPRO.

IT_BDCDATA-DYNBEGIN = P_DYNBEGIN.

APPEND IT_BDCDATA.

CLEAR IT_BDCDATA.

ENDFORM. " FILL_SCREEN

&----


*& Form FILL_VALUS

&----


  • text

----


  • -->P_0118 text

  • -->P_IT_MAT_MATNR text

----


FORM FILL_VALUS USING P_FNAM

P_FVAL.

IT_BDCDATA-FNAM = P_FNAM.

IT_BDCDATA-FVAL = P_FVAL.

APPEND IT_BDCDATA.

CLEAR IT_BDCDATA.

ENDFORM. " FILL_VALUS

&----


*& Form SESS_OPEN

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM SESS_OPEN .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = 'MAT_CRE'

  • 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. " SESS_OPEN

&----


*& Form SESS_CLOSE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM SESS_CLOSE .

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. " SESS_CLOSE

&----


*& Form BDC_INSERT

&----


  • text

----


FORM BDC_INSERT .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'MM01'

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

  • SIMUBATCH = ' '

  • CTUPARAMS = ' '

TABLES

DYNPROTAB = IT_BDCDATA

  • 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

Reward if useful.

Thanks,

Sreeram.

Read only

0 Likes
877

thanx

could you plse help me how to start the BDC for the below process.