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

retrieving data from structure SKC1A

Former Member
0 Likes
3,503

Hi all,

I have a requirement to create a file containing data from the structure SKC1A. I have been searching here to find out to do this. I have found out that there is a table GLT0 that contains the same data but when I check in my system the record count is 0. I also found out that there is a function READ_SKC1A but I am not sure what this does or how to use it in a ABAP program. i have also seen code like

DATA: BEGIN OF s_bbseg.

INCLUDE STRUCTURE bbseg.

DATA: END OF s_bbseg.

I have taken one of the fields and did the SE11 and the where-used process and came up with several tables. If someone could tell me what I can do to be able to get data from SKC1A that would be very helpful.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,762

I checked the DEV system and there is only one record that has money for the hierarchy that I was using. I switched to the corporate hierarchy and now I am getting more data. thanks for help on this. the next hurdle is to take this data and write it to a file so that I can use the GUI-DOWNLOAD process to send it to a C drive.

17 REPLIES 17
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,762

How did you come across this structure, via a transaction? where do you see this data?

Regards,

RIch Heilman

Read only

suresh_datti
Active Contributor
0 Likes
2,762

Hi Timothy,

Try this.. attach your report to the Logical databse SDF in the program attributes & use the following approach to get the data..


tables: skc1a

start-of-selection.

get skc1a.
* SKC1A should now be filled with data

end-of-selection.

Regards,

Suresh Datti

Read only

0 Likes
2,762

You could try this also. Enter the company code and the gl account number.



report zrich_0001 .

data: iskc1a type table of skc1a with header line.

parameters: p_bukrs type bseg-bukrs.
parameters: p_saknr type bseg-saknr.

call function 'FOR_ALL_SKC1A'
     exporting
          xbukrs = p_bukrs
          xsaknr = p_saknr
     tables
          xskc1a = iskc1a.


loop at iskc1a.
  write:/ iskc1a-bukrs, iskc1a-saknr, iskc1a-umsav.

endloop.

Regards,

Rich Heilman

Read only

0 Likes
2,762

You could also use the other function module, I'm getting the same results.



report zrich_0001 .

data: iskc1a type table of skc1a with header line.

parameters: p_bukrs type bseg-bukrs.
parameters: p_gjahr type bseg-gjahr no-display.
parameters: p_gsber type bseg-gsber no-display.
parameters: p_saknr type bseg-saknr.


call function 'READ_SKC1A'
     exporting
          xbukrs         = p_bukrs
          xgjahr         = p_gjahr
          xgsber         = p_gsber
          xsaknr         = p_saknr
     importing
          xskc1a         = iskc1a
     exceptions
          key_incomplete = 1
          not_authorized = 2
          not_found      = 3.

loop at iskc1a.
  write:/ iskc1a-bukrs, iskc1a-saknr, iskc1a-umsav.

endloop.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
2,762

Hi Timonthy,

Have you looked at program <b>RFFWAB00</b> and <b>RFFDUZ00</b>? Hope it will help.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
2,762

the user sent me the requirements with a file layout containing the fields and the the structure SKC1a. I am not sure what transaction he is using.

Read only

Former Member
0 Likes
2,762

When you say GLT0 is empty, are you referring to your production system? I think there should be data there.

Rob

Read only

Former Member
0 Likes
2,762

response to "When you say GLT0 is empty, are you referring to your production system? I think there should be data there.

"

This is on a test test system

Read only

0 Likes
2,762

You'll need to run the programs suggested here on a system that contains data in GLT0 (typically a QA environment).

Rob

Read only

Former Member
0 Likes
2,762

I have a liitle more information. The proces is to retrieve the total credit and debit balances for a account for the selected company for a selected year. the account selection will be driven from a hierarchy. I was going to do the following. can someone tell me if I am on the right path and if not, possibly suggest an alternate.

1) input the KOTPL and select account, and text from SKAT into an internal table.

2) read the internal table into into the function FOR_ALL_SKC1A and select all the records for the account and company and store into an internal table. I was going to use the READ_SKC1A funtion becaue you can pass the year but you also have to pass the business area and we do not require that.

3) sort the internal table by account.

4) sum the amounts by account. I am not sure if the summing of the amounts can be done in the sort process or not.

5) read the internal tabel and write the file to the C drive using GUI_DOWNLOAD function.

Read only

Former Member
0 Likes
2,762

I having a problem with the code that is attached. refer to prevoius replay for details of the process that I am trying to accomplish. I am doing this in stages to see if I am getting the correct results before moving to the next part of the program. right now i am selecting the accounts from SKAT and calling the function FOR_ALL SKC1A.

fir the first several accounts, I am not getting any date with write statement. I am thinking that this is due to the fact that there is no activity for the account. i eventually get data for the write statement. when I process the next account after the write statement, I get the correct text (it_skat-txt50) but everything else is the same as the first record that I wrote. it looks like something is not being cleared out or that I am writing the first record from the iskc1a table over and over. if someone could please look at the code and possibly tell me what I am doing wrong, that would be a big help.

REPORT ZTESTDOWNLOAD.

TABLES:

skat. "G/L Account Master Record (Chart of Accounts: Description)

parameters: p_bukrs type bseg-bukrs.

TYPES: BEGIN OF ty_skat,

saknr TYPE skat-saknr, "Account Number

txt50 TYPE skat-txt50, "account Description

END OF ty_skat.

data: iskc1a type table of skc1a with header line.

data: it_skat TYPE STANDARD TABLE OF ty_skat with header line.

SELECT saknr txt50

FROM skat INTO

TABLE it_skat

WHERE ktopl = 'CEFR'.

loop at it_skat.

call function 'FOR_ALL_SKC1A'

exporting

xbukrs = p_bukrs

xsaknr = it_skat-saknr

tables

xskc1a = iskc1a

exceptions

key_incomplete = 1

not_authorized = 2

not_found = 3.

loop at iskc1a.

write:/ iskc1a-bukrs, iskc1a-saknr, it_skat-txt50,

iskc1a-umsav,iskc1a-gjahr, iskc1a-um01s, iskc1a-um01h.

endloop.

endloop.

Read only

0 Likes
2,762

Tim, please try adding the line of code in BOLD>



loop at it_skat.

<b>  clear iskc1a. refresh iskc1a.</b>
  call function 'FOR_ALL_SKC1A'
       exporting
            xbukrs         = p_bukrs
            xsaknr         = it_skat-saknr
       tables
            xskc1a         = iskc1a
       exceptions
            key_incomplete = 1
            not_authorized = 2
            not_found      = 3.

  loop at iskc1a.
    write:/ iskc1a-bukrs, iskc1a-saknr, it_skat-txt50,
    iskc1a-umsav,iskc1a-gjahr, iskc1a-um01s, iskc1a-um01h.

  endloop.
endloop.

Please also make sure to award points for helpful answers and mark you post as solved when solved completely. Thanks.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
2,762

I tried with the inserted code. now instead of getting a full list of transactions, I get two lines, one for 2005 and one for 2006.

Read only

0 Likes
2,762

Ok, this program you have written works pretty good in my system. Which means that maybe what you are seeing is the data as it is? Or are you expecting more?

Regards,

Rich HEilman

Read only

Former Member
0 Likes
2,763

I checked the DEV system and there is only one record that has money for the hierarchy that I was using. I switched to the corporate hierarchy and now I am getting more data. thanks for help on this. the next hurdle is to take this data and write it to a file so that I can use the GUI-DOWNLOAD process to send it to a C drive.

Read only

0 Likes
2,762

Ok, cool. Please award points for helpful answers here and mark your post as solved. If you have trouble with the GUI_DOWNLOAD part please search the forum or post another topic for the question. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
2,762

Here is a sample program to get you started with GUI_DOWNLOAD.




report zrich_0001.

data: begin of itab occurs 0,
      fld1(10) type c,
      fld2(10) type c,
      fld3(10) type c,
      end of itab.


itab-fld1 = 'A'.
itab-fld2 = 'B'.
itab-fld3 = 'C'.
append itab.

itab-fld1 = 'D'.
itab-fld2 = 'E'.
itab-fld3 = 'F'.
append itab.

call function 'GUI_DOWNLOAD'
     exporting
          filename = 'C:test.txt'
     tables
          data_tab = itab.

Regards,

Rich heilman