2LIS_02_ITM, LOEKZ AND ROCANCEL
Hi SDN,
We have some Purchase Orders for which LOEKZ = 'L' but they still exist in BI DSO because ROCANCEL with 'R' have not come in yet.
Are ROCANCEL and LOEKZ linked in a way that 'L' in LOEKZ translates to 'R" in ROCANCEL or SAP considers other things before marking 'ROCANCEL' = 'R' for reversal?
Should we assume that whenever EKPO-LOEKZ = 'L', the record in the DSO should be dropped after the next load? And if not, what is the relationship and what can we expect?
We have mapped ROCANCEL to both RECORDMODE as well as STOR_NO.
Please advise.
Thanks.
SM.
Hi
There as 2 possibilities
1.
PO item is deleted and there is no statistical relevance ( i.e. no GR / IR created against that po item), in that case LIS logic is intelligent enough and simply sets recormode = D and that po item gets deleted from BW. in that case loekz is extracted as blank . you can check in rsa3
2. po item is deleted but it still has statistical relevance aginst it. then LIS logic does not delete such items from bw and sends loekz ='L' in extraction. however if you still want that such PO items shud be deleted from BW,, then you can write routine to below effect
loop at datapack
if datapak-loekz = 'L'
datapak- recordmodel = 'D'
modify datapak
endif
endloop
i dont remember sap note.. i will post later once can find it
regards
sanjyot
Similar Messages
-
Link between 0RECORDMODE AND ROCANCEL
Hi, could you pls explaint the link between 0RECORDMODE and ROCANCEL
I just dont understand why they are mapped in transferrules. and i dont have the field ROCANCEL field in my datasource. actually what scenario makes 0RECORDMODE and ROCANCEL go together could u pls explain
Thanks in Advance,
Pallavi.Hi,
First: the recrodmode controls how data is posted into cubes or ODS (DSO) Objects.
Different Chars have different meanings:
N for new records
B for Pre Imgages
' ' for after images
R for Reverse Images
X for Storno
D for Deletion of a Key (only in ODS possible)
What extractor delivers what different types pof values can be seen via to tables:
ROOSOURCE in the source R/3 System.
There point out th edelta mechanism. With this value, check within Table RODELTAM. There you see the different POSSIBLE Values for ROCANCEL delivered by a DataSource.
The relevant objekt for the controlling of the mode in BW is the InfoObject 0RECORDMODE. Each ODS (DSO) has this Object. For Logistic-Extractors (except MaterialManagement) 0RECORDMODE should be mapped with ROCANCEL.
0STORNO generally is an InfoObject for Reports. E.G. Material movements. Stornos are posted in R/3 with particular so called movement types. Each movement typer contains an information if it is of type "Storno". If this is so, the field storno contains an X.
If you now map the storno field onto 0RECORDMODE, the record is interpreted as a storno record an will be wied blank ini the DataTarget.
If you have monotone increasing document numbers (like in CO-PA, CO-OM, MM-INV ...) 0RECORDMODE should be left blank. 0STORNO can be used for Reporting then and be filled differently.
If you can have changes to an already existing document number (like in sales orders or purchase orders) i'd strongly recommend to map 0RECORDMODE onto the delivered ROCALNCEL field.
also Check
Refer OSS Note 399739 and 333492
Thanks..Assign points if helpful.
´Tony -
Could you please explain me about 0Recordmode and ROCANCEL and how they are related if at all?
Hi,
Infoobject 0recordmode maintains the images for delta's.it keep tracks the Delta changes.
0recordmode is used when we go for delta
0recordmode is the field added by the system, if the ds if delta capable.
In ODS it is added at the time of creation of the ODS.The 0recordmode is most useful in the delta loads from the ODS to another ODS/Cube.
Include the 0RECORDMODE in your ODS but assign ""(space) in the transfer rules. The 0RECORDMODE would get populated by the system itself.
First: the recrodmode controls how data is posted into cubes or ODS (DSO) Objects.
N for new records
B for Pre Imgages
' ' for after images
R for Reverse Images
X for Storno ()
D for Deletion of a Key (only in ODS possible)
Y-Update image
What extractor delivers what different types of values can be seen via to tables:
ROOSOURCE in the source R/3 System.
There point out the delta mechanism. With this value, check within Table RODELTAM. There you see the different POSSIBLE Values for ROCANCEL delivered by a DataSource.
The relevant object for the controlling of the mode in BW is the InfoObject 0RECORDMODE. Each ODS (DSO) has this Object. For Logistic-Extractors (except MaterialManagement) 0RECORDMODE should be mapped with ROCANCEL.
ROCANCEL (0STORNO) is Cancellation indicator
0STORNO generally is an InfoObject for Reports. E.G. Material movements. Stornos are posted in R/3 with particular so called movement types. Each movement typer contains an information if it is of type "Storno". If this is so, the field storno contains an X.
If you now map the storno field onto 0RECORDMODE, the record is interpreted as a storno record and will be with blank in the DataTarget.
If you have monotone increasing document numbers (like in CO-PA, CO-OM, MM-INV ...) 0RECORDMODE should be left blank. 0STORNO can be used for Reporting then and be filled differently.
If you can have changes to an already existing document number (like in sales orders or purchase orders) i'd strongly recommend to map 0RECORDMODE onto the delivered ROCANCEL field.
This attribute describes how a record in the delta process is updated. The various delta processes differ in that they each only support a subset of the seven possible characteristic values. If a Data Source implements a delta process that uses several characteristic values, the record mode must be a part of the extract structure and the name of the corresponding filed must be entered in the Data Source as a cancellation field (ROOSOURCE-INVFIELD).
The seven characteristic values are as follows:
look at OSS Note 399739 'Questions and answers on InfoObject 0RECORDMODE'
http://help.sap.com/saphelp_nw04/helpdata/en/84/81eb588fc211d4b2c90050da4c74dc/frameset.htm
http://help.sap.com/saphelp_erp2004/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
Hope this helps.
Thanks,
JituK -
Hello,
Can someone please explain what below code do? Is this deleting records from loading into transfer structure? This was added in the start routine of transfer rule for Purchasing ODS.
APPEND LINES OF DATAPAK TO I_DATAPAK
DELETE I_DATAPAK WHERE ROCANCEL <> 'R'.
LOOP AT I_DATAPAK INTO LS_DATAPAK.
IF LS_DATAPAK-ROCANCEL = 'R'.
LS_DATAPAK-LOEKZ = 'L'.
LS_DATAPAK-ROCANCEL = SPACE.
MODIFY I_DATAPAK FROM LS_DATAPAK.
ENDIF.
ENDLOOP.
Please advise,
ThanksHi,
data packets data moved to internal table and delete the the data which was rocancel<> R.
<> = not eaqual to.
So now your internal table have the data which rocancel = R only.
So now again changing internal table data as below.
IF LS_DATAPAK-ROCANCEL = 'R'. then change the loekz and rocancel values as below.
LS_DATAPAK-LOEKZ = 'L'.
LS_DATAPAK-ROCANCEL = SPACE.
All changes are modified and moved to target structure
MODIFY I_DATAPAK FROM LS_DATAPAK.
To understand more, take your abaper help and understand the coding part.
Thanks. -
Issues with deleted POs in 2LIS_02_ITM
Hai Gurus,
I am extracting data from R/3 to BW 3.5 for PU area.
While extracting data for 2LIS_02_ITM, for eg. if a PO is created for 3 Items say Item A, Item B, Item C and Item A & Item B are marked as deleted. My problem here is the Item A which is deleted is coming into BW where as Item B is not.
Can anyone tell me how exactly the extractor 2LIS_02_ITM works and why some items are missing?
And also please let me know the right procedure to follow.
Points will be given. Thanks in advance.
Regards,
MahiHi Mahi.
Please check the following link with documentation regarding this extractor.
http://help.sap.com/saphelp_nw70/helpdata/EN/58/f6383fdb800804e10000000a114084/frameset.htm
Please check the ROCANCEL if it is correct in the source system after delete the Item.
ROCANCEL - Cancellation of Data Record
This field can contain the following values:
· u2018blanku2018 u2013 New data record
· u2018Xu2019 u2013 Cancellation of data record
· u2018Ru2019 u2013 Deletion of data record
For more information, see SAP Note 578471: Deleted Items in BW and Statistics
Thanks,
Walter Oliveira. -
Purchasing and AP to get Total Spend in BI 7.0
Hi all,
We have a requirement at my client location were we need to provide BW reports on purchasing documents: PO, GR, and INV (with & without a related PO).
We have used 2LIS_02_HDR, 2LIS_02_ITM, 2LIS_02_SCL
For all Purchasing data (PO's and their GR and IR) we have used 2LIS_02_HDR, 2LIS_02_ITM, & 2LIS_02_SCL and also added a lot of fields from EKKO/EKPO via the standard interface (LBWE)
For non-PO we have used 0FI_AP_4 & we are able to identify the non-PO data by document type.
Now the challenge is how do I combine PO & Non PO in order to report Total Spend by Vendor which contains purchasing documents, PO Value (this is from purchasing data) & Non PO Value (this is from AP). I main challenge over here is LIS structure uses 0VENDOR (LIFNR) & 0INV_PTY (LIFRE) , but the AP uses 0CREDITOR (LIFNR).
I would like to know if anyone has come across similar requirement or if there is any other method to deliver PO, GR & INV values (with and without a related PO)
Thanks for the help in advanceHi Pria,
Inorder to report on PO and non-PO, you need to identify a common key which can be used to link the two areas.
1. Identify a key field by noting all the primary keys of either tables used to populate the two scenarios.
2. Create a Multiprovider on top of the PO Cube and non-PO cube, where you can allocate the Identifications for each field required in your report.
3. you may select the respective info provider in the identification to provide the relevant data, but beware you need to have a common field across two cubes which can be used to pull data from the two cubes. for instance, you may have Material number in common across the two cubes, which can be identified in the multiprovider to pull across both the cubes.
Once this is done, you may build you report based on Vendor and the identified common key field
Let me know, if this helps! -
2LIS_02_SCL: goods receipt and invoice document number
Hi,
the BI Content documentation for the [Purchasing Data (Schedule Line Level) (2LIS_02_SCL)|http://help.sap.com/saphelp_nw04/helpdata/en/8d/bc383fe58d5900e10000000a114084/frameset.htm] DataSource reads:
The DataSource also provides information about the documents that are posted with regard to the purchase order, such as goods receipts and invoices.
The point is: where are the documents' numbers ?
When I test the extraction, I get the expected number of records, provided that those records with ROCANCEL=X (cancellation of Data Record) are taken into account.
For example, for a Purchase Order (PO) Schedule Line that has 3 Goods Receipts (GR) and 1 Invoce (IR), I get:
- 1 record with BWVORG=1 (SAP BW - Transaction Key) and ROCANCEL blank, for the PO document;
- 6 records for the 3 GR documents (BWVORG=2);
- 2 records for the 2 IR documents (BWVORG=3).
Therefore the DataSource provides the needed level of granularity. Just the field I need is missing, i.e. BELNR! Is there any trick to get it or the only way out is enhancing the DataSource?
Thanks, [Davide|https://wiki.sdn.sap.com/wiki/display/profile/Davide+Cavallari]
Edited by: Davide Cavallari on Jan 18, 2008 5:38 PMI think I would choose the option that takes advantage of 3 DataSources:
- 2LIS_02_SGR, for GR number;
- 2LIS_06_INV, for IV number;
- 0FI_GL_4, for document amount, as well as some other informative characteristics, such as document type (useful when the document is an invoice), referred document (the field that contains the supplier's document number), document date, posting date
The Logistic DataSources would basically provide the link between GR and IV, while the General Ledger DataSource would provide the financial information.
In fact an analysis for controlling purchase expenditures at a detailed level is required. Not just a simple analysis of expenses for vendor, or even purchase document, but for any financial document posted to the General Ledger. This analysis has sort of a financial perspective. Probably it's not the kind of strategic analysis best suited to BI. It has a more tactical, operational nature. And maybe BI is not the best platform for developing this kind of application.
Anyway, if you have better ideas or any suggestion on this topic, please feel free to comment!
Cheers, [Davide|https://wiki.sdn.sap.com/wiki/display/profile/Davide+Cavallari|My wiki profile]
Edited by: Davide Cavallari on Jan 19, 2008 8:16 PM -
2LIS_02_ITM Delta for Cost Center Does Not Work
Experts,
I have activated 2LIS_02_ITM extractor and it extracts delta for PO Header and Item changes. However, when I change the 'Cost Center' or 'GL Account' assignments for a PO Item, system does not generate a delta. I have to make another change, e.g. text or something to bring the related change into BW.
Can someone please advise.
thanks,
Kartik.Hi Kartik,
Just ensure you run a job control first on that extractor.A job control would push data from R/3 queue to BW delta queue.Then check the BW Delta queue(RSA7).Then run the extract checker in Delta mode and check for the delta records. If everything goes fine you should find your delta records here.
Regards,
Harold. -
Negative price values in DSOs...Orecordmode, ROCANCEL related
Hi,
I am seeing a lot of negative values for pricing in the DSO. This has something to do with 0RECORDMODE and ROCANCEL. I am not able to troubleshoot this one. Please suggest on what the approach should be to resolve this issue.The data in ODS shows negative key figures. The infosource is 2lis_11_vaitm. The update rules and transformations for the 0RECORDMODE and 0STORNO seem ok.
-
POS DM: missing customizing for Extracting Purchase Conditions
Hi there,
I am looking for an hint from a retail especialy POS DM specialist.
What I am doing is...
1. I am trying to supply DSO Objects...
0RT_DS07 - Purchase Conditions at Purchasing Organization Level
0RT_DS06 - Purchase Conditions at Site Level
...with purchasing conditions, via standard extractor programms...
0RT_PURCHPRICE_PUORG_ATTR
0RT_PURCHPRICE_PLANT_ATTR
2. I open the InfoPackage (e.g. INIT_0RT_PURCHPRICE_PLANT_ATTR_Purchase Prices at Store Leve) and enter selection criteria condition type = PB00, and start the data extraktion
3. the following error message will be raised, saying:
Diagnosis
Condition type PB00 is not maintained in DM Customizing.
System Response
If you wish to use this condition type in purchase price analysis, you
must process the DM Customizing.
Procedure
Use an allowed condition type or process this condition type in DM
Customizing. To do this, you process view V_RDMT_P_COND_TY in
transaction SM30 .
Procedure for System Administration
My Problem now is, that View mentioned to maintain condition type in DM Customizing V_RDMT_P_COND_TY does not exist. Neither can I find any similar sounding table or option SPRO to maintain the condition type.
Does anybody hase an idea how I can extrakt condition type PB00 for POS Data Management?
Thx a lot for your help
MichaelLook in LBWE under the "Purchasing" node. Then expand the 2LIS_02_ITM extractor until you get to the "events" node. Under that node you will see which events will trigger a record(s) sent to BI. To further your understanding look into 0STORNO and ROCANCEL data elements as well as 0RECORDMODE. Those InfoObjects and data elements will provide control flags for your updates as records come into BI from PUR. Within the help files for MM-PUR you will find a document explaining the usage of 0RECORDMODE and 0STORNO for record management.
Hopefully that will get you started -
Hi SDN
i have a small problem where iam unable to add fields in the final internal table
i have to add two fields i.e., COMMITMENT AND ACTVALUE from ESUH TABLE
AND the final internal table is l_i_ekpo.
we have to add only two fields COMMITMENT and a ....variable = COMMITMENT - ACTVALUE. which is already done in the program.
here iam attaching a program.
TABLES: ekpo.
DATA: i_directory_list LIKE rlgrap-filename OCCURS 0 WITH HEADER LINE.
DATA: i_directory_sel LIKE popuptext OCCURS 0 WITH HEADER LINE.
*{ INSERT PS010306UPGR
CLASS cl_abap_char_utilities DEFINITION LOAD.
*} INSERT
DATA: BEGIN OF tab,
*{ REPLACE PS010306UPGR
T(1) TYPE X VALUE '09', "HEX!
t(1) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab, "Unicode
*} REPLACE
END OF tab.
DATA: ekpo_konnr LIKE ekpo-konnr.
DATA: ekpo_ktpnr LIKE ekpo-ktpnr.
DATA: BEGIN OF t_bapiessrc OCCURS 0.
INCLUDE STRUCTURE zbapiessrc_chars.
DATA: END OF t_bapiessrc.
DATA: t_bapiessrc_tab(301) OCCURS 0." with header line.
DATA: wa_bapiessrc_tab(301).
DATA: BEGIN OF t_headertext OCCURS 0,
ext_number LIKE zbapiessrc_chars-ext_number,
linno(4) TYPE n,
tcode(20),
recordname(30),
txpargraph(2),
txline(72),
text_mark,
END OF t_headertext.
DATA: BEGIN OF t_itemtext OCCURS 0,
ext_number LIKE zbapiessrc_chars-ext_number,
ext_line(18),
linno(4) TYPE n,
tcode(20),
recordname(30),
txpargraph(2),
txline(72),
text_mark,
ext_linno(6),
END OF t_itemtext.
DATA: t_headertext_tab(180) OCCURS 0.
DATA: wa_headertext_tab(180).
DATA: t_itemtext_tab(190) OCCURS 0.
DATA: wa_itemtext_tab(190).
DATA: BEGIN OF t_bapiesllc OCCURS 0.
ext_number like bapiessrc-ext_number.
INCLUDE STRUCTURE zbapiesllc_chars.
DATA: END OF t_bapiesllc.
DATA: t_bapiesllc_tab(650) OCCURS 0." with header line.
DATA: wa_bapiesllc_tab(650).
DATA: no_of_files LIKE sy-index.
DATA: perc_uploaded TYPE i.
DATA: text_uploaded(50).
DATA: text_fi_not_upl1(30), text_fi_not_upl2(30).
DATA: continue_yn.
DATA: file TYPE localfile.
FIELD-SYMBOLS .
DATA: BEGIN OF clbp_content OCCURS 0.
INCLUDE STRUCTURE solisti1.
DATA: END OF clbp_content.
DATA w_mode VALUE 'A'.
CONSTANTS: c_update VALUE 'S'.
DATA: BEGIN OF bdcdata OCCURS 0. " BDC Table
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
DATA: BEGIN OF bdcmsgcoll OCCURS 0. " BDC Messages
INCLUDE STRUCTURE bdcmsgcoll.
DATA: END OF bdcmsgcoll.
DATA params LIKE pri_params.
DATA list_text LIKE pri_params-prtxt.
DATA: days(1) TYPE n VALUE 2,
count(3) TYPE n VALUE 1,
valid TYPE c.
DATA t_bapi_essr LIKE bapiessrc OCCURS 0.
DATA t_bapi_essr_log LIKE bapiessrc OCCURS 0 WITH HEADER LINE.
DATA t_bapi_esll LIKE bapiesllc OCCURS 0.
DATA t_bapi_esll_log LIKE bapiesllc OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF output_prot OCCURS 0.
INCLUDE STRUCTURE essr.
INCLUDE STRUCTURE bdcmsgcoll.
DATA: END OF output_prot.
DATA: BEGIN OF i_sgcses_struc OCCURS 0,
po_number LIKE zbapiessrc_chars-po_number,
po_item LIKE zbapiessrc_chars-po_item,
short_text LIKE zbapiessrc_chars-short_text,
xblnr LIKE essr-xblnr,
ref_date LIKE zbapiessrc_chars-ref_date,
service LIKE zbapiesllc_chars-service,
flag,
quantity LIKE zbapiesllc_chars-quantity,
final,
END OF i_sgcses_struc.
start of insert >>>
DATA: l_ses_no LIKE essr-lblni.
TYPES: BEGIN OF t_ekpo,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
werks LIKE ekpo-werks,
packno LIKE ekpo-packno,
END OF t_ekpo.
DATA: i_ekpo TYPE STANDARD TABLE OF t_ekpo.
end of insert <<<
$$----
S E L E C T I O N S C R E E N -
PARAMETERS: p_path TYPE localfile DEFAULT
'C: empBasellInterfacesSesSES-Daten'.
***parameters: p_dismod type ctu_mode default 'A'.
PARAMETERS: p_dismod TYPE ctu_mode DEFAULT 'E'.
PARAMETERS: p_spnam TYPE tsp01-rq2name DEFAULT 'SES_UPL.....'
OBLIGATORY.
PARAMETERS: cb_serv AS CHECKBOX DEFAULT 'X'.
PARAMETERS: cb_text AS CHECKBOX DEFAULT 'X'.
PARAMETERS: cb_chck AS CHECKBOX DEFAULT 'X'.
$$----
A T S E L E C T I O N S C R E E N -
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
DATA: len TYPE i,
testchar(1).
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = 'C:*.txt'
static = 'X'
CHANGING
file_name = p_path.
DESCRIBE FIELD p_path LENGTH len IN CHARACTER MODE.
DO len TIMES.
len = len - 1.
testchar = p_path+len(1).
IF testchar = ''.
len = len + 1.
p_path = p_path(len).
EXIT.
ENDIF.
ENDDO.
$$----
S T A R T O F S E L E C T I O N -
START-OF-SELECTION.
PERFORM select_files.
PERFORM spool_settings.
PERFORM upload_files.
PERFORM select_additional_data.
$$----
E N D O F S E L E C T I O N -
END-OF-SELECTION.
PERFORM spool_settings.
CLEAR: perc_uploaded, no_of_files, text_uploaded.
DESCRIBE TABLE t_bapiessrc LINES no_of_files.
Loop over header-records: for each header-record one call transaction:
LOOP AT t_bapiessrc.
perc_uploaded = ( 100 * sy-tabix ) / no_of_files.
IF cb_serv = 'X'.
PERFORM prepare_clipboard.
Upload Service Entry Sheets:
PERFORM call_transaction_upload.
Italian Version begin
IMPORT output_prot FROM MEMORY ID 'OUT_PROT'.
PERFORM write_prot_to_spool.
FREE MEMORY ID 'OUT_PROT'.
REFRESH: output_prot.
Italian Version end
PERFORM find_ses_number.
PERFORM check_estimated_value.
ENDIF.
IF cb_text = 'X'.
Upload SES Texts:
PERFORM upload_texts.
ENDIF.
start of insert >>>
PERFORM change_account.
IF cb_serv = 'X'.
PERFORM release_ses.
ENDIF.
end of insert <<<
ENDLOOP.
In case only text and no services shall be uploaded:
IF NOT cb_text IS INITIAL.
In case also services are uploaded this loop won't apply cause
t_headertext-entries are deleted after they were processed in the
loop above!
LOOP AT t_headertext.
MOVE t_headertext-ext_number TO t_bapiessrc-ext_number.
*only for test cases since data file is not correct:
move t_headertext-ext_number to t_bapiessrc-ref_doc_no.
*only for test cases since data file is not correct:END
PERFORM upload_texts.
ENDLOOP.
ENDIF.
PERFORM log_upload_success.
NEW-PAGE PRINT OFF.
PERFORM delete_files.
WRITE: / text-001.
write: / 'Check spools for correct processing (Transaction SP01)!'.
$$----
T O P O F P A G E -
TOP-OF-PAGE.
*--at user-command--
AT USER-COMMAND.
*--top of page-during line selection--
TOP-OF-PAGE DURING LINE-SELECTION.
$$----
F O R M - R O U T I N E S -
*& Form SPLIT_BAPIESSRC
FORM split_bapiessrc.
DATA: l_score_time(3),
l_score_qual(3),
l_essr_lblni LIKE essr-lblni.
start of insert >>>
TABLES: esuc.
DATA: l_packno LIKE ekpo-packno.
end of insert <<<
CLEAR: t_bapiessrc, ekpo_konnr, ekpo_ktpnr, ekpo.
TRANSLATE doc_content-line USING '#;'. ZBAPIESSRC_CHARS
SPLIT AT '§' INTO
t_bapiessrc-sheet_no t_bapiessrc-ext_number
t_bapiessrc-person_int t_bapiessrc-person_ext
t_bapiessrc-location t_bapiessrc-ref_date
t_bapiessrc-begdate t_bapiessrc-enddate
t_bapiessrc-pckg_no t_bapiessrc-short_text
Only for testing due to wrong data
t_bapiessrc-po_number t_bapiessrc-po_item
ekpo_konnr ekpo_ktpnr
Only for testing due to wrong data END
t_bapiessrc-block_ind t_bapiessrc-score_time
t_bapiessrc-score_qual t_bapiessrc-doc_date
t_bapiessrc-post_date t_bapiessrc-ref_doc_no
Only for testing due to wrong data
t_bapiessrc-po_number t_bapiessrc-po_item
Only for testing due to wrong data END
t_bapiessrc-accasscat t_bapiessrc-comm_no
t_bapiessrc-user_field t_bapiessrc-acceptance
Only for testing due to wrong data
ekpo_konnr ekpo_ktpnr t_bapiessrc-final.
Only for testing due to wrong data END
MOVE '0000000001' TO t_bapiessrc-pckg_no.
SHIFT t_bapiessrc-po_item RIGHT DELETING TRAILING space.
TRANSLATE t_bapiessrc-po_item USING ' 0'.
start of delete >>>
IF NOT ekpo_konnr IS INITIAL AND NOT ekpo_ktpnr IS INITIAL.
SELECT SINGLE konnr ktpnr FROM ekpo
INTO (ekpo-konnr, ekpo-ktpnr)
WHERE ebeln = t_bapiessrc-po_number
AND ebelp = t_bapiessrc-po_item.
IF NOT sy-subrc IS INITIAL.
WRITE:/ text-101, t_bapiessrc-ext_number,
text-102,
t_bapiessrc-po_number,
text-103,
t_bapiessrc-po_item,
text-104.
WRITE: / text-105.
EXIT.
ELSE.
IF ekpo_konnr NE ekpo-konnr OR ekpo_ktpnr NE ekpo-ktpnr.
WRITE:/ text-101, t_bapiessrc-ext_number,
text-106,
ekpo_konnr, '/',
ekpo_ktpnr,
text-107,
t_bapiessrc-po_number,
text-103, t_bapiessrc-po_item, ')'.
WRITE: / text-105.
EXIT.
ENDIF.
ENDIF.
ENDIF.
end of delete <<<
start of insert >>>
" check contract number
IF NOT ekpo_konnr IS INITIAL AND NOT ekpo_ktpnr IS INITIAL.
SELECT SINGLE konnr ktpnr packno
FROM ekpo
INTO (ekpo-konnr, ekpo-ktpnr, l_packno)
WHERE ebeln = t_bapiessrc-po_number
AND ebelp = t_bapiessrc-po_item.
IF sy-subrc NE 0.
" no corresponding PO, no update will be performed
WRITE:/ text-101, t_bapiessrc-ext_number,
text-102,
t_bapiessrc-po_number,
text-103,
t_bapiessrc-po_item,
text-104.
WRITE: / text-105.
EXIT.
ELSE.
" check contract number against table ESUC first.
SELECT SINGLE *
FROM esuc
WHERE packno EQ l_packno
AND ebeln EQ ekpo_konnr
AND ebelp EQ ekpo_ktpnr.
IF sy-subrc NE 0.
" check against PO line
IF ekpo_konnr NE ekpo-konnr OR ekpo_ktpnr NE ekpo-ktpnr.
WRITE:/ text-101, t_bapiessrc-ext_number,
text-106,
ekpo_konnr, '/',
ekpo_ktpnr,
text-107,
t_bapiessrc-po_number,
text-103, t_bapiessrc-po_item, ')'.
WRITE: / text-105.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
end of insert <<<
IF cb_chck = 'X'.
SELECT SINGLE lblni FROM essr INTO l_essr_lblni
WHERE loekz = ' '
AND user1 = t_bapiessrc-ext_number.
IF sy-subrc IS INITIAL.
WRITE:/ 'External SES', t_bapiessrc-ext_number,
'is already uploaded. SES-Number: ', l_essr_lblni.
WRITE: / 'No update of this sheet was accomplished!'.
EXIT.
ENDIF.
ENDIF.
APPEND t_bapiessrc.
ENDFORM. " SPLIT_BAPIESSRC
*& Form SPLIT_BAPIESLLC
FORM split_bapiesllc.
DATA: l_outl_level(3), l_ovf_tol(3), l_price_unit(5), l_gr_price(23),
l_target_val(23), l_userf2_num(13), l_quantity(13),
l_form_val1(13), l_form_val2(13), l_form_val3(13),
l_form_val4(13), l_form_val5(13), l_ext_number(16).
CLEAR: t_bapiesllc.
TRANSLATE doc_content-line USING '#;'.
SPLIT AT '§' INTO
t_bapiesllc-ext_number
t_bapiesllc-pckg_no t_bapiesllc-line_no
t_bapiesllc-ext_line t_bapiesllc-outl_level
t_bapiesllc-outl_no t_bapiesllc-outl_ind
t_bapiesllc-subpckg_no t_bapiesllc-service
t_bapiesllc-serv_type t_bapiesllc-edition
t_bapiesllc-ssc_item t_bapiesllc-ext_serv
t_bapiesllc-quantity t_bapiesllc-base_uom
t_bapiesllc-uom_iso t_bapiesllc-ovf_tol
t_bapiesllc-ovf_unlim t_bapiesllc-price_unit
t_bapiesllc-gr_price t_bapiesllc-from_line
t_bapiesllc-to_line t_bapiesllc-short_text
t_bapiesllc-distrib t_bapiesllc-pers_no
t_bapiesllc-wagetype t_bapiesllc-pln_pckg
t_bapiesllc-pln_line t_bapiesllc-con_pckg
t_bapiesllc-con_line t_bapiesllc-tmp_pckg
t_bapiesllc-tmp_line t_bapiesllc-ssc_lim
t_bapiesllc-limit_line t_bapiesllc-target_val
t_bapiesllc-basline_no t_bapiesllc-basic_line
t_bapiesllc-alternat t_bapiesllc-bidder
t_bapiesllc-supp_line t_bapiesllc-open_qty
t_bapiesllc-inform t_bapiesllc-blanket
t_bapiesllc-eventual t_bapiesllc-tax_code
t_bapiesllc-taxjurcode t_bapiesllc-price_chg
t_bapiesllc-matl_group t_bapiesllc-date
t_bapiesllc-begintime t_bapiesllc-endtime
t_bapiesllc-extpers_no t_bapiesllc-formula
t_bapiesllc-form_val1 t_bapiesllc-form_val2
t_bapiesllc-form_val3 t_bapiesllc-form_val4
t_bapiesllc-form_val5 t_bapiesllc-userf1_num
t_bapiesllc-userf2_num t_bapiesllc-userf1_txt
t_bapiesllc-userf2_txt t_bapiesllc-hi_line_no.
start of insert >>> "AP13022007i
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = t_bapiesllc-line_no
IMPORTING
output = t_bapiesllc-line_no.
end of insert <<< "AP13022007i
TRANSLATE t_bapiesllc-quantity USING ',.'.
MOVE '0000000002' TO t_bapiesllc-pckg_no. "TS20082002
APPEND t_bapiesllc.
ENDFORM. " SPLIT_BAPIESLLC
*& Form SELECT_FILES
FORM select_files.
CALL FUNCTION 'KCD_FRONT_END_DIRECTORY_READ'
EXPORTING
i_path = p_path
IMPORTING
E_PURE_PATH =
TABLES
e_directory = i_directory_list
EXCEPTIONS
download = 1
upload = 2
execute = 3
directory_not_exist = 4
directory = 5
OTHERS = 6
IF sy-subrc <> 0.
*{ REPLACE PS010306UPGR
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE w208(00) WITH 'Enter existing directory'(003).
*} REPLACE
EXIT.
ENDIF.
LOOP AT i_directory_list.
CHECK i_directory_list(1) CA 'KPLT'.
check i_directory_list cs '.XLS' or i_directory_list cs '.TXT'.
CHECK i_directory_list CS '.TXT'.
CLEAR i_directory_sel.
MOVE 'X' TO i_directory_sel-text(1).
MOVE i_directory_list(79) TO i_directory_sel-text+1(79).
APPEND i_directory_sel.
ENDLOOP.
CALL FUNCTION 'Z_SL018_POPUP_WITH_TEXT_TO_SEL'
EXPORTING
popup_title = 'Select Files for SES-Upload'
start_column = 10
start_row = 1
end_column = 50
end_row = 16
IMPORTING
sy_ucomm = sy-ucomm
TABLES
x_popuptext = i_directory_sel.
*Check which Files shall be uploaded:
LOOP AT i_directory_sel.
CHECK i_directory_sel-text(1) NE 'Y'.
DELETE i_directory_sel.
ENDLOOP.
SORT i_directory_sel.
DESCRIBE TABLE i_directory_sel LINES no_of_files.
ENDFORM. " SELECT_FILES
*& Form UPLOAD_FILES
FORM upload_files.
*{ INSERT PS010306UPGR
DATA: fname TYPE string.
*} INSERT
LOOP AT i_directory_sel.
CLEAR: file.
UNASSIGN: .
perc_uploaded = ( 100 * sy-tabix ) / no_of_files.
CONCATENATE i_directory_sel-text+1(31) 'uploaded from disk'
INTO text_uploaded
SEPARATED BY space.
CONCATENATE p_path i_directory_sel-text+1(31) INTO file.
Choose the right structure for <doc_content> and <wa_doc_content>
depending on file type K, P, T or L via assignment of field symbols:
CASE i_directory_sel-text+1(1).
WHEN 'K'. "Kopfdaten
ASSIGN t_bapiessrc_tab TO .
ENDCASE.
*{ REPLACE PS010306UPGR
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FILE
TABLES
DATA_TAB = <DOC_CONTENT>
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
fname = file.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = fname
CHANGING
data_tab = 0.
CLEAR: text_fi_not_upl1, text_fi_not_upl2, continue_yn.
CONCATENATE 'File' i_directory_sel-text+1(21) ': upload failed!'
INTO text_fi_not_upl1 SEPARATED BY space.
MOVE 'Continue Program?' TO text_fi_not_upl2.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
defaultoption = 'N'
textline1 = text_fi_not_upl1
textline2 = text_fi_not_upl2
titel = 'Upload Failed'
start_column = 25
start_row = 6
cancel_display = ' '
IMPORTING
answer = continue_yn.
IF continue_yn = 'N'.
EXIT.
ENDIF.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
Move uploaded File records line by line into correct internal table:
t_bapiessrc for K__.txt
t_bapiesllc for P__.txt
t_headertext for T__.txt
t_itemtext for L__.txt
LOOP AT .
IF NOT sy-subrc IS INITIAL. EXIT. ENDIF.
ENDDO.
CASE i_directory_sel-text+1(1).
WHEN 'K'. "Kopfdaten
PERFORM split_bapiessrc.
WHEN 'T'.
PERFORM split_headertext.
WHEN 'P'.
PERFORM split_bapiesllc.
WHEN 'L'.
PERFORM split_itemtext.
ENDCASE.
ENDLOOP.
ENDIF.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = perc_uploaded
text = text_uploaded.
ENDLOOP.
SORT t_bapiessrc BY ext_number.
SORT t_headertext BY ext_number linno.
SORT t_bapiesllc BY ext_number. "
SORT t_bapiesllc BY ext_number pckg_no line_no.
sort t_bapiesllc by ext_number line_no.
SORT t_itemtext BY ext_number ext_linno ext_line linno.
ENDFORM. " UPLOAD_FILES
*& Form PREPARE_CLIPBOARD
FORM prepare_clipboard.
CLEAR: clbp_content.
REFRESH: clbp_content.
DATA: l_line TYPE n.
DATA: l_tabix LIKE sy-tabix.
CLEAR l_tabix.
*Assemble the File-Structure out of the internal tables t_bapiessrc
and t_bapiesllc which is expected by the user exit
exit_saplmlsx_002 and move it to the clipboard:
MOVE 'K' TO clbp_content(1). "Flag for header record
MOVE t_bapiessrc TO clbp_content+1(246).
APPEND clbp_content.
READ TABLE t_bapiesllc WITH KEY ext_number = t_bapiessrc-comm_no
BINARY SEARCH.
CHECK sy-subrc IS INITIAL.
MOVE sy-tabix TO l_tabix.
insert dummy row for connection between pach_no and sub_packno:
CLEAR l_line.
CLEAR: clbp_content, t_bapiesllc.
ADD 1 TO l_line.
MOVE 'P' TO clbp_content(1). "Flag for service-record
MOVE l_line TO clbp_content+1(1).
MOVE '0000000001' TO t_bapiesllc-pckg_no.
MOVE '0000000002' TO t_bapiesllc-subpckg_no.
WRITE t_bapiesllc16(245) TO clbp_content3(245).
APPEND clbp_content.
CLEAR clbp_content.
ADD 1 TO l_line.
MOVE 'P' TO clbp_content(1).
MOVE l_line TO clbp_content+1(1).
WRITE t_bapiesllc261(245) TO clbp_content3(245).
APPEND clbp_content.
APPEND clbp_content.
CLEAR clbp_content.
ADD 1 TO l_line.
MOVE 'P' TO clbp_content(1).
MOVE l_line TO clbp_content+1(1).
MOVE 'E' TO clbp_content+2(1).
WRITE t_bapiesllc506(27) TO clbp_content3(245).
APPEND clbp_content.
CLEAR clbp_content.
end insert
LOOP AT t_bapiesllc FROM l_tabix.
CLEAR l_line.
CLEAR clbp_content.
IF t_bapiesllc-ext_number NE t_bapiessrc-ext_number.
EXIT.
ENDIF.
ADD 1 TO l_line.
MOVE 'P' TO clbp_content(1). "Flag for service-record
'P'-service records are split into three clipbord-lines since
structure t_bapiesllc is too long for one line
MOVE l_line TO clbp_content+1(1).
WRITE t_bapiesllc16(245) TO clbp_content3(245).
APPEND clbp_content.
CLEAR clbp_content.
ADD 1 TO l_line.
MOVE 'P' TO clbp_content(1).
MOVE l_line TO clbp_content+1(1).
WRITE t_bapiesllc261(245) TO clbp_content3(245).
APPEND clbp_content.
CLEAR clbp_content.
ADD 1 TO l_line.
MOVE 'P' TO clbp_content(1).
MOVE l_line TO clbp_content+1(1).
MOVE 'E' TO clbp_content+2(1).
WRITE t_bapiesllc506(27) TO clbp_content3(245).
APPEND clbp_content.
CLEAR clbp_content.
ENDLOOP.
******Italy version of upload
PERFORM include_italy.
export t_bapiessrc to memory id 'GER_ESSRC'.
export t_bapiesllc to memory id 'GER_ESLLC'.
EXPORT t_bapi_essr TO MEMORY ID 'GER_ESSRC'.
EXPORT t_bapi_esll TO MEMORY ID 'GER_ESLLC'.
CHECK 1 = 2.
******Italy version of upload END
CALL FUNCTION 'CLPB_EXPORT'
TABLES
data_tab = clbp_content
EXCEPTIONS
clpb_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " PREPARE_CLIPBOARD
*& Form CALL_TRANSACTION_UPLOAD
FORM call_transaction_upload.
REFRESH bdcdata.
PERFORM bdc_dynpro USING: 'RM11RL00' '1000'.
PERFORM bdc_field USING: 'BDC_OKCODE' '=UPL'.
PERFORM bdc_field USING: 'S_LBLNI-LOW' ' '.
PERFORM bdc_field USING: 'S_LBLNI-HIGH' ' '.
PERFORM bdc_field USING: 'P_BSTNR' ' '.
PERFORM bdc_field USING: 'S_BSTPO-LOW' ' '.
PERFORM bdc_field USING: 'S_BSTPO-HIGH' ' '.
*Italian upload version -> comments set|remove comments for Germ.Version
perform bdc_dynpro using: 'SAPLMLSX' '0480'.
perform bdc_field using: 'BDC_OKCODE' '=EXEC'.
perform bdc_dynpro using: 'SAPLGRAP' '0210'.
perform bdc_field using: 'BDC_OKCODE' '=UPL_FR_CLP'.
PERFORM bdc_dynpro USING: 'SAPMSSY0' '0120'.
perform bdc_field using: 'MARKIERT' 'X'.
*Italian upload version -> comments set; END
CASE p_dismod.
WHEN 'A'.
PERFORM bdc_field USING: 'BDC_OKCODE' '=LITE'.
WHEN 'N'.
PERFORM bdc_field USING: 'BDC_OKCODE' '=HIND'.
WHEN 'E'.
PERFORM bdc_field USING: 'BDC_OKCODE' '=DARK'.
ENDCASE.
Here the call transcation of SAP-standard takes place for creating the
service entry sheet
After SAP-standard call transaction: analyze the popup with the
*Italian upload version -> comments set|remove comments for Germ.Version
PERFORM bdc_dynpro USING: 'SAPMSSY0' '0120'.
perform bdc_field using: 'BDC_OKCODE' '=PRI'.
perform bdc_dynpro using: 'SAPLSPRI' '0100'.
perform bdc_field using: 'BDC_OKCODE' '=PRIN'.
perform bdc_field using: 'PRI_PARAMS-PLIST' p_spnam.
perform bdc_field using: 'PRI_PARAMS-PRIMM' ' '.
perform bdc_field using: 'PRI_PARAMS-PRREL' ' '.
perform bdc_field using: 'PRI_PARAMS-PRNEW' ' '.
perform bdc_dynpro using: 'SAPMSSY0' '0120'.
perform bdc_field using: 'BDC_OKCODE' '=EXEC'.
*Italian upload version -> remove the following line for Germ. version:
PERFORM bdc_field USING: 'BDC_OKCODE' '/00'.
w_mode = p_dismod.
currently w_mode and p_dismod are set to the same value:
foregroud, background or error. But it could also be set to differnt
values: Foreground for upload clipboard,
CALL TRANSACTION 'ML81' USING bdcdata MODE w_mode UPDATE c_update
MESSAGES INTO bdcmsgcoll.
ENDFORM. " CALL_TRANSACTION_UPLOAD
*& Form BDC_DYNPRO
FORM bdc_dynpro
USING program TYPE c
dynpro TYPE c.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
FORM bdc_field
USING fnam TYPE c
fval TYPE c.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. " BDC_FIELD
*& Form UPLOAD_TEXTS
FORM upload_texts.
DATA l_lblni LIKE essr-lblni.
DATA l_tabix_header_start LIKE sy-tabix.
DATA l_tabix_item_start LIKE sy-tabix.
DATA: p(2) TYPE c.
DATA: w LIKE sy-index.
DATA: w_field(20) TYPE c.
DATA: l_ext_line_save LIKE t_itemtext-ext_line.
DATA: l_ext_linno_save LIKE t_itemtext-ext_linno.
DATA: l_extrow(10)." like ml_esll-extrow.
DATA: l_messg LIKE message.
DATA: l_msgno LIKE sy-msgno.
*only for test cases since data file is not correct:
read table t_headertext with key ext_number = t_bapiessrc-ref_doc_no.
READ TABLE t_headertext WITH KEY ext_number = t_bapiessrc-ext_number
BINARY SEARCH.
*only for test cases since data file is not correct:END
IF NOT sy-subrc IS INITIAL.
MESSAGE ID 'ZV' TYPE 'I' NUMBER '011'
WITH text-202.
WRITE: / text-202.
EXIT.
ENDIF.
l_tabix_header_start = sy-tabix.
SELECT SINGLE MAX( lblni ) FROM essr INTO l_lblni
where xblnr = t_headertext-ext_number.
WHERE user1 = t_headertext-ext_number
AND loekz = ' '.
IF NOT sy-subrc IS INITIAL.
MESSAGE ID 'ZV' TYPE 'I' NUMBER '011'
WITH text-203.
WRITE: / text-203.
EXIT.
ENDIF.
CLEAR: bdcdata, bdcmsgcoll.
REFRESH: bdcdata, bdcmsgcoll.
PERFORM bdc_dynpro USING 'RM11RL00' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ONLI'.
PERFORM bdc_field USING 'S_LBLNI-LOW' l_lblni. " '1000001748'.
PERFORM bdc_field USING 'BDC_CURSOR' 'P_LIST'.
PERFORM bdc_field USING 'P_LIST' ' '.
PERFORM bdc_field USING 'P_DIRECT' 'X'.
PERFORM bdc_field USING 'P_LISTU' ' '.
PERFORM bdc_dynpro USING 'SAPLMLSR' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=TXT'.
perform bdc_field using 'ESSR-TXZ01' t_headertext-txline(40).
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=TXBA'.
CLEAR w.
ADD 1 TO w.
LOOP AT t_headertext FROM l_tabix_header_start.
Is t_bapiessrc-ext_number really filled?
IF t_headertext-ext_number NE t_bapiessrc-ext_number.
EXIT.
ENDIF.
ADD 1 TO w.
UNPACK w TO p.
CLEAR w_field.
w_field+00(17) = 'RSTXT-TXPARGRAPH('.
w_field+17(02) = p.
w_field+19(01) = ')'.
PERFORM bdc_field USING w_field t_headertext-txpargraph.
CLEAR w_field.
w_field+00(13) = 'RSTXT-TXLINE('.
w_field+13(02) = p.
w_field+15(01) = ')'.
PERFORM bdc_field USING w_field t_headertext-txline .
delete line from internal table so that Upload Texts is not
processed twice when perform_upload_texts is called without up-
loading services:
DELETE t_headertext.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPLMLSR' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=SERV'.
PERFORM bdc_dynpro USING 'SAPLMLSP' '0210'.
PERFORM bdc_field USING 'BDC_OKCODE' 'ENTER'.
READ TABLE t_itemtext WITH KEY
ext_number = t_bapiessrc-ext_number.
l_tabix_item_start = sy-tabix.
CLEAR l_ext_line_save.
LOOP AT t_itemtext FROM l_tabix_item_start.
IF t_itemtext-ext_number NE t_bapiessrc-ext_number.
EXIT.
ENDIF.
SHIFT t_itemtext-ext_line RIGHT DELETING TRAILING space.
TRANSLATE t_itemtext-ext_line USING ' 0'.
IF ( t_itemtext-ext_line NE l_ext_line_save )
OR ( t_itemtext-ext_linno NE l_ext_linno_save ).
***find line number:
break michalska.
SELECT SINGLE extrow FROM ml_esll INTO l_extrow
WHERE extrow = t_itemtext-ext_linno
AND srvpos = t_itemtext-ext_line
AND ebeln = l_lblni.
IF NOT sy-subrc IS INITIAL.
CONTINUE.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLMLSP' '0210'.
PERFORM bdc_field USING 'BDC_OKCODE' 'ENTER'.
PERFORM bdc_field USING 'RM11P-NEW_ROW' l_extrow.
PERFORM bdc_dynpro USING 'SAPLMLSP' '0210'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ZLT'.
PERFORM bdc_field USING 'BDC_CURSOR' 'ESLL-EXTROW(01)'.
PERFORM bdc_field USING 'RM11P-SELKZ(01)' 'X'.
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=TXBA'.
CLEAR w.
ADD 1 TO w.
ENDIF.
ADD 1 TO w.
UNPACK w TO p.
CLEAR w_field.
w_field+00(17) = 'RSTXT-TXPARGRAPH('.
w_field+17(02) = p.
w_field+19(01) = ')'.
PERFORM bdc_field USING w_field t_itemtext-txpargraph.
CLEAR w_field.
w_field+00(13) = 'RSTXT-TXLINE('.
w_field+13(02) = p.
w_field+15(01) = ')'.
PERFORM bdc_field USING w_field t_itemtext-txline .
l_ext_line_save = t_itemtext-ext_line.
l_ext_linno_save = t_itemtext-ext_linno.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPLMLSP' '0210'.
PERFORM bdc_field USING 'BDC_OKCODE' '=SAV'.
CALL TRANSACTION 'ML81' USING bdcdata MODE p_dismod UPDATE c_update
MESSAGES INTO bdcmsgcoll.
LOOP AT bdcmsgcoll.
IF sy-tabix = 1.
WRITE AT: /1 text-002,
write at: /1 'Log for text uploads of entry sheet ',
37 l_lblni, 48 ':'.
ENDIF.
check bdcmsgcoll-msgtyp = 'E' or bdcmsgcoll-msgtyp = 'A'.
CHECK bdcmsgcoll-msgnr CO ' 0123456789'.
MOVE bdcmsgcoll-msgnr TO l_msgno.
CALL FUNCTION 'WRITE_MESSAGE'
EXPORTING
msgid = bdcmsgcoll-msgid
msgno = l_msgno
msgty = bdcmsgcoll-msgtyp
msgv1 = bdcmsgcoll-msgv1
msgv2 = bdcmsgcoll-msgv2
msgv3 = bdcmsgcoll-msgv3
msgv4 = bdcmsgcoll-msgv4
IMPORTING
messg = l_messg.
WRITE AT: /3 l_messg-msgtx.
ENDLOOP.
ENDFORM. " UPLOAD_TEXTS
*& Form SPLIT_HEADERTEXT
FORM split_headertext.
DATA: l_essr_lblni LIKE essr-lblni.
CLEAR: t_headertext.
TRANSLATE doc_content-line USING '#;'. ZBAPIESSRC_CHARS
SPLIT AT '§' INTO
t_headertext-ext_number
t_headertext-linno
t_headertext-tcode
t_headertext-recordname
t_headertext-txpargraph
t_headertext-txline
t_headertext-text_mark.
start of insert >>>
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = t_headertext-linno
IMPORTING
output = t_headertext-linno.
end of insert <<<
IF cb_chck = 'X'.
SELECT SINGLE lblni FROM essr INTO l_essr_lblni
WHERE loekz = ' '
AND user1 = t_headertext-ext_number.
IF sy-subrc IS INITIAL.
IF t_headertext-linno = 1.
WRITE:/ 'External SES', t_headertext-ext_number,
'is already uploaded. SES-Number: ', l_essr_lblni.
WRITE: / 'No update of this sheet-texts was accomplished!'.
ENDIF.
EXIT.
ENDIF.
ENDIF.
start of insert >>>
IF NOT cb_serv IS INITIAL.
" check
READ TABLE t_bapiessrc WITH KEY ext_number = t_headertext-ext_number
BINARY SEARCH.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ENDIF.
end of insert <<<
APPEND t_headertext.
ENDFORM. " SPLIT_HEADERTEXT
*& Form SPLIT_ITEMTEXT
FORM split_itemtext.
DATA: l_essr_lblni LIKE essr-lblni.
CLEAR: t_itemtext.
TRANSLATE doc_content-line USING '#;'. ZBAPIESSRC_CHARS
SPLIT AT '§' INTO
t_itemtext-ext_number
t_itemtext-ext_line
t_itemtext-linno
t_itemtext-tcode
t_itemtext-recordname
t_itemtext-txpargraph
t_itemtext-txline
t_itemtext-text_mark
t_itemtext-ext_linno.
start of insert >>>
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = t_itemtext-ext_linno
IMPORTING
output = t_itemtext-ext_linno.
end of insert <<<
IF cb_chck = 'X'.
SELECT SINGLE lblni FROM essr INTO l_essr_lblni
WHERE loekz = ' '
AND user1 = t_itemtext-ext_number.
IF sy-subrc IS INITIAL.
write:/ 'External SES', t_itemtext-ext_number,
'is already uploaded. SES-Number: ', l_essr_lblni.
write: / 'No update of this sheet was accomplished!'.
EXIT.
ENDIF.
ENDIF.
APPEND t_itemtext.
ENDFORM. " SPLIT_ITEMTEXT
start of delete >>>
*& Form SPOOL_SETTINGS
*FORM spool_settings.
MOVE p_spnam TO list_text.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING " destination = 'dest'
copies = 1
list_name = p_spnam
list_text = list_text
immediately = ' '
release = ' '
new_list_id = ' '
expiration = 9
line_size = 125
line_count = 23
layout = 'X_65_132'
sap_cover_page = ' '
receiver = 'SAP*'
department = 'System'
no_dialog = 'X'
IMPORTING
out_parameters = params
valid = valid.
IF valid <> space.
NEW-PAGE PRINT ON PARAMETERS params NO DIALOG.
ENDIF.
*ENDFORM. " SPOOL_SETTINGS
end of delete <<<
*& Form DELETE_FILES
text
--> p1 text
<-- p2 text
FORM delete_files.
*{ REPLACE PS010306UPGR
DATA: l_return.
DATA: l_return TYPE i.
DATA: fname TYPE string.
*} REPLACE
LOOP AT i_directory_sel.
move space to i_directory_sel-text(1).
MOVE 'X' TO i_directory_sel-text(1).
MODIFY i_directory_sel.
ENDLOOP.
*{ REPLACE
CLEAR i_directory_sel.
MOVE'Xdir_file.bat' TO i_directory_sel-text.
APPEND i_directory_sel.
CLEAR i_directory_sel.
MOVE'Xdir_file.txt' TO i_directory_sel-text.
APPEND i_directory_sel.
DATA: l_directory_list LIKE rlgrap-filename OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'KCD_FRONT_END_DIRECTORY_READ'
EXPORTING
i_path = p_path
TABLES
e_directory = l_directory_list
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
LOOP AT l_directory_list.
IF l_directory_list CS 'dir_file.bat'.
CLEAR i_directory_sel.
MOVE'Xdir_file.bat' TO i_directory_sel-text.
APPEND i_directory_sel.
ELSEIF l_directory_list CS 'dir_file.txt'.
CLEAR i_directory_sel.
MOVE'Xdir_file.txt' TO i_directory_sel-text.
APPEND i_directory_sel.
ENDIF.
ENDLOOP.
ENDIF.
CALL FUNCTION 'Z_SL018_POPUP_WITH_TEXT_TO_SEL'
EXPORTING
popup_title = 'Select Files for DELETION'
start_column = 10
start_row = 1
end_column = 50
end_row = 16
IMPORTING
sy_ucomm = sy-ucomm
TABLES
x_popuptext = i_directory_sel.
*Check which Files shall be uploaded:
CHECK sy-ucomm = 'OK'.
LOOP AT i_directory_sel.
CHECK i_directory_sel-text(1) = 'Y'.
CLEAR file.
CONCATENATE p_path i_directory_sel-text+1(31) INTO file.
*{ REPLACE PS010306UPGR
CALL FUNCTION 'WS_FILE_DELETE'
EXPORTING
FILE = FILE
IMPORTING
RETURN = L_RETURN.
fname = file.
CALL METHOD cl_gui_frontend_services=>file_delete
EXPORTING
filename = fname
CHANGING
rcHI
add that fileds in the all locations where you need it like
in internal table declaration , write statement , select statement
these are the main areas where you have to add that 2 fileds -
Regarding selection screen fields in Service PO Report
Hello All,
I have developed a Service PO Report with input parameters like Purch. Organisation, Material Group, Purchasing Group, Plant, PO No., Vendor, Activity, Entry Sheet No., GR No. I have used the tables ekko, ekpo, ekbe, essr, ml_esll, mseg and lfa1.
When I input a particular Purch. Organisation, I am able to get the output filtered by that Purch. Organisation. Similarly, when I input other fields individually, I get the filtered output based on the value of the fields that I inputted.
The problem is that when I select only a particular GR No. in the selection screen, I am not able to get the filtered output for that particular GR No. Its showing all the unnecessary data for that particular GR No.
Except this field, the report is running fine. So can anybody guide me in getting the filtered output based on GR No.?
I have linked tables ekko, ekbe and mseg.I have pasted the code below for analysis.
form fetch.
select ek~ebeln
ek~loekz
ek~lifnr
ek~ekorg
ek~ekgrp
ek~bedat
ek~bukrs
ep~ebelp
ep~txz01
ep~werks
ep~matkl
ep~mwskz
ep~menge
ep~meins
ep~netpr
ep~netwr
ep~mwskz
into corresponding fields of table it_ekko
from ekko as ek join ekpo as ep
on ek~ebeln = ep~ebeln
and ek~loekz = ep~loekz
and ek~bukrs = ep~bukrs
where ek~ebeln in s_ebeln
and ek~lifnr in s_lifnr
and ek~ekorg in s_ekorg
and ek~ekgrp in s_ekgrp
and ep~werks in s_werks
and ep~matkl in s_matkl.
if sy-subrc = 0.
select lifnr name1 from lfa1
into corresponding fields of table it_lfa1
for all entries in it_ekko
where lifnr = it_ekko-lifnr.
endif.
if sy-subrc = 0.
select lblni lzvon lwert packno txz01 ebeln loekz budat netwr from essr
into corresponding fields of table it_essr
for all entries in it_ekko
where lzvon in s_lzvon
and lblni in s_lblni
and ebeln = it_ekko-ebeln.
endif.
if sy-subrc = 0.
select mblnr ebeln erfmg lfbnr from mseg
into corresponding fields of table it_mseg
for all entries in it_essr
where mblnr in s_mblnr
and lfbnr = it_essr-lblni
and ebeln = it_essr-ebeln.
endif.
if sy-subrc = 0.
select packno ebeln srvpos ktext1 netwr menge matkl tbtwr meins mwskz from ml_esll
into corresponding fields of table it_ml_esll
for all entries in it_essr
where srvpos in s_srvpos
and ebeln = it_essr-lblni.
endif.
if sy-subrc = 0.
select packno srvpos menge meins netwr ebeln tbtwr from ml_esll
into corresponding fields of table it_ml_esll1
for all entries in it_ekko
where ebeln = it_ekko-ebeln.
endif.
if sy-subrc = 0.
select ebeln vgabe belnr lfbnr mwskz srvpos packno from ekbe
into corresponding fields of table it_ekbe
for all entries in it_ekko
where ebeln = it_ekko-ebeln
and vgabe = 1.
endif.
if sy-subrc = 0.
select ebeln belnr bewtp from ekbe into corresponding fields of table it_ekbe1
for all entries in it_ekko
where ebeln = it_ekko-ebeln
and bewtp = 'Q'.
endif.
loop at it_ml_esll into wa_ml_esll.
move wa_ml_esll-packno to wa_final-packno.
move wa_ml_esll-ebeln to wa_final-ebeln1.
move wa_ml_esll-srvpos to wa_final-srvpos.
move wa_ml_esll-ktext1 to wa_final-ktext1.
move wa_ml_esll-meins to wa_final-meins.
move wa_ml_esll-menge to wa_final-menge1.
read table it_essr into wa_essr with key lblni = wa_ml_esll-ebeln.
if sy-subrc = 0.
move-corresponding wa_essr to wa_final.
endif.
read table it_ekko into wa_ekko with key ebeln = wa_essr-ebeln.
if sy-subrc = 0.
move wa_ekko-werks to wa_final-werks.
move wa_ekko-ekorg to wa_final-ekorg.
move wa_ekko-ekgrp to wa_final-ekgrp.
move wa_ekko-ebeln to wa_final-ebeln.
move wa_ekko-menge to wa_final-menge.
move wa_ekko-matkl to wa_final-matkl.
move wa_ekko-mwskz to wa_final-mwskz.
move wa_ekko-lifnr to wa_final-lifnr.
move wa_ekko-bedat to wa_final-bedat.
move wa_ekko-netpr to wa_final-netpr.
endif.
read table it_lfa1 into wa_lfa1 with key lifnr = wa_ekko-lifnr.
if sy-subrc = 0.
move wa_lfa1-lifnr to wa_final-lifnr.
move wa_lfa1-name1 to wa_final-name1.
endif.
read table it_ekbe into wa_ekbe with key lfbnr = wa_ml_esll-ebeln
packno = wa_ml_esll-packno
srvpos = wa_ml_esll-srvpos.
if sy-subrc = 0.
move wa_ekbe-belnr to wa_final-belnr.
endif.
read table it_ekbe1 into wa_ekbe1 with key ebeln = wa_ekko-ebeln.
if sy-subrc = 0.
move wa_ekbe1-belnr to wa_final-belnr1.
endif.
read table it_ml_esll1 into wa_ml_esll1 with key srvpos = wa_ml_esll-srvpos.
if sy-subrc = 0.
move wa_ml_esll1-menge to wa_final-menge2.
move wa_ml_esll1-netwr to wa_final-netwr.
move wa_ml_esll1-tbtwr to wa_final-tbtwr.
endif.
read table it_mseg into wa_mseg with key lfbnr = wa_essr-lblni
ebeln = wa_essr-ebeln.
if sy-subrc = 0.
move wa_mseg-mblnr to wa_final-mblnr.
move wa_mseg-erfmg to wa_final-erfmg.
endif.
append wa_final to it_final.
endloop.
delete it_final where srvpos is initial.
sort it_final by srvpos lblni ebeln .
Edited by: Satvikpanchal on Dec 6, 2011 11:01 AM -
How to find open Po's.?
Hi frds..
How to find the open POs(POs without GR) and tell me in which table and field it stored ?
thanks
Pari Vendhan.RHi,
it has many IFs and BUTs. Please select data from EKKO where BSTYP = "F", LOEKZ blank and other fields as per your choice. Please ensure that you do not select much data.
Then select data from EKPO where LOEKZ and ELIKZ are blank.
You may have to tune the report based on customer's requirement then.
Please use ME2* reports with desired Selection parameters. Or copy it and tune based on your requirement.
- Sanjeev -
Hi Guys,
I have PO quantity(EKPO-MENGE) and goods receipt quantity(MSEG-ERFMG). Here i want to calculate the open PO quantity which is EKPO-MENGE - MSEG-ERFMG .But here if multiple material docements r getting created for the same for one PO and partial goods receipt quantity is done thru these multiple material documents. then how to net the open quantity.
For example :
PO no PO quantity material documents GR quantity
10 10 100 1
200 2
300 -2
400 3
Now i need the open quantity as 9
7
9
6.
Even i tried with At new Ebeln.but i am not getting it.
Can anybody help me in this.Hi,
Open PO Line Item Qty = PO Line Item Qty - ( Sum(All GR Qty for PO Line Item ) -
Sum(All GR Return Qty for PO Line Item) ).
PO Line Item Qty = EKPO-MENGE.
GR QTY for PO Line Item = EKBE-MENGE with Movement Type = '101'.
GR Return QTY for PO Line Item = EKBE-MENGE with Movement Type = '102'.
SELECT EKPOMENGE EKPOMEINS
FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
INNER JOIN EKET ON EKETEBELN = EKPOEBELN AND
EKETEBELP = EKPOEBELP
INNER JOIN LFA1 ON LFA1LIFNR = EKKOLIFNR
INTO CORRESPONDING FIELDS OF TABLE I_PO
WHERE EKKO~BUKRS = P_BUKRS AND
EKPO~WERKS = P_WERKS AND
EKKO~LIFNR IN S_LIFNR AND
EKPO~MEINS IN S_MEINS AND
EKET~EINDT IN S_EINDT AND
EKKO~BSTYP = 'F' AND "Select PO Only"
EKKO~LOEKZ = ' ' AND "PO should not be deleted"
EKPO~LOEKZ = ' ' . "Line Item Should not be DEL
Fetch the PO History Details for the Records of the Internal Table i_po.
LOOP AT I_PO.
SELECT EBELN EBELP BWART MENGE WRBTR
FROM EKBE
APPENDING CORRESPONDING FIELDS OF TABLE I_EKBE
WHERE EBELN = I_PO-EBELN AND
EBELP = I_PO-EBELP AND
BEWTP IN ('E','F').
ENDLOOP.
Edited by: AJAY TIWARI on Oct 19, 2008 5:00 PM -
Urgent: Add field in generic data source
Hi,
Could anyone please help me out in resolving the issue to add field from different table in generic datasource.
How can I add it in R/3 data source when a function module was created in ABAP to generate fields from PLPO table?
Whatz the changes has to be done at BW side to map the added field?
<u>Requirement</u>
1) Need one more field in the extractor. Field name is PLAS-LOEKZ. Initially client wanted me to add PLPO-LOEKZ which I added, now he needs the same fields from both the table (PLAS and PLPO).
2)The name of the extractor/structure is ZBW_ROUTINGS_OPERATION
3)Now, we need to add this field (LOEKZ from PLAS) in the function module as well. FM name is: Z_BW_ROUTE_OPERATION_EXTRACTOR. This will be in a SELECT query. We need to add this field in the SELECT statement.
Testing will be done in following steps
1) Go to Transaction RSA3.
2) Enter the data source Z_BW_OPERATION_ATTR(not sure about the name though, but it should end with OPERATION_ATTR)
3) Enter the following details:
EXTTY I
PLNNR 50000032
PLNTY N
4) Now execute (F8) the transaction.
5) Click on Display List
6) In the output, we should be able to see these 2 columns(PLAS-LOEKZ) and (PLPO-LOEKZ)
Please send your valuable suggestions to resolve the issue ASAP as its damn urgent.Hi,
Here is an overview of the solution -
Use T.Code SE11> ZBW_ROUTINGS_OPERATION. Add your new field (PLAS-LOEKZ) to this table, check, save, activate. Edit your function module, SE37> Z_BW_ROUTE_OPERATION_EXTRACTOR and add your code to look up the correct value of this field LOEKZ from the table PLAS, check, save, activate. (Note that SAP provides a sample function module you can use as a template and customize for your requirements. This sample function module is RSAX_BIW_GET_DATA_SIMPLE.)
Your Generic DataSource Z_BW_OPERATION_ATTR is already created, you dont have to change any settings here. Just regenerate it in RSO2. Now test the extraction for the DataSource in RSA3.
Hope this helps
Sandeep
Maybe you are looking for
-
Hp deskjet 1510 series won't print
We mloved recently to la Gomera (Canarian isle) and there I bought a hp deskjet 1510. It won't print when connected to my lap top, also HP with Windows vista, although it is connected, is on, and is the default printer. I tried everything the print
-
(every document file of every folder in folder thePath) as alias list
On Dec 9, 2006, at 1:03 AM, Bill Hernandez wrote: I use "set aList to get every file of every folder in startFolder" the references are to "document file path2file" instead of "alias to path2file", and I was not successful getting BBEdit to work with
-
ADF Faces - Table update not completely rendered
Hi, [ myfaces 1.1.3 + ADF version 10.1.3.0.4 ] I have a problem with Table component, changing a value of the inputText components will not update the output component also inside the table. At least not rendered to HTML, the view-tree contains the u
-
hi i live in southern cali. and have 4 channels that are streached 2,5,11,13 anyone heard what verizon is going to do to fix this and when
-
IMac, firewire, drobo and camera
Hi guys, I'm currently working off an old power pc-based mac pro and need to upgrade. I'd like to get an iMac but am running into an issue: I think I need two firewire ports I use a drobo drive, connected via fw and if I ever need to capture video, w