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

abap help

Former Member
0 Likes
735

hello, i need some help with abap. I am a BI person but I am doing some abap coding. I wrote a code to populate a profit center so what happens is when i extract data from ECC into bi it only populates profit center for a few records. i took a record that had NULL profit center and did extraction just for that record, it got loaded correctly with the profit center. do you think i am not refreshing internal tables correctly or what could it be? thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
700

'

' DATA: wa_temp TYPE /BIC/CS8ZFIAR_03 OCCURS 0 WITH HEADER LINE. 
DATA: lt_figl1 TYPE STANDARD TABLE OF /BIC/AZFIGL_0100 WITH HEADER LINE, 
ls_figl1 LIKE /BIC/AZFIGL_0100.
 
SELECT * FROM /BIC/AZFIGL_0100 INTO TABLE lt_figl1 
 FOR ALL ENTRIES IN DATA_PACKAGE 
 WHERE FISCYEAR = wa_temp-FISCPER+0(4)
 AND FISCVARNT = DATA_PACKAGE-FISCVARNT
 AND COMP_CODE = DATA_PACKAGE-COMP_CODE
 AND DOC_NUM = DATA_PACKAGE-AC_DOC_NO
 AND ITEM_NUM = DATA_PACKAGE-ITEM_NUM
 AND GL_ACCOUNT = DATA_PACKAGE-GL_ACCOUNT. 
 
 LOOP AT DATA_PACKAGE INTO wa_temp. 
 
   READ TABLE LT_FIGL1 WITH KEY 
 
 FISCYEAR = wa_temp-FISCPER+0(4)
 FISCVARNT = wa_temp-FISCVARNT
 COMP_CODE = wa_temp-COMP_CODE
 AC_DOC_NO = wa_temp-AC_DOC_NO
 ITEM_NUM = wa_temp-ITEM_NUM
 GL_ACCOUNT = wa_temp-GL_ACCOUNT.
 
 IF SY-SUBRC = 0. 
 
 LOOP AT lt_figl1 INTO ls_figl1. 
 
wa_temp-PROFIT_CTR = ls_figl1-PROFIT_CTR. 
wa_temp-CO_AREA = ls_figl1-CO_AREA. 
wa_temp-LOC_CURRCY = ls_figl1-LOC_CURRCY. 
wa_temp-DEBIT_LC = ls_figl1-DEBIT_LC. 
wa_temp-CREDIT_LC = ls_figl1-CREDIT_LC. 
wa_temp-DEB_CRE_LC = ls_figl1-DEB_CRE_LC. 
wa_temp-DOC_CURRCY = ls_figl1-DOC_CURRCY. 
wa_temp-DEBIT_DC = ls_figl1-DEBIT_DC. 
wa_temp-DEB_CRE_DC = ls_figl1-DEB_CRE_DC. 
wa_temp-DOC_NUM = ls_figl1-DOC_NUM. 
wa_temp-DOC_ITEM = ls_figl1-DOC_ITEM. '

'

5 REPLIES 5
Read only

Former Member
0 Likes
700

Please paste your code to see what is the problem.

Read only

Former Member
0 Likes
701

'

' DATA: wa_temp TYPE /BIC/CS8ZFIAR_03 OCCURS 0 WITH HEADER LINE. 
DATA: lt_figl1 TYPE STANDARD TABLE OF /BIC/AZFIGL_0100 WITH HEADER LINE, 
ls_figl1 LIKE /BIC/AZFIGL_0100.
 
SELECT * FROM /BIC/AZFIGL_0100 INTO TABLE lt_figl1 
 FOR ALL ENTRIES IN DATA_PACKAGE 
 WHERE FISCYEAR = wa_temp-FISCPER+0(4)
 AND FISCVARNT = DATA_PACKAGE-FISCVARNT
 AND COMP_CODE = DATA_PACKAGE-COMP_CODE
 AND DOC_NUM = DATA_PACKAGE-AC_DOC_NO
 AND ITEM_NUM = DATA_PACKAGE-ITEM_NUM
 AND GL_ACCOUNT = DATA_PACKAGE-GL_ACCOUNT. 
 
 LOOP AT DATA_PACKAGE INTO wa_temp. 
 
   READ TABLE LT_FIGL1 WITH KEY 
 
 FISCYEAR = wa_temp-FISCPER+0(4)
 FISCVARNT = wa_temp-FISCVARNT
 COMP_CODE = wa_temp-COMP_CODE
 AC_DOC_NO = wa_temp-AC_DOC_NO
 ITEM_NUM = wa_temp-ITEM_NUM
 GL_ACCOUNT = wa_temp-GL_ACCOUNT.
 
 IF SY-SUBRC = 0. 
 
 LOOP AT lt_figl1 INTO ls_figl1. 
 
wa_temp-PROFIT_CTR = ls_figl1-PROFIT_CTR. 
wa_temp-CO_AREA = ls_figl1-CO_AREA. 
wa_temp-LOC_CURRCY = ls_figl1-LOC_CURRCY. 
wa_temp-DEBIT_LC = ls_figl1-DEBIT_LC. 
wa_temp-CREDIT_LC = ls_figl1-CREDIT_LC. 
wa_temp-DEB_CRE_LC = ls_figl1-DEB_CRE_LC. 
wa_temp-DOC_CURRCY = ls_figl1-DOC_CURRCY. 
wa_temp-DEBIT_DC = ls_figl1-DEBIT_DC. 
wa_temp-DEB_CRE_DC = ls_figl1-DEB_CRE_DC. 
wa_temp-DOC_NUM = ls_figl1-DOC_NUM. 
wa_temp-DOC_ITEM = ls_figl1-DOC_ITEM. '

'

Read only

0 Likes
700

Hi,

In the debug see which record is not populating, or after the execution is done find out the record numbers and then do the debug to see what is happening at that record. this will give the actual situation.

Thanks

Srini.

Read only

0 Likes
700

Hi,

I see a basic problem with your code.

First your are using LOOP AT DATA_PACKAGE.. THIS IS FINE

Then READ TABLE LT_FIGL1 WITH KEY ---

And after that again loop at LT_FIGL1 with no condition............ this is going to give you results that does not satisfy the key.

Do this:

LOOP AT DATA_PACKAGE

LOOP AT LT_FIGL1 WHERE... your condition, No need for the read statement.

Regards

Prasenjit

Read only

0 Likes
700

This code looks ok. Try to revise your logic as peer your requirement. Check the flow of this code in debugger.