SlideShare a Scribd company logo
1 of 14
SAP BDC (BATCH DATA COMMUNICATION) PROJECT

Overview

This project will provide a general overview of a data conversion scenario with SAP.
Specifically, you will use a text file (.csv format) and import Vender Master Data into the
appropriate tables in SAP. Vendor data can use either internal or external numbering
(this concept will be discussed in the lecture). Your application will include logic that
takes both scenarios into consideration. You will write this ABAP application as BDC
program. Good luck!

Part 1- Introduction

During a typical conversion, a functional consultant will work with you (technical ABAP
programmer) to define the fields that need to be populated. The functional consultant
will step through the transaction with you and identify the appropriate fields for the
conversion. In this scenario, I will serve as the Functional Consultant and inform you of
the fields needed for the conversion.

(For the following example, you will be using the Vendor Master screen  MK01 or
Logistics  Materials Management  Purchasing, Master Data  Vendor 
Purchasing Create)

   •   Proceed to create a fictitious vendor in the system (no special characters). Specify
       ‘LIEF’ as the account group.

   •   Once the functional consultant identifies the various fields for the conversion, you
       will need to capture the program name, screen number, transaction, and field/table
       information. To do this, place your mouse pointer in the ‘name’ field and press
       the F1 (Help) key.
•   From the Help Screen, locate and click on the button ‘Technical Info’. The
       following window will appear:




   •   From this window, record the Program Name, Screen Number, Table, and Field
       Name. To get the transaction number, exit out of the window and go to the
       System  Status command in the menu bar.

   •   Note: This data is typically recorded in a documentation template. For this
       exercise, use the SAP Q&A Database application (if it’s loaded on your machine)
       otherwise, record the info in your own custom template in Word or Excel.

   •   Proceed to obtain the technical information for the following fields:

Vendor Name
Search Term
City
Zip/Postal Code
Country
Language
Currency

The table above list the minimum required fields for Vendor Master Data. From a logical
perspective, you should ask yourself what fields are specific to SAP. Specific SAP fields
will generally not be populated from your external data source (because some fields in
SAP already have data and you wouldn’t expect it from the legacy system). Once all
your fields are defined, you would typically give these field requirements to a ‘legacy’
person to extract the appropriate data set for the data conversion.
•   Note: any SAP defined field will contain logic behind it (e.g. drop down arrows
       indicate multiple values…this info will not be found in legacy system).
   •   A good question to ask the functional consultant would be if there is any ‘default’
       values for a field.

   •   In reference to internal & external numbering (this topic will be discussed in
       class) the account group drives the vendor number. This is imperative to know in
       advance. If you have experience from the functional side or have used the IMG
       tool, you can find out the different account groups and numbering schemes based
       upon the following menu path in the IMG: Financial Accounting  AR/AP 
       Vendor Accounts  Master Records  Preparation for Creating Vendor Master
        Create Number Allocate # Ranges (specify internal/external numbers).

If the client doesn’t have a preference, use Internal.

   •   Important Account Groups:

KRED – internal SAP numbering
LIEF – external vendor numbering

Here is a scenario for you to consider when performing a data conversion:

The company you are consulting for has a legacy system containing 1000 vendors. The
company has recently performed an analysis of open PO’s (Purchase Orders). The
analysis results indicate there are open PO’s for 200 vendors. For the data conversion,
these 200 vendors will use external vendor numbering (so there’s no conflict with invoice
matching). The remaining vendors without open PO’s will be assigned internal vendor
numbering. The legacy programmer has provided you with 2 separate files. One file
contains a list of vendors with open PO’s, while the other file contains a list of vendors
without outstanding PO’s.

Your task is to write an ABAP BDC program that imports the data in the text files to the
appropriate ABAP tables. Don’t forget, your program needs to contain logic to
determine if the text file is for internal/external vendor numbering.

Part 2 – Process

In part two, you will use batch functions within SAP. The table below lists the different
transaction codes to get started with setting up your batch recording.

Transactions:

Transaction     Description
SHDB            Batch Input Recording (records a batch session)
SM35            Batch Input Initial Screen (to review recorded batch sessions)
•   To begin, go to transaction SHDB.




•   Name the recording session z_BDC_XX (where XX is the last two numbers of
    your assigned logon id). From the menu bar, select Recording  Create.

•   For the transaction code, enter MK01 (the initial vendor master create screen).




•   Your batch recording session in now initiated. To begin, enter in a fictitious
    vendor as performed in Part 1 of this project.
•   From the Create Vendor: Address screen, input the following fields (remember,
       these are the minimum required Vendor Master Data fields for our data
       conversion):




   •   From the next page, select USD as currency type (this may not be an option).

Your batch input recording session should resemble the following:
After you record the batch session, generate the program based upon what was recorded
(very similar to a Macro).


   •   Start by going back to transaction SHDB. Click on the overview toolbar icon, or
       press F8.




   •   Look for your session recording and click once on the line item. When your
       session is highlighted, click on ‘Generate Program’ from the tool bar. Name your
       program Z_BDC_XX (where XX is the last two digits of your assigned login id).
•   At the attributes screen, fill in the appropriate values….you may use the following
       as a guideline (notice the application is type: M):




After the attributes have been filled out, review the generated ABAP/4 code:
Notice all the perform statements that have been coded for you.

PART 3 – Editing the Code
The last part of this project involves editing the code of the generated ABAP/4 BDC
program. This program needs to upload the files the legacy programmer has provided
you, as well as code any special logic. To finish the program, you will need to create an
internal table that will store all the values that need to be populated in the Vendor Master
Data table (LFA1). You will need to setup a Parameters statement to accept the import
files. Finally, you will need to write special logic to get the desired output.

   •   If the BDC program is not currently open, go to the ABAP Workbench and open
       the BDC program. After the reports statement, use the tables statement to call
       two tables:

Table    Description
LFA1     Vendor Master Data
RLGRAP Structure used when uploading/downloading file formats
   • Next, use the parameters statement to accept the input of the text file (path):

               parameters: p_file like rlgrap-filename.
•   Create an internal table that contains the structure of the import file.

       data: begin of itab occurs 10,
             vendor like lfa1-lifnr,
             name like lfa1-name1,
             city like lfa1-ort01,
             zip like lfa1-pstlz,
       end of itab.

   •   Note: make sure you use the data dictionary to become familiar with the LFA1
       table and its fields.

   •   Review the text files that will be used for the upload. Notice the space that is
       separating each value. To account for the space in the import file, use the
       following variables (data object):

data: wf_record(80),
      wf_split type x value '09'.             "this represents a tab in a file



   •   Question: what do you think ‘bdcrecxx’ is referring to from your code?

   •   After the ‘Start-of-Selection’ statement, place a new subroutine that gets the data
       from the input file:

              perform get_data.

   •   Tip: you can double-click on the get_data name and ABAP/4 will automatically
       generate the required entries in your code to initialize the subroutine.

   •   After the form ‘get_data’ statement, use the open dataset command to get the text
       file:

              open dataset p_file in text mode.

   •   Review the following Do Statement (we will go over this command in lecture).

do.
       read dataset p_file into wf_record.

       if sy-subrc ne 0.
             exit.
       else.
             split wf_record at wf_split into itab-vendor itab-name
       itab-city
             itab-zip.
             append itab.

       endif.
enddo.
•   The last statement in your program (before ‘endform.’) should be:

              close dataset p_file.

  •   After the open_group statement, start looping your program.

      loop at itab.     "start looping through all all records from file



  •   Use the table below to replace the BDC Field values with the values from the
      internal table:


BDC Field Name      Original Value            Change to Value
RF02K-LIFNR         ZBDCTESTXX                itab-vendor.
BDC_CURSOR          RF02K-KTOKK               Refer to If statement below
LFA1-NAME1          BDC Test Borquez XX       itab-name.
LFA1-SORTL          BDCTE                     itab-name+0(5).
LFA1-ORT01          Beverly Hills             itab-city.
LFA1-PSTLZ          90211                     itab-zip.

  •   To determine the type of group, use the following if statement:

      if itab-vendor = space.
            perform bdc_field              using 'RF02K-KTOKK'
                                                 'kred'.
      else.
              perform bdc_field            using 'RF02K-KTOKK'
                                                 'LIEF'.
      endif.




  •   After the statement:

              perform bdc_transaction using 'MK01'.

  •   Refresh the data with the command:
refresh bdcdata. " clear all records in table, not just header record



  •   Press F8 or Execute to run the program:
•   When your program runs, use the following parameters (make sure you check the
       Keep Session check box):




   •   Click on Execute.

If you are successful with executing the program, you could expect the following screen:
•   Test the results of your program by going to transaction SM35.




•   If you forget the name of your session, click on the overview button. You should
    be able to see your session in the ‘Session still to be processed’ area.
•   Double-click on your session:




   •   Click on Process.

The system will now walk you through the batch process for your text file. Notice the
values that are given to each field during this walk through. In the future, you may run
this process in ‘Background’ mode if you are importing thousands of records, rather than
just a few. This is a good test to see if your program can successfully run the text file.

When the batch process completes, you will see the following window:
•   To check the log, go back to SM35 and click overview. Select your session and
       click on Log from the toolbar.

You will see the results from your successful batch input:




That’s all folks!

More Related Content

What's hot

Lsmw (Legacy System Migration Workbench)
Lsmw (Legacy System Migration Workbench)Lsmw (Legacy System Migration Workbench)
Lsmw (Legacy System Migration Workbench)Leila Morteza
 
Table maintenance generator and its modifications
Table maintenance generator and its modificationsTable maintenance generator and its modifications
Table maintenance generator and its modificationsscribid.download
 
Lsmw overview
Lsmw overviewLsmw overview
Lsmw overviewvinay5672
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questionsKranthi Kumar
 
Step by-step-to-upload-new-customer-master-record-with-lsmw
Step by-step-to-upload-new-customer-master-record-with-lsmwStep by-step-to-upload-new-customer-master-record-with-lsmw
Step by-step-to-upload-new-customer-master-record-with-lsmwsristick
 
0103 navigation
0103 navigation0103 navigation
0103 navigationvkyecc1
 
Uploading customer master extended address using bapi method
Uploading customer master extended address using bapi methodUploading customer master extended address using bapi method
Uploading customer master extended address using bapi methodlondonchris1970
 
Unit 3 assembler and processor
Unit 3   assembler and processorUnit 3   assembler and processor
Unit 3 assembler and processorAbha Damani
 
BATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONBATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONKranthi Kumar
 
Ab1011 module pool programming
Ab1011   module pool programmingAb1011   module pool programming
Ab1011 module pool programmingSatheesh Kanna
 
abap list viewer (alv)
abap list viewer (alv)abap list viewer (alv)
abap list viewer (alv)Kranthi Kumar
 
Sap abap training Overview
Sap abap training OverviewSap abap training Overview
Sap abap training Overviewraviadm100
 

What's hot (20)

Lsmw (Legacy System Migration Workbench)
Lsmw (Legacy System Migration Workbench)Lsmw (Legacy System Migration Workbench)
Lsmw (Legacy System Migration Workbench)
 
Table maintenance generator and its modifications
Table maintenance generator and its modificationsTable maintenance generator and its modifications
Table maintenance generator and its modifications
 
Bdc details
Bdc detailsBdc details
Bdc details
 
Lsmw overview
Lsmw overviewLsmw overview
Lsmw overview
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questions
 
Step by-step-to-upload-new-customer-master-record-with-lsmw
Step by-step-to-upload-new-customer-master-record-with-lsmwStep by-step-to-upload-new-customer-master-record-with-lsmw
Step by-step-to-upload-new-customer-master-record-with-lsmw
 
0103 navigation
0103 navigation0103 navigation
0103 navigation
 
Sap abap tutorials
Sap abap tutorialsSap abap tutorials
Sap abap tutorials
 
Uploading customer master extended address using bapi method
Uploading customer master extended address using bapi methodUploading customer master extended address using bapi method
Uploading customer master extended address using bapi method
 
Module pool programming
Module pool programmingModule pool programming
Module pool programming
 
Unit 3 assembler and processor
Unit 3   assembler and processorUnit 3   assembler and processor
Unit 3 assembler and processor
 
BATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONBATCH DATA COMMUNICATION
BATCH DATA COMMUNICATION
 
Bapi programming
Bapi programmingBapi programming
Bapi programming
 
Ab1011 module pool programming
Ab1011   module pool programmingAb1011   module pool programming
Ab1011 module pool programming
 
Abap Questions
Abap QuestionsAbap Questions
Abap Questions
 
Sap abap
Sap abapSap abap
Sap abap
 
abap list viewer (alv)
abap list viewer (alv)abap list viewer (alv)
abap list viewer (alv)
 
Dialog programming ABAP
Dialog programming ABAPDialog programming ABAP
Dialog programming ABAP
 
Ab ap faq
Ab ap faqAb ap faq
Ab ap faq
 
Sap abap training Overview
Sap abap training OverviewSap abap training Overview
Sap abap training Overview
 

Viewers also liked

Reflection c
Reflection cReflection c
Reflection cpat21donv
 
Evaluation
EvaluationEvaluation
Evaluationellurn
 
Leadership map
Leadership mapLeadership map
Leadership mappat21donv
 
Diversity gsa presentation
Diversity gsa presentationDiversity gsa presentation
Diversity gsa presentationCrystal Jolly
 
Unplugged powerpoint
Unplugged powerpointUnplugged powerpoint
Unplugged powerpointellurn
 
Final reflection
Final reflectionFinal reflection
Final reflectionpat21donv
 
Reflection a pwr.pt
Reflection a pwr.ptReflection a pwr.pt
Reflection a pwr.ptpat21donv
 
Reflection a pwr.pt.
Reflection a pwr.pt.Reflection a pwr.pt.
Reflection a pwr.pt.pat21donv
 
Indonesiacoal indutry outlook_english
Indonesiacoal indutry outlook_englishIndonesiacoal indutry outlook_english
Indonesiacoal indutry outlook_englishsunapa
 

Viewers also liked (12)

Reflection c
Reflection cReflection c
Reflection c
 
August/September_UP.DATE_12
August/September_UP.DATE_12August/September_UP.DATE_12
August/September_UP.DATE_12
 
Bibliografi
BibliografiBibliografi
Bibliografi
 
Evaluation
EvaluationEvaluation
Evaluation
 
Leadership map
Leadership mapLeadership map
Leadership map
 
Diversity gsa presentation
Diversity gsa presentationDiversity gsa presentation
Diversity gsa presentation
 
Ignite tx
Ignite txIgnite tx
Ignite tx
 
Unplugged powerpoint
Unplugged powerpointUnplugged powerpoint
Unplugged powerpoint
 
Final reflection
Final reflectionFinal reflection
Final reflection
 
Reflection a pwr.pt
Reflection a pwr.ptReflection a pwr.pt
Reflection a pwr.pt
 
Reflection a pwr.pt.
Reflection a pwr.pt.Reflection a pwr.pt.
Reflection a pwr.pt.
 
Indonesiacoal indutry outlook_english
Indonesiacoal indutry outlook_englishIndonesiacoal indutry outlook_english
Indonesiacoal indutry outlook_english
 

Similar to Import Vendor Data with BDC Program

COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docxCOMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docxdonnajames55
 
Lsmw ppt in SAP ABAP
Lsmw ppt in SAP ABAPLsmw ppt in SAP ABAP
Lsmw ppt in SAP ABAPAabid Khan
 
Srinivas_Ganta_IBM_INDIA1
Srinivas_Ganta_IBM_INDIA1Srinivas_Ganta_IBM_INDIA1
Srinivas_Ganta_IBM_INDIA1srinivas ganta
 
Week 2 iLab TCO 2 — Given a simple problem, design a solutio.docx
Week 2 iLab TCO 2 — Given a simple problem, design a solutio.docxWeek 2 iLab TCO 2 — Given a simple problem, design a solutio.docx
Week 2 iLab TCO 2 — Given a simple problem, design a solutio.docxmelbruce90096
 
Abap interview questions and answers
Abap interview questions and answersAbap interview questions and answers
Abap interview questions and answersKaustav Pyne
 
ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1 ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1 Rehan Zaidi
 
ERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP ProfessionalsERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP ProfessionalsRehan Zaidi
 
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERSIICT Chromepet
 
1BM_S4CLD2302_BPD_EN_US.docx
1BM_S4CLD2302_BPD_EN_US.docx1BM_S4CLD2302_BPD_EN_US.docx
1BM_S4CLD2302_BPD_EN_US.docxnavinsurya3
 
sap abap training in chennai
sap abap training in chennaisap abap training in chennai
sap abap training in chennaisanjai rsamy
 
MD04 Report in BW
MD04 Report in BWMD04 Report in BW
MD04 Report in BWtasmc
 
bi-publisher.pptx
bi-publisher.pptxbi-publisher.pptx
bi-publisher.pptxkjkombrink
 
A step by-step guide on i doc-ale between two sap servers
A step by-step guide on i doc-ale between two sap serversA step by-step guide on i doc-ale between two sap servers
A step by-step guide on i doc-ale between two sap serverskrishna RK
 
Abap fundamentals-training-course-document
Abap fundamentals-training-course-documentAbap fundamentals-training-course-document
Abap fundamentals-training-course-documentjohnbryan26
 

Similar to Import Vendor Data with BDC Program (20)

Bdc
BdcBdc
Bdc
 
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docxCOMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
 
FS for FICO
FS for FICOFS for FICO
FS for FICO
 
Lsmw ppt in SAP ABAP
Lsmw ppt in SAP ABAPLsmw ppt in SAP ABAP
Lsmw ppt in SAP ABAP
 
Srinivas_Ganta_IBM_INDIA1
Srinivas_Ganta_IBM_INDIA1Srinivas_Ganta_IBM_INDIA1
Srinivas_Ganta_IBM_INDIA1
 
Week 2 iLab TCO 2 — Given a simple problem, design a solutio.docx
Week 2 iLab TCO 2 — Given a simple problem, design a solutio.docxWeek 2 iLab TCO 2 — Given a simple problem, design a solutio.docx
Week 2 iLab TCO 2 — Given a simple problem, design a solutio.docx
 
Abap interview questions and answers
Abap interview questions and answersAbap interview questions and answers
Abap interview questions and answers
 
Abap training material
Abap training material Abap training material
Abap training material
 
ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1 ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1
 
ERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP ProfessionalsERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP Professionals
 
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
 
1BM_S4CLD2302_BPD_EN_US.docx
1BM_S4CLD2302_BPD_EN_US.docx1BM_S4CLD2302_BPD_EN_US.docx
1BM_S4CLD2302_BPD_EN_US.docx
 
sap abap training in chennai
sap abap training in chennaisap abap training in chennai
sap abap training in chennai
 
Rabbani Basha
Rabbani BashaRabbani Basha
Rabbani Basha
 
MD04 Report in BW
MD04 Report in BWMD04 Report in BW
MD04 Report in BW
 
BAPI - Criação de Ordem de Manutenção
BAPI - Criação de Ordem de ManutençãoBAPI - Criação de Ordem de Manutenção
BAPI - Criação de Ordem de Manutenção
 
The ABAP Query
The ABAP QueryThe ABAP Query
The ABAP Query
 
bi-publisher.pptx
bi-publisher.pptxbi-publisher.pptx
bi-publisher.pptx
 
A step by-step guide on i doc-ale between two sap servers
A step by-step guide on i doc-ale between two sap serversA step by-step guide on i doc-ale between two sap servers
A step by-step guide on i doc-ale between two sap servers
 
Abap fundamentals-training-course-document
Abap fundamentals-training-course-documentAbap fundamentals-training-course-document
Abap fundamentals-training-course-document
 

Import Vendor Data with BDC Program

  • 1. SAP BDC (BATCH DATA COMMUNICATION) PROJECT Overview This project will provide a general overview of a data conversion scenario with SAP. Specifically, you will use a text file (.csv format) and import Vender Master Data into the appropriate tables in SAP. Vendor data can use either internal or external numbering (this concept will be discussed in the lecture). Your application will include logic that takes both scenarios into consideration. You will write this ABAP application as BDC program. Good luck! Part 1- Introduction During a typical conversion, a functional consultant will work with you (technical ABAP programmer) to define the fields that need to be populated. The functional consultant will step through the transaction with you and identify the appropriate fields for the conversion. In this scenario, I will serve as the Functional Consultant and inform you of the fields needed for the conversion. (For the following example, you will be using the Vendor Master screen  MK01 or Logistics  Materials Management  Purchasing, Master Data  Vendor  Purchasing Create) • Proceed to create a fictitious vendor in the system (no special characters). Specify ‘LIEF’ as the account group. • Once the functional consultant identifies the various fields for the conversion, you will need to capture the program name, screen number, transaction, and field/table information. To do this, place your mouse pointer in the ‘name’ field and press the F1 (Help) key.
  • 2. From the Help Screen, locate and click on the button ‘Technical Info’. The following window will appear: • From this window, record the Program Name, Screen Number, Table, and Field Name. To get the transaction number, exit out of the window and go to the System  Status command in the menu bar. • Note: This data is typically recorded in a documentation template. For this exercise, use the SAP Q&A Database application (if it’s loaded on your machine) otherwise, record the info in your own custom template in Word or Excel. • Proceed to obtain the technical information for the following fields: Vendor Name Search Term City Zip/Postal Code Country Language Currency The table above list the minimum required fields for Vendor Master Data. From a logical perspective, you should ask yourself what fields are specific to SAP. Specific SAP fields will generally not be populated from your external data source (because some fields in SAP already have data and you wouldn’t expect it from the legacy system). Once all your fields are defined, you would typically give these field requirements to a ‘legacy’ person to extract the appropriate data set for the data conversion.
  • 3. Note: any SAP defined field will contain logic behind it (e.g. drop down arrows indicate multiple values…this info will not be found in legacy system). • A good question to ask the functional consultant would be if there is any ‘default’ values for a field. • In reference to internal & external numbering (this topic will be discussed in class) the account group drives the vendor number. This is imperative to know in advance. If you have experience from the functional side or have used the IMG tool, you can find out the different account groups and numbering schemes based upon the following menu path in the IMG: Financial Accounting  AR/AP  Vendor Accounts  Master Records  Preparation for Creating Vendor Master  Create Number Allocate # Ranges (specify internal/external numbers). If the client doesn’t have a preference, use Internal. • Important Account Groups: KRED – internal SAP numbering LIEF – external vendor numbering Here is a scenario for you to consider when performing a data conversion: The company you are consulting for has a legacy system containing 1000 vendors. The company has recently performed an analysis of open PO’s (Purchase Orders). The analysis results indicate there are open PO’s for 200 vendors. For the data conversion, these 200 vendors will use external vendor numbering (so there’s no conflict with invoice matching). The remaining vendors without open PO’s will be assigned internal vendor numbering. The legacy programmer has provided you with 2 separate files. One file contains a list of vendors with open PO’s, while the other file contains a list of vendors without outstanding PO’s. Your task is to write an ABAP BDC program that imports the data in the text files to the appropriate ABAP tables. Don’t forget, your program needs to contain logic to determine if the text file is for internal/external vendor numbering. Part 2 – Process In part two, you will use batch functions within SAP. The table below lists the different transaction codes to get started with setting up your batch recording. Transactions: Transaction Description SHDB Batch Input Recording (records a batch session) SM35 Batch Input Initial Screen (to review recorded batch sessions)
  • 4. To begin, go to transaction SHDB. • Name the recording session z_BDC_XX (where XX is the last two numbers of your assigned logon id). From the menu bar, select Recording  Create. • For the transaction code, enter MK01 (the initial vendor master create screen). • Your batch recording session in now initiated. To begin, enter in a fictitious vendor as performed in Part 1 of this project.
  • 5. From the Create Vendor: Address screen, input the following fields (remember, these are the minimum required Vendor Master Data fields for our data conversion): • From the next page, select USD as currency type (this may not be an option). Your batch input recording session should resemble the following:
  • 6. After you record the batch session, generate the program based upon what was recorded (very similar to a Macro). • Start by going back to transaction SHDB. Click on the overview toolbar icon, or press F8. • Look for your session recording and click once on the line item. When your session is highlighted, click on ‘Generate Program’ from the tool bar. Name your program Z_BDC_XX (where XX is the last two digits of your assigned login id).
  • 7. At the attributes screen, fill in the appropriate values….you may use the following as a guideline (notice the application is type: M): After the attributes have been filled out, review the generated ABAP/4 code:
  • 8. Notice all the perform statements that have been coded for you. PART 3 – Editing the Code The last part of this project involves editing the code of the generated ABAP/4 BDC program. This program needs to upload the files the legacy programmer has provided you, as well as code any special logic. To finish the program, you will need to create an internal table that will store all the values that need to be populated in the Vendor Master Data table (LFA1). You will need to setup a Parameters statement to accept the import files. Finally, you will need to write special logic to get the desired output. • If the BDC program is not currently open, go to the ABAP Workbench and open the BDC program. After the reports statement, use the tables statement to call two tables: Table Description LFA1 Vendor Master Data RLGRAP Structure used when uploading/downloading file formats • Next, use the parameters statement to accept the input of the text file (path): parameters: p_file like rlgrap-filename.
  • 9. Create an internal table that contains the structure of the import file. data: begin of itab occurs 10, vendor like lfa1-lifnr, name like lfa1-name1, city like lfa1-ort01, zip like lfa1-pstlz, end of itab. • Note: make sure you use the data dictionary to become familiar with the LFA1 table and its fields. • Review the text files that will be used for the upload. Notice the space that is separating each value. To account for the space in the import file, use the following variables (data object): data: wf_record(80), wf_split type x value '09'. "this represents a tab in a file • Question: what do you think ‘bdcrecxx’ is referring to from your code? • After the ‘Start-of-Selection’ statement, place a new subroutine that gets the data from the input file: perform get_data. • Tip: you can double-click on the get_data name and ABAP/4 will automatically generate the required entries in your code to initialize the subroutine. • After the form ‘get_data’ statement, use the open dataset command to get the text file: open dataset p_file in text mode. • Review the following Do Statement (we will go over this command in lecture). do. read dataset p_file into wf_record. if sy-subrc ne 0. exit. else. split wf_record at wf_split into itab-vendor itab-name itab-city itab-zip. append itab. endif. enddo.
  • 10. The last statement in your program (before ‘endform.’) should be: close dataset p_file. • After the open_group statement, start looping your program. loop at itab. "start looping through all all records from file • Use the table below to replace the BDC Field values with the values from the internal table: BDC Field Name Original Value Change to Value RF02K-LIFNR ZBDCTESTXX itab-vendor. BDC_CURSOR RF02K-KTOKK Refer to If statement below LFA1-NAME1 BDC Test Borquez XX itab-name. LFA1-SORTL BDCTE itab-name+0(5). LFA1-ORT01 Beverly Hills itab-city. LFA1-PSTLZ 90211 itab-zip. • To determine the type of group, use the following if statement: if itab-vendor = space. perform bdc_field using 'RF02K-KTOKK' 'kred'. else. perform bdc_field using 'RF02K-KTOKK' 'LIEF'. endif. • After the statement: perform bdc_transaction using 'MK01'. • Refresh the data with the command: refresh bdcdata. " clear all records in table, not just header record • Press F8 or Execute to run the program:
  • 11. When your program runs, use the following parameters (make sure you check the Keep Session check box): • Click on Execute. If you are successful with executing the program, you could expect the following screen:
  • 12. Test the results of your program by going to transaction SM35. • If you forget the name of your session, click on the overview button. You should be able to see your session in the ‘Session still to be processed’ area.
  • 13. Double-click on your session: • Click on Process. The system will now walk you through the batch process for your text file. Notice the values that are given to each field during this walk through. In the future, you may run this process in ‘Background’ mode if you are importing thousands of records, rather than just a few. This is a good test to see if your program can successfully run the text file. When the batch process completes, you will see the following window:
  • 14. To check the log, go back to SM35 and click overview. Select your session and click on Log from the toolbar. You will see the results from your successful batch input: That’s all folks!