Skip to Content
author's profile photo Former Member
Former Member

Help required-LSMW.

Hi,

My requirement is that I will get a flat file in which one of the fields will be with 26 digits... I am using transaction KS01... So for the cost center creation the criteria is that I need to concatenate the company code, the 7-11 digits (of the 26 digit field) & zero '0'... I am able to do this for the first record ... but I am not able to get the same for the second record... the logic that i have written is as follows:-

in the field mapping step under the cost center I written the following ABAP code.

DATA : V_BUKRS LIKE CSKS-BUKRS.

SELECT BUKRS

INTO V_BUKRS

FROM CSKS

WHERE KOKRS = SOURCE-CONTROLLING_AREA.

CONCATENATE V_BUKRS

SOURCE-26DIGIT_CTCTR+6(5)

'0'

INTO TARGET-KOSTL.

ENDSELECT.

How do I debug this program in LSMW??

Your help is appreciated.

-Seema.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Feb 01, 2005 at 08:23 PM

    Double click on "convert data" in your LSMW.

    This will take you to your conversion program.

    Click system, status. See your program name, double click it. Now look for your code, set a breakpoint. Come back out to your conversion program selection screen and click execute.

    Also, it might be better if your select was more like this.

    
    DATA : V_BUKRS LIKE CSKS-BUKRS.
    
    clear v_bukrs.
    SELECT Single BUKRS INTO V_BUKRS
         FROM CSKS
             WHERE KOKRS = SOURCE-CONTROLLING_AREA.
    if sy-subrc  = 0.
    CONCATENATE V_BUKRS SOURCE-26DIGIT_CTCTR+6(5) '0'
              INTO TARGET-KOSTL.
    endif.
    
    

    Regards,

    Rich Heilman

    Message was edited by: Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi all

      i am new to lsmw and trying to create a retail material through lsmw. i chose business object method with business object as bus1001001.method is 'clone'

      everything has gone well and i could create a material too.

      but in unit field,(i.e the display of all types of units) the legacy data contains 4 rows of units. when i transfer them the new created material displays only one line of units. the other three rows in material display (code transaction- mm43)are empty.

      i have tried using on_change_transfer too but that doesnt seem to make any difference.

      your reply will be a great help. thanks and regards

  • Posted on Feb 01, 2005 at 08:47 PM

    Hi Seema,

    When you are in the initial screen of LSMW for the object(with all the radio-buttons), click on the 'Personal Menu' push button and select the checkbox for 'Display Conversion Program.'. Then you can simply select that action and put a break-point in the code section and debug it.

    But if I may comment, just based on the code piece given here, your 'SELECT statement may not be returning any records for your second record.

    Is your SOURCE-CONTROLLING_AREA field similar to CSKS-KOKRS? Otherwise a select like this might not return any values.

    Also, there is a potential for multiple records to be fetched from CSKS since you are passing only partial key. So, essentially you are moving your concatenated value into the TARGET-KOSTL based on your last record from that select.

    What is your requirement with regards to the BUKRS? Is it that you need to create cost centers for all BUKRS assigned to a given controlling area on the file?

    Please let us know.

    Srinivas

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Seema,

      It may be that way now, but there can be multiple company codes assigned to a single controlling area. Confirm with your functional consultant that one-to-one relationship is what they intend to keep.

      Also, CSKS is the cost center table. If you want to get the company codes assigned to a controlling area, use the view V_TKA02.

      Any luck in the debugging, to help on finding out the issue?

      Srinivas

  • Posted on Feb 02, 2005 at 08:54 AM

    Hi Seema,

    your select of csks seems to be strange.

    what's your relation between controlling aerea (Kokrs)

    and company (bukrs) is it 1:1 or is it 1:n ?

    if it's 1:1 you've to select TKA02

    if it's 1 kokrs : n Bukrs you can't find out the correct company - you need more information in your flat file !

    regards Andreas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.