‎2011 Mar 15 3:52 AM
i m using "BAPI_GL_GETGLACCPERIODBALANCES" FUNCTION MODULE.
LOOP AT IT_OUTPUT INTO WA_OUTPUT .
CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
EXPORTING
COMPANYCODE = WA_OUTPUT-BUKRS
GLACCT = WA_OUTPUT-HKONT (A/C NO)
FISCALYEAR = WA_OUTPUT-GJAHR
CURRENCYTYPE = '10'
* IMPORTING
* BALANCE_CARRIED_FORWARD =
* RETURN =
TABLES
ACCOUNT_BALANCES = IT_OUTPUT.
ENDLOOP.I M GETTING ALL RECORDS IN IT_OUTPUT.BUT WHEN I AM USING THIS FM, I AM NOT GETTING RECORDS FOR ALL A/C NO.
PLZ SUGGEST .....
THANKS
Moderator message: please do not post in all upper case.
Edited by: Thomas Zloch on Mar 15, 2011 9:06 AM
‎2011 Mar 15 4:00 AM
Take one internal table like it_output.
After each call of FM append entries of it_output to that internal tabl.e
At final, you will get all entries.
‎2011 Mar 15 4:00 AM
Take one internal table like it_output.
After each call of FM append entries of it_output to that internal tabl.e
At final, you will get all entries.
‎2011 Mar 15 4:01 AM
You need to collect each exporting parameters in an internal table inside the loop.soemthing like append it_ouptut to it_output _final .
‎2011 Mar 15 4:28 AM
With this code, your IT_OUTPUT will be populated with values of last ACC_NO .. ie the last value in wa_output... This is because the table it_output will be overwritten each time.. You may have to store the values into a separate table, or take teh sum of the same as necessary for your logic.
‎2011 Mar 15 4:40 AM
THANKS GUYZ FOR REPLYING
I AM STORING IT ANOTHER TABLE "IT_BALNCE".
AND APPENDING THE TABLE IT_BALNCE.
BUT STILL THE OUTPUT IS SAME.
Moderator message: please do not post in all upper case!
Edited by: Thomas Zloch on Mar 15, 2011 9:07 AM
‎2011 Mar 15 4:51 AM
Hi Sanket,
You need to have three tables of type IT_OUTPUT,
1) One which will have the input values that you need to pass to the BAPI - IT_OUTPUT_IN.
2) The second table to get the out from the BAPI - IT_OUTPUT_OUT.
3) The third table to accumulate the output from the BAPI - IT_OUTPUT_FINAL.
change the code as given below,
LOOP AT IT_OUTPUT_IN INTO WA_OUTPUT .
CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
EXPORTING
COMPANYCODE = WA_OUTPUT-BUKRS
GLACCT = WA_OUTPUT-HKONT (A/C NO)
FISCALYEAR = WA_OUTPUT-GJAHR
CURRENCYTYPE = '10'
IMPORTING
BALANCE_CARRIED_FORWARD =
RETURN =
TABLES
ACCOUNT_BALANCES = IT_OUTPUT_OUT.
append lines of IT_OUTPUT_OUT to IT_OUTPUT_FINAL.
REFRESH: IT_OUTPUT_OUT.
ENDLOOP.
With your current code: You are overwriting the entries of IT_OUTPUT every time you are calling the BAPI, and re-using the same entries in the loop.
Regards,
Chen
‎2011 Mar 15 5:44 AM
See the following example :
FORM GET_BALANCE.
CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
EXPORTING
COMPANYCODE = P_BUKRS
GLACCT = P_HKONT
FISCALYEAR = B_YEAR
CURRENCYTYPE = '10'
IMPORTING
RETURN = RETURN
TABLES
ACCOUNT_BALANCES = ACCOUNT_BALANCES.
IF RETURN-TYPE IS INITIAL.
LOOP AT ACCOUNT_BALANCES WHERE FIS_PERIOD = S_PERI.
B_BALANCE = ACCOUNT_BALANCES-BALANCE.
REPTAB-BUDAT = S_DATE.
REPTAB-DMBTR_T = B_BALANCE.
APPEND REPTAB.
ENDLOOP.
ELSE.
REPTAB-BUDAT = S_DATE.
REPTAB-DMBTR_T = 0.
APPEND REPTAB.
ENDIF.
ENDFORM.
‎2011 Mar 15 8:12 AM
‎2011 Mar 15 8:51 AM
after Finish BAPI process system give message in return so You can define return like
DATA: RETURN LIKE BAPIRETURN.
‎2011 Mar 15 8:51 AM
after Finish BAPI process system give message in return so You can define return like
DATA: RETURN LIKE BAPIRETURN.
‎2011 Mar 15 11:00 AM