2005 Feb 01 8:13 PM
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.
2005 Feb 01 8: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
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
2005 Feb 01 8: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
2005 Feb 01 10:48 PM
Hi Rich,
I have set the breakpoint & in the debug mode found out that in the 2nd iteration of the loop V_BUKRS is empty. Can u analyse what the problem is ...
Thanx,
seema.
2005 Feb 02 1:26 PM
Can't really analyze what is happening without all your program code and perhaps your flat file. You are hitting this table more than once per each record of your flat file, this is not efficient, did you change your select statement as per my instruction eariler?
This way you will only be hitting the table once per flat file record.
I tend to agree with the previous poster about getting your company code from the TKA02 table. But your way would work in my system. We have one company code with one controlling area and all the cost centers are tied to them.
Make sure that the value that you are getting from the flat file is a valid value to select the data from the db.
Regards,
Rich Heilman
Message was edited by: Rich Heilman
2005 Feb 02 1:37 PM
Hey ,
Thanx guys for your valuable time & suggestion.... Now I am able to do it...
Thanx to one & all...
-Seema.
2005 Feb 02 4:09 PM
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
2005 Feb 01 8: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
2005 Feb 01 10:16 PM
Hi ,
I checked up the db table & could find that for one controlling area there is one company code ... but the cost center are created with the concatenation of company code + 7-11 digits of the 26 digits that will be coming from the flat file (these 5 digits that I am concatenating is the functial area... ) + '0'....
Thanx,
Seema.
2005 Feb 01 10:34 PM
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
2005 Feb 02 8: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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |