05-17-2017 8:07 AM
Dear all
i have an query that in loop where condition is not working , plz find below code.
DATA : IT_GETSTATEMENT TYPE STANDARD TABLE OF BAPI3008_2 WITH HEADER LINE.
CALL FUNCTION 'BAPI_AP_ACC_GETSTATEMENT'
EXPORTING
companycode = T_BUKRS
vendor = T_LIFNR
date_from = t_date-low
date_to = t_date-high
* NOTEDITEMS = ' '
* IMPORTING
* RETURN =
TABLES
lineitems = IT_GETSTATEMENT.
LOOP AT IT_GETSTATEMENT where doc_type = 'AB'.
endloop.
My question is in above loop where condition doc_type = 'AB'. is not working.
05-17-2017 8:35 AM
Your first loop should be AT RETURN table for error message(s)...
And please remove this ugly HEADER LINE.
05-17-2017 10:44 AM
i tried by removing header line , declare as
DATA : IT_GETSTATEMENT TYPE STANDARD TABLE OF BAPI3008_2,
WA_GETSTATEMENT TYPE STANDARD TABLE OF BAPI3008_2
LOOP AT IT_GETSTATEMENT INTO WA_GETSTATEMENT where doc_type = 'AB'.
endloop.
STILL MY PROBLEM IS NOT RESOLVED ,WHERE CONDITION IS NOT WORKING
05-17-2017 12:37 PM
Are there error(s) in RETURN table or any item returned in LINEITEMS, can you see items with FBL1N?
05-17-2017 12:42 PM
DATA : IT_GETSTATEMENT TYPE STANDARD TABLE OF BAPI3008_2,
WA_GETSTATEMENT TYPE STANDARD TABLE OF BAPI3008_2
LOOP AT IT_GETSTATEMENT INTO WA_GETSTATEMENT
Well, the above is syntactically incorrect. You can't loop at a table into another internal table. So at least at this point the WHERE clause is irrelevant.
Please be precise. What do you mean by "not working". (shouting in BOLD CAPITALS doesn't in fact provide addiitional useful information to folk who are trying to help you). How have you demonstrated that it isn't working? Do you know there are documents with doc_type AB? Have you used debug? Have you examined the flow in debugger?
05-17-2017 1:36 PM
Dear sir
I am not shouting , i am just trying to highlight the area so that you understand quickly, sorry if you feel bad .i used debug also but after entering in loop documents related to doc_type AB is coming with other documents also.
05-17-2017 1:37 PM
Dear sir
I am not shouting , i am just trying to highlight the area so that you understand quickly, sorry if you feel bad .i used debug also but after entering in loop documents related to doc_type AB is coming with other documents also.
05-17-2017 1:56 PM
Try a code like following sample
DATA : lineitems TYPE STANDARD TABLE OF bapi3008_2,
return TYPE bapireturn.
FIELD-SYMBOLS: <lineitem> TYPE bapi3008_2.
PARAMETERS: p_comp TYPE bapi3008_1-comp_code,
p_vendor TYPE bapi3008_1-vendor.
SELECT-OPTIONS so_date FOR <lineitem>-pstng_date NO-EXTENSION.
START-OF-SELECTION.
" call BAPI
CALL FUNCTION 'BAPI_AP_ACC_GETSTATEMENT'
EXPORTING
companycode = p_comp
vendor = p_vendor
date_from = so_date-low
date_to = so_date-high
IMPORTING
return = return
TABLES
lineitems = lineitems.
" Check for errors
IF return-type IS NOT INITIAL.
MESSAGE return-message TYPE return-type.
ENDIF.
" Loop at returned items
LOOP AT lineitems ASSIGNING <lineitem> WHERE doc_type = 'AB'.
BREAK-POINT. " for testing purpose
ENDLOOP.
05-18-2017 5:38 AM
".i used debug also but after entering in loop documents related to doc_type AB is coming with other documents also."
Show me a screen shot of the debug screen, inside the loop, with the field wagetstatement-doctype with a value that's not AB.
05-18-2017 10:32 AM
05-18-2017 10:45 AM
ok. sir i will remember those things which you sugggested from next time ,,Thanks sir