2008 Aug 27 7:41 AM
Hi,
I am updating the PO info based on the data from the flat file. that means I am uploading data from flat file and checking this data with the table data if there are any changed=s in the table data I am modifying it.
For that i am using BAPI_PO_CHANGE
the code is as below.
TYPES : BEGIN OF ty_ekko,
ebeln TYPE ebeln,
ekorg TYPE ekorg,
ekgrp TYPE bkgrp,
END OF ty_ekko.
DATA : it_flatfile TYPE TABLE OF ty_ekko ,
wa_flatfile TYPE ty_ekko,
it_ekko1 TYPE TABLE OF ty_ekko,
wa_ekko1 TYPE ty_ekko.
DATA : v_file TYPE string.
DATA : wa_header TYPE bapimepoheader,
wa_headerx TYPE bapimepoheaderx.
data: it_return type table of bapiret2.
PARAMETERS : p_file TYPE ibipparms-path.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION.
MOVE p_file TO v_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
has_field_separator = 'X'
TABLES
data_tab = it_flatfile.
IF NOT it_flatfile IS INITIAL.
SELECT ebeln ekorg ekgrp
FROM ekko
INTO TABLE it_ekko1
FOR ALL ENTRIES IN it_flatfile
WHERE ebeln = it_flatfile-ebeln .
ENDIF.
LOOP AT it_flatfile INTO wa_flatfile.
READ TABLE it_ekko1 INTO wa_ekko1 WITH KEY ebeln = wa_flatfile-ebeln.
IF sy-subrc EQ 0.
IF wa_flatfile-ekorg NE wa_ekko1-ekorg OR
wa_flatfile-ekgrp NE wa_ekko1-ekgrp.
wa_header-po_number = wa_flatfile-ebeln.
wa_header-purch_org = wa_flatfile-ekorg.
wa_header-pur_group = wa_flatfile-ekgrp.
wa_headerx-po_number = wa_flatfile-ebeln.
wa_headerx-purch_org = 'X'.
wa_headerx-pur_group = 'X'.
ENDIF.
ENDIF.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = wa_ekko1-ebeln
poheader = wa_header
poheaderx = wa_headerx
TABLES
RETURN = it_return
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDLOOP.
but the data is not being updated. I am having some errors in the return table.
I am updating only the header data
kindly help me in this issue
Regards
Hi,
I am updating the PO info based on the data from the flat file. that means I am uploading data from flat file and checking this data with the table data if there are any changed=s in the table data I am modifying it.
For that i am using BAPI_PO_CHANGE
the code is as below.
TYPES : BEGIN OF ty_ekko,
ebeln TYPE ebeln,
ekorg TYPE ekorg,
ekgrp TYPE bkgrp,
END OF ty_ekko.
DATA : it_flatfile TYPE TABLE OF ty_ekko ,
wa_flatfile TYPE ty_ekko,
it_ekko1 TYPE TABLE OF ty_ekko,
wa_ekko1 TYPE ty_ekko.
DATA : v_file TYPE string.
DATA : wa_header TYPE bapimepoheader,
wa_headerx TYPE bapimepoheaderx.
data: it_return type table of bapiret2.
PARAMETERS : p_file TYPE ibipparms-path.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION.
MOVE p_file TO v_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
has_field_separator = 'X'
TABLES
data_tab = it_flatfile.
IF NOT it_flatfile IS INITIAL.
SELECT ebeln ekorg ekgrp
FROM ekko
INTO TABLE it_ekko1
FOR ALL ENTRIES IN it_flatfile
WHERE ebeln = it_flatfile-ebeln .
ENDIF.
LOOP AT it_flatfile INTO wa_flatfile.
READ TABLE it_ekko1 INTO wa_ekko1 WITH KEY ebeln = wa_flatfile-ebeln.
IF sy-subrc EQ 0.
IF wa_flatfile-ekorg NE wa_ekko1-ekorg OR
wa_flatfile-ekgrp NE wa_ekko1-ekgrp.
wa_header-po_number = wa_flatfile-ebeln.
wa_header-purch_org = wa_flatfile-ekorg.
wa_header-pur_group = wa_flatfile-ekgrp.
wa_headerx-po_number = wa_flatfile-ebeln.
wa_headerx-purch_org = 'X'.
wa_headerx-pur_group = 'X'.
ENDIF.
ENDIF.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = wa_ekko1-ebeln
poheader = wa_header
poheaderx = wa_headerx
TABLES
RETURN = it_return
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDLOOP.
but the data is not being updated. I am having some errors in the return table.
I am updating only the header data
kindly help me in this issue
Regards
2008 Aug 27 8:20 AM
Hi,
You might be sending only header data .
What i see from FM call that u hav sent only header data.
u didn't populate other tables .
say for ex POITEM and hav to populate POITEMX for which fields u wanna change.
Rhea
2008 Aug 27 8:50 AM
2008 Aug 27 8:55 AM
there may be sevral reason behind this.from here hard to guess.first just check whether you have aurthorization to change PO ot not?than check Security (BC-SEC) which standas a firewall(A special server in computer networks that prevents unauthorized penetration (dialling in) of external people and/or the transfer of data that is not to be transferred.)
for more info carefully read Functionality in Detail from documentation.
Amit.
2008 Sep 08 5:37 AM
Sorry guys its prob with the authorizations, and settings in my server
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |