2024 Jun 21 9:33 PM - edited 2024 Jun 28 11:36 PM
Hello i have a problem with loop,, date retrieve 1 time at first tabx and when debugging i see tabx not going to tabx 2 or 3 and fm not retrieve any data really i cant understand.. image for code attched
REPORT YEH_TEST_BAPI.
TABLES : EKKo.
DATA: lo_msg_handler TYPE REF TO cl_message_handler_mm.
DATA :
LT_PO_DETAILS TYPE TABLE OF BAPIEKBES,
LS_PO_DETAILS TYPE BAPIEKBES,
T_RETURN TYPE TABLE OF BAPIRET2,
W_RETURN LIKE BAPIRET2.
DATA counter TYPE i.
SELECT-OPTIONS:
PO_NO FOR EKKO-EBELN NO INTERVALS.
START-OF-SELECTION .
LOOP at PO_NO.
CALL FUNCTION 'BAPI_PO_GETDETAIL1'
EXPORTING
PURCHASEORDER = PO_NO-LOW
TABLES
POHISTORY_TOTALS = LT_PO_DETAILS
RETURN = T_RETURN.
IF T_RETURN IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
cl_demo_output=>display( LT_PO_DETAILS ).
ENDLOOP.
Request clarification before answering.
Some things here:
1. You should not loop at select-options.
2. You don’t need BAPI_TRANSACTION_COMMIT… when using a read bapi. These are only for create basis…
Try something like this:
select * from ekko
into table @DATA(lt_ekko)
where ebeln in @PO_no.
loop at lt_ekko into data(ls_ekko).
“Read details with bapi here….
endloop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sorry for late answer , I edit my Question with Add Code ,
Yes my problem is not going to tabx 2 and 3 .....
Bapi fm just retrieve the first index , second and third and .... not retrieve any data in table .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again
I have no idea what you are trying to get with you code? But if i should do it i would do it like this (except it makes no sence to print multiple POs like this):
*&---------------------------------------------------------------------*
*& Report ZJSP_TEST_IO
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zjsp_test_io.
TABLES : ekko.
DATA: lo_msg_handler TYPE REF TO cl_message_handler_mm.
DATA :
lt_po_details TYPE TABLE OF bapiekbes,
ls_po_details TYPE bapiekbes,
lt_items TYPE bapimepoitem_tp,
t_return TYPE TABLE OF bapiret2,
w_return LIKE bapiret2.
DATA counter TYPE i.
SELECT-OPTIONS:
po_no FOR ekko-ebeln NO INTERVALS.
START-OF-SELECTION .
SELECT * FROM ekko
INTO TABLE @DATA(lt_ekko)
WHERE ebeln IN @PO_no
AND bstyp EQ 'F'.
LOOP AT lt_ekko INTO DATA(ls_ekko).
CALL FUNCTION 'BAPI_PO_GETDETAIL1'
EXPORTING
purchaseorder = ls_ekko-ebeln
TABLES
poitem = lt_items
pohistory_totals = lt_po_details
return = t_return.
cl_demo_output=>display( lt_items ).
cl_demo_output=>display( lt_po_details ).
ENDLOOP.
Also: be aware that pohistory_totals will only contain data if there acually is any (Goods Receipts or likely). A brand new PO would have nothing in this table...
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.