Skip to Content
author's profile photo
Former Member

Query on BAPI -LSMW

Hi All,

I have a requirement on LSMW, Can any body send me step-by-step procedure

to create SD-pricing conditions by using BAPI in LSMW.

Thanks,

Naga

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • author's profile photo
    Former Member
    Posted on Sep 27, 2007 at 12:17 PM

    hi naga,

    FOR BAPI/IDOC METHOD, WE NEED TO MAINTAIN IDOC INBOUND PROCESSING EXPLICITLY. IN THE INITIAL TRANSACTION OF LSMW, GO TO SETTINGS AND CLICK IDOC INBOUND PROCESSING. WE NEED TO PERFORM THE FOLLOWING STEPS.

     DEFINE OR SELECT A FILE PORT FOR TRANSPORTING THE FILE. OPTIONALLY, YOU CAN ALSO CREATE A TRFC PORT.

     THE PARTNER TYPE HAS TO BE DEFINED OR SELECTED.

     THE PARTNER NUMBER HAS TO BE DEFINED OR SELECTED.

     IDOC INBOUND PROCESSING MUST BE ACTIVATED AND THE WORKFLOW CUSTOMIZING MUST BE CHECKED. BOTH OF THESE TASKS ARE PERFORMED ONCE IN EACH SYSTEM.

    EXPORTING AND IMPORTING

    EXPORTING - IT IS A GOOD IDEA TO PERFORM THE MIGRATION FROM A LEGACY SYSTEM TO THE SAP SYSTEM IN A TEST SYSTEM FIRST. THIS FUNCTION IS USED TO TRANSFER THE FIELD ASSIGNMENTS DEVELOPED TO THE PRODUCTION SYSTEM.

    IMPORTING - IMPORT THE MAPPING AND FIELD ASSIGNMENTS INTO A DIFFERENT SAP SYSTEM.

    1) MAINTAINING OBJECT ATTRIBUTES

    SPECIFY WHETHER THE DATA IS TO BE TRANSFERRED ONCE OR PERIODICALLY. AND THEN SPECIFY WHICH METHOD YOU GONNA USE FOR THE DATA TRANSFER.

    2) MAINTAING SOURCE STRUCTURE

    WE CAN CREATE SOURCE STRUCTURES EITHER AT THE SAME LEVEL OR AT THE LOWER LEVEL.

    3) MAINTAINING SOURCE FIELDS

    WE CAN DIRECTLY CREATE THE SOURCE FIELDS. OR WE CAN COPY THE FIELDS USING THE FOLLOWING METHODS.

     UPLOAD – TAB DELIMITED TEXT

     COPY FROM OTHER OBJECT

     COPY FROM DATA REPOSITORY – FROM A STRUCTURE OF ABAP DICTIONARY.

     FROM DATA FILE.

    4) MAINTAING STRUCTURE RELATIONS

    HERE WE ARE ESTABLISHING THE STRUCTURE RELATIONSHIPS BETWEEN THE PROJECT AND THE SAP SYSTEM.

    5) MAINTAIN FIELD MAPPING AND CONVERSION RULES

    HERE WE ARE MAINTAINING THE FILED RELATIONSHIP BETWEEN THE SOURCE AND TARGET STRUCTURE.

    AUTO FIELD MAPPING

    AUTO FIELD MAPPING IS USEFUL IN CASE IF FIELDS WITH IDENTICAL OR SIMILAR NAMES/DESCRIPTIONS EXIST IN THE SOURCE AND TARGET STRUCTURES. THIS IS PARTICULARLY THE CASE IF DATA IS TRANSFERRED FROM ONE SAP SYSTEM TO ANOTHER SAP SYSTEM.

    CONVERSION RULES

    THE DEFAULE CONVERSION RULE IS TRANSFER (MOVE).

    INITIAL, CONSTANT, TRANSFER (MOVE), PREFIX, SUFFIX, CONCATENATION, TRANSFER LEFT- ALIGNED, ABAP CODE, X FIELD, MOVE WITH LEADING ZEROS, [(R) FIXED VALUE, TRANSLATION AND USER-DEFINED ROUTINE].

    THERE IS A CHECKBOX ‘ONLY IF SOURCE FIELD NOT INITIAL’.

    GLOBAL VARIABLES

    WE CAN USE THESE GLOBAL VARIABLES IN ABAP CODE.

    G_PROJECT CURRENT PROJECT

    G_SUBPROJ CURRENT SUBPROJECT

    G_OBJECT CURRENT OBJECT

    G_RECORD CURRENT TARGET STRUCTURE

    PROCESSING TIMES

    __BEGIN_OF_PROCESSING__ BEFORE PROCESSING OF DATA IS STARTED.

    __BEGIN_OF_RECORD__ BEFORE THE CONVERSION RULE FOR A SOURCE STRUCTURE IS APPLIED.

    __END_OF_RECORD AFTER THE CONVERSION RULE FOR A SOURCE STRUCTURE HAS BEEN APPLIED.

    __END_OF_TRANSACTION__ AFTER PROCESSING OF THE TRANSACTION HAS BEEN COMPLETED.

    __END_OF_PROCESSING__ AFTER PROCESSING OF DATA HAS BEEN COMPLETED.

    __BEGIN_OF_TRANSACTION__ BEFORE PROCESSING OF DATA FOR A TRANSACTION IS STARTED

    GLOBAL FUNCTIONS

    TRANSFER_RECORD. THE CURRENT RECORD (THAT IS, THE RECORD FOR THE CURRENT TARGET STRUCTURE) IS TRANSFERRED TO THE OUTPUT BUFFER.

    TRANSFER_THIS_RECORD '...'. A RECORD OF A DIFFERENT TARGET STRUCTURE IS TRANSFERRED TO THE OUTPUT BUFFER. THE NAME OF THE TARGET STRUCTURE HAS TO BE SPECIFIED AS ARGUMENT BETWEEN QUOTATION MARKS.

    AT_FIRST_TRANSFER_RECORD. THE CURRENT RECORD IS TRANSFERRED TO THE OUTPUT BUFFER IF IT IS THE FIRST TRANSACTION INVOLVED.

    ON_CHANGE_TRANSFER_RECORD. THE CURRENT RECORD IS TRANSFERRED TO THE OUTPUT BUFFER IF IT HAS CHANGED AS COMPARED TO THE LAST RECORD.

    TRANSFER_TRANSACTION. THE CURRENT TRANSACTION IS WRITTEN TO THE OUTPUT FILE. THIS TRANSFERS ALL THE RECORDS OF THE OUTPUT BUFFER TO THE OUTPUT FILE.

    SKIP_RECORD. THE CURRENT RECORD IS NOT TRANSFERRED TO THE OUTPUT BUFFER.

    SKIP_TRANSACTION. THE CURRENT TRANSACTION IS NOT WRITTEN TO THE OUTPUT FILE.

    6) MAINTAIN FIXED VALUES, TRANSALTIONS, USER-DEFINED ROUTINES

    REUSABLE RULES ALLOW YOU TO DEFINE CONVERSION RULES THAT CAN BE USED SEVERAL TIMES.

    7) SPECIFY FILES

    WE CAN SPECIFY FILES IN PC OR IN APPLICATION SERVER. IN CASE YOUR DATA IS STORED IN MULTIPLE SETS OF FILES, YOU CAN SPECIFY A WILDCARD (*) FOR THE NAME OF YOUR FILE. A WILDCARD CAN BE USED EVERY TIME THE FILES FOR SEVERAL IMPORT RUNS COME FROM DIFFERENT FILES; WITH THE FILE NAME BEING DIFFERENT IS SOME CHARACTERS ONLY.

    FOR READ DATA, THE FILE NAME IS IN THE FORMAT OF PROJECT_SBPROJ_OBJ.LSMW.READ

    FOR CONVERTED DATA, THE FILE NAME IS IN THE FORMAT OF PROJECT_SBPROJ_OBJ.LSMW.CONV

    8) ASSIGN FILES

    ASSIGNS THE FILES ALREADY DEFINED TO THE SOURCE STRUCTURES.

    CONVERSION PROGRAM - /1CADMC/SAP_LSMW_CONV_OBJN.

    9) READ DATA

    THE FILES MUST HAVE BEEN SPECIFIED BEFORE AND MADE KNOWN TO THE LSMW. IN THIS STEP, THE DATA IS READ INTO THE APPLICATION SERVER.

    WE CAN READ THE SELECTED DATA BY GIVING TRANSACTION NUMBER.

    10) CONVERT DATA

    THE FILE OF READ DATA IS TRANSFERRED TO THE FILE OF CONVERTED DATA DURING MIGRATION.

    WHEN THE LSMW OBJECT IS BASED ON A BAPI OR AN IDOC, ADDITIONAL SELECTION PARAMETERS ARE AVAILABLE ON THE SELECTION SCREEN OF THE DATA CONVERSION PROGRAM:

    CREATE IDOCS DIRECTLY: IDOCS ARE COLLECTED AND THEN PASSED FOR IDOC GENERATION PACKAGE BY PACKAGE.

    NO. OF IDOCS PER PACKAGE: THE DEFAULT IS 50 (THIS VALUE CAN BE CHANGED).

    THE ABOVE MENTIONED STEPS ARE COMMON FOR ALL THE TYPES OF IMPORTING METHODS IN LSMW.

    IN THE CASE OF STANDARD BATCH INPUT/ BATCH INPUT RECORDING, CREATING BATCH INPUT SESSION AND PROCESSING THAT.

    IN THE CASE OF STANDARD DIRECT INPUT, START A DIRECT INPUT SESSION.

    IN THE CASE OF BAPI/ IDOC,

     STARTING IDOC GENERATION

     STARTING IDOC PROCESSING

     CREATING AN IDOC OVERVIEW

     STARTING IDOC POSTPROCESSING

    FOR DIRECT INPUT METHOD, WE CAN USE EITHER THE PROGRAM RMDATIND OR THE TRANSACTION BMV0.

    STARTING IDOC GENERATION FIRST, THE FILE WITH THE CONVERTED DATA IS READ. THE PACKETS OF INFORMATION IN THIS FILE ARE THEN SAVED TO THE SAP DATABASE IN IDOC FORMAT, BUT NOT TO THE DATABASE OF THE CORRESPONDING APPLICATION. THE SYSTEM ASSIGNS A NUMBER TO EACH IDOC. THE FILE WITH THE CONVERTED DATA IS THEN DELETED.

    STARTING IDOC PROCESSING THE IDOCS CREATED IN THE FIRST STEP ARE SENT TO THE ASSOCIATED APPLICATION PROGRAM. THIS APPLICATION PROGRAM CHECKS THE DATA AND UPDATES IT IN THE APPLICATION DATABASE, IF NECESSARY.

    Pls reward if helpful.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 27, 2007 at 12:28 PM

    Hi

    see this and do accordingly

    Step-by-Step Guide for using BAPI in LSMW

    Note! The screen prints in this article are from ECC 5.0. They may differ slightly in other versions.

    Introduction:

    This document details the usage of BAPI in LSMW. We have used the example of migration of the purchase order data into SAP.

    Pre-requisites:

    It is assumed that the reader of this article has the minimum knowledge required on the Business Object, BAPI, Message Types and IDoc Types.

    Step-by-Step Procedure:

    Details of the BAPI used in this scenario:

    Business Object: BUS2012

    Method: CreateFromData

    Details of Message Type and Basic IDoc Type:

    Message Type: PORDCR

    Basic IDoc Type: PORDCR02

    Let’s have a look at the BAPI first, before proceeding to the LSMW:

    1. Go to Transaction BAPI

    2. Click on Search Button

    3. Enter the value “BUS2012” and select “Obj.type(Technical Object Name”

    4. Press ENTER

    5. Following screen appears:

    6. On the left side of the screen, Expand the “PurchaseOrder”.

    7. Select “PurchaseOrder” and double-click on the same for details.

    Building LSMW using BAPI:

    1. Go to Transaction LSMW.

    2. Enter the Project, Subproject and Object information and click on CREATE.

    3. Enter the descriptions for Project, Subproject and Object.

    4. Now select Settings à IDoc Inbound Processing

    5. “IDoc Inbound Processing” screen appears. Enter the required details as shown below:

    6. Click on “Activate IDoc Inbound Processing”.

    7. Click on “Yes” when prompted for “Activate IDoc Inbound?”

    8. Hit on “Back” to return to the main screen.

    9. Click on Continue (F8). Following Screen appears:

    10. Select the Step 1 “Maintain Object Attributes” and select “Execute”.

    11. Select the radio button “Business Object Method” and enter the following details:

    Business Object: BUS2012

    Method: CreateFromData

    Hit ENTER

    12. Save and click on BACK button. Following information message is displayed.

    13. Now select step 2 “Maintain Source Structures” and click “Execute”.

    14. In this step, we need to maintain the source structure. In our example, lets consider the example of a file with 2 structures Head and Item data as shown below:

    Click on Create and name the source structure as HEADERDATA. Now select HEADERDATA and click on “Create” again to create the child structure. Following popup appears:

    Select “Lower Level” and click on Continue. Enter the Item data structure name.

    Click Save and hit BACK button to go to the main screen.

    15. Select step 3 “Maintain Source Fields” and hit execute.

    16. Enter the fields as shown below:

    17. Click SAVE and return to main screen.

    18. Select step 4 “Maintain Structure Relations” and click Execute.

    Select E1PORDCR and click on CREATE RelationShip. Following screen appears:

    Select HEADERDATA and hit ENTER

    Similarly do the same for the structure E1BPEKKOA, E1BPEKPOC and E1BPPEKET.

    Click Save and return to main screen.

    19. Select the step “Maintain Field Mapping and Conversion Rules” and click on execute. Maintain the Field Mapping as seen below:

    20. Select step 7 “Maintain Source Files” and provide the link for the test file created. (Create a test file with the same structure as defined earlier).

    Save and return to main screen.

    21. Select the step “Assign Files” and click on Execute.

    Assign the file provided to the source structure. Here the same file is provided for both the structures.

    Save and return to the main screen.

    22. Select the step “Read Data” and click on Execute.

    Click on Execute.

    Return to the main screen.

    23. Select the step “Display read data” and click on execute.

    Click on the structure name to get the field level values.

    24. Return to main screen and now select “Convert Data”.

    25. Return to the main screen and select “Display Converted data”.

    26. Return to main screen and select “Start IDoc generation”.

    27. Now select the step “Start IDoc Processing” on the main screen.

    28. Return to main screen and click on “Create IDoc overview”. Here the data record and status records of the IDoc could be viewed

    It is given in screen shot.

    http://www.saptechnical.com

    Regards

    Anji

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 06:52 AM

    Hi

    here i am giving a step by step procedure practice for ur object

    BAPI’s



    Advantages: Fast to load, easy processing, logical interface for functional/end user based on the business processes involved.
    Disadvantages: Not always complete with all input fields of a transaction

    Using BAPI in LSM Workbench



    We now go through a step by step process of realizing LSMW through a BAPI

    Details of BAPI used:
    - Business Object: BUS2012
    - Method: CreateFromData

    Details of Message Type and Basic IDoc Type:
    - Message Type: PORDCR
    - Basic IDoc Type: PORDCR02


    Step 1

    : Go to transaction LSMW

    Step 2

    : Enter project, subproject and object and click on Create

    Step 3

    : Enter the descriptions for Project, Subproject and Object as prompted

    Step 4:

    Now select Settings  IDoc Inbound Processing

    Step 5

    :“IDoc Inbound Processing” screen appears. Enter the required details as shown below:

    Step 6

    :Click on “Activate IDoc Inbound Processing”.

    Step 7

    : Click on “Yes” when prompted for “Activate IDoc Inbound?”

    Step 8

    : Hit on “Back” to return to the main screen

    Step 9:

    Click on Continue (F8). Following Screen appears

    Step 10

    : Select the Step 1 “Maintain Object Attributes” and select “Execute”

    Step 11

    : Select the radio button “Business Object Method” and enter the following details:

    Business Object: BUS2012
    Method: CreateFromData

    Step 12

    : Save and click on BACK button. Following information message is displayed

    Step 13:

    Maintain Source Structure

    Step 14

    :Create source structure ‘HEADERDATA’ and a lower level structure ‘ITEMDATA’

    Save and go back to main screen

    Step 15

    : Maintain source fields
    Enter the fields as shown below:

    Step 16

    :Maintain Structure Relations

    Maintain structure relations:
    - Select ‘E1PORDCR’ in previous fig. and click on CREATE Relationship. Following screen appears:

    - Select HEADERDATA and hit ENTER. Do the same for other
    structures

    Step 17

    :Maintain Field mapping and conversion rules. Maintain field mapping as shown:-


    Step 18

    : Specify File
    Provide the link for the test file. Maintain the same structure of the test file as defined before

    Step 19

    : Select ‘Assign Files’ & execute

    Step 20

    : Read Data

    Step 21

    : Display read data

    Step 22

    : Return to main screen and select ‘Convert Data’ followed by ‘Display Convert Data’

    Step 23

    : Return to main screen and select “Start IDoc generation”

    Step 24

    : Process Idoc through the step ‘Start Idoc Processing’ on main screen

    Step 25

    : Click on ‘Create Idoc Overview’ on the main screen. Here the data record and status record of the Idoc can be viewed

    Reward if usefull

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Naresh Thanks,

      But My requirement is to create Pricing conditions . If you know about BAPI for

      Pricing condition in LSMW please provide information.

      Thanks,

      Naga.