Based on single Doc number Multiple line items update to in single Z database table
Dear Frds,
Based on single Doc number Multiple line items update to database table
Example : Doc Num: Janu
If users are using different doc number again the line items are modifying and replacing to new document Number . Pls Help me Screen attached as
Like CS01 Transaction
Dear Frds,
Based on single Doc number Multiple line items update to database table
Example : Doc Num: Janu
If users are using different doc number again the line items are modifying and replacing to new document Number . Pls Help me Screen attached as
Like CS01 Transaction
Similar Messages
-
Setting the value of a single attribute for multiple line items
Hi all,
I am working on a Web Dynpro application, I have created this applicaion for an accounting document so it has header data and multiple line item data. As per the requirement I have to put the following logic:
1. When a user enters a value in the field KBLNR on the line item, all the other fields like cost centerm fund, functional area should populate from a database table based on the value of the KBLNR. to get this I have put the following code:
TYPES: BEGIN OF t_kblp,
fipos TYPE kblp-fipos,
kostl TYPE kostl,
END OF t_kblp.
DATA lv_kblnr TYPE wd_this->element_t_bseg-kblnr.
DATA: lt_kblp TYPE STANDARD TABLE OF t_kblp,
wa_kblp LIKE LINE OF lt_kblp,
lt_bseg TYPE STANDARD TABLE OF bseg,
wa_bseg TYPE bseg.
DATA lo_nd_t_bseg TYPE REF TO if_wd_context_node.
DATA lo_el_t_bseg TYPE REF TO if_wd_context_element.
DATA: ls_t_bseg TYPE wd_this->element_t_bseg,
lo_api_controller TYPE REF TO if_wd_controller,
lo_message_manager TYPE REF TO if_wd_message_manager,
lo_nd_tbseg TYPE REF TO if_wd_context_node,
lo_el_tbseg TYPE REF TO if_wd_context_element,
lt_el_tbseg TYPE wdr_context_element_set,
lv_bseg TYPE bseg.
lo_nd_t_bseg = wd_context->path_get_node( path = `ZDATA.CHANGING.T_BSEG` ).
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
lo_nd_tbseg = wd_context->path_get_node( path = `ZDATA.CHANGING.T_BSEG` ).
lt_el_tbseg = lo_nd_tbseg->get_elements( ).
LOOP AT lt_el_tbseg INTO lo_el_tbseg.
lo_el_tbseg->get_static_attributes(
IMPORTING static_attributes = lv_bseg ).
IF lv_bseg-kblnr NE ' '.
SELECT belnr
fipos
kostl
PSPNR
geber
saknr
fkber
grant_nbr
gsber
FROM kblp
inTO corresponding fields of wa_kblp
WHERE belnr = lv_bseg-kblnr and
saknr = lv_bseg-saknr.
ENDSELECT.
lo_nd_t_bseg = wd_context->path_get_node( path = `ZPRELIMINARY_POSTING.CHANGING.T_BSEG` ).
* get element via lead selection
lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
lo_el_tbseg->set_static_attributes(
EXPORTING static_attributes = wa_kblp ).
CLEAR: lv_bseg, wa_kblp.
ENDLOOP.
everything is working fine but now the problem is couple of fields that I have in wa_kblp are with different names in bseg table and hence they are not updating... I tried putting the following logic within the loop :
lo_el_t_bseg->set_attribute(
name = `PROJK`
value = wa_kblp-pspnr ).
but it's only setting the value of the first line item and not working for the multiple line items, can you please tell me how can do this?
Thanks,
Rajat Garg
Edited by: rajatg on Jun 24, 2011 5:09 PMHi Chris,
I tried your code and it worked fine but after I put this code I am getting another issue. within the loop I had a code to make the fields non modifiable on the screen and was working fine but now what's happening is it's making the all the lines uneditable except the one with data on it (which is completely opposite), this is what I have coded:
LOOP AT lt_el_tbseg INTO lo_el_tbseg.
lo_el_tbseg->get_static_attributes(
IMPORTING static_attributes = lv_bseg ).
IF lv_bseg-kblnr NE ' '.
SELECT belnr
fipos
kostl
PSPNR
geber
saknr
fkber
grant_nbr
gsber
FROM kblp
inTO corresponding fields of wa_kblp
WHERE belnr = lv_bseg-kblnr and
saknr = lv_bseg-saknr.
ENDSELECT.
move: wa_kblp-belnr to wa_bseg-kblnr,
wa_kblp-fipos to wa_bseg-fipos,
wa_kblp-kostl to wa_bseg-kostl,
wa_kblp-pspnr to wa_bseg-projk,
wa_kblp-geber to wa_bseg-geber,
wa_kblp-saknr to wa_bseg-saknr,
wa_kblp-fkber to wa_bseg-fkber,
wa_kblp-grant_nbr to wa_bseg-grant_nbr,
wa_kblp-gsber to wa_bseg-gsber,
lv_bseg-dmbtr to wa_bseg-dmbtr.
append wa_bseg to lt_bseg.
lo_nd_edit_property = wd_context->path_get_node( path = `ZPRELIMINARY_POSTING.CHANGING.T_BSEG.EDIT_PROPERTY` ).
get element via lead selection
lo_el_edit_property = lo_nd_edit_property->get_element( ).
lo_el_edit_property->set_attribute(
name = `EDIT_FIELD`
value = 'ABAP_TRUE' ).
lo_el_edit_property->set_attribute(
name = `EDIT_WBS`
value = 'ABAP_TRUE' ).
endif.
endloop.
o_nd_t_bseg = wd_context->path_get_node( path = `ZPRELIMINARY_POSTING.CHANGING.T_BSEG` ).
get element via lead selection
lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
CALL METHOD lo_nd_t_bseg->bind_table
EXPORTING
new_items = lt_bseg.
Can you please see what I am doing it wrong here.... -
Conversion - Doc with multiple line items - LSMW
Hi Friends,
I have got a flat file that holds all the open sales orders from a legacy system. I need to upload these data into R/3. If i use LSMW it creates a separate sales order for each line item of a single sales order. That is i am unable to get all the line items for a sales order.How to go about it?.
Quick replies would be rewarded.
Regards,
Tamilarasan.Hi,
of course. We were talking of two approaches, here is a simple one (with one input file):
1) Source structure definition
I define several structures (head level / line level)
ART_HEAD Article E1BPE1MATHEAD
5 ART_SITE Logistic view source E1BPE1MARCRT
ART_MBEW Article Valuation E1BPE1MBEWRT
(Sorry, can't see correctly the copy, but art_site is below art_head and can contain several sites for one article)
2) Maintain source fields
Group your fields into header and line values. In both strucutes one identifier is needed:
ART_HEAD Article E1BPE1MATHEAD
IDENT C(010) Structure Identifier 1
Identifing Field Content: HEAD
HEAD_MATERIAL C(018) Article number
Assign all needed fields, double click on field IDENT, you will see attribute 'Identifying field content'.
3) Maintain Structure relations
Header fields of BAPI (or whatever method you use) your head-structure has to be assigned, line (tables) input has to be assigned to line-structure.
4) Field mapping: quite normal
5) Import file example (tabulator separated text file):
HEAD 1000014 20050706 OR
LINE 5334667 15 ST 23,15 EUR
LINE 5334669 20 ST 15,89 EUR
HEAD ....
LINE ....
LINE ....
LINE .... and so one
So no field names, just the field values according to your source field definition. Don't ask me, how to create such a text file, I managed it somehow with some formulas. Visual basic might help better.
Please ask for me details if necessary.
The other option of Murugesh uses three files instead: header values, line values, link values. Looks like some online information will tell how to use them in LSMW.
Regards,
Christian -
Where/ how do I set SNP to create Planned orders with multiple line items?
Hi
Currently our SNP is generating planned orders on a daily basis, it creates a single order with a single line item per location.
Where/ how do set SNP to create planned orders on a daily basis to generate a single order with multiple line items per location, so therefore one planned order with multiple line items for a single location.
Thanx
KeeganHi Keegan,
In SNP (APO) it is not possible to create order with multiple line items.
But you can do some settings so that while planning system can do aggregation and disaggregation.
But your requirment should be set on Aggregation/Dis-aggregation logic.
Please follow the follwing links:
http://help.sap.com/saphelp_scm2007/helpdata/en/2c/c557e9e330cc46b8e440fb3999ca51/content.htm
Aggregation:
http://help.sap.com/saphelp_scm2007/helpdata/en/42/f731d078e73ee4e10000000a1553f6/content.htm
Disaggregation:
http://help.sap.com/saphelp_scm2007/helpdata/en/a6/ebefaf32e22e468355da304cc59387/content.htm
Please be sure that the setting of this logic will be at planning area level.
You can't change aggregation/disaggregation logic further.
Regards,
Santosh -
Single/ Consolidated GR/IR entry for a PO having multiple line items
Hi,
In a PO there are couple of line items for materials of similar type and class. While making the Goods Receipt, the Accounting Document is making two no of line items for GR/IR accounts as credit and two no of inventory accounts as debit. Same is happening to GR/IR account while making Invoice Receipt document also.
Informatively, both the materials above have been assigned to one GR/IR account in the OBYC table.
My question is, is it possible to consolidate the value of both these materials and post one line item for GR/IR account. This is required as in our case in a PO, normally, we do have multiple line items and hence it is resulting multiple no of GR/IR and inventory accounts in a single accounting document. As we are getting details of the line item from PO history, we do not require it in the accounting document.
Requested to kindly help.
Regards
B.MohantyHi
This is not possible (you will compleet los the link between the Invoice and GR)
The reason is that when you receive an invoice that this is based on a G/R line and the way arround when you receive first the invoice(s).
The system need this for the automatecly clearing from the G/R - I/R account, that is based on PO an PO line item number. -
LM46 - Multiple line items into single HU
Hello,
I am using Pick & Pack functionality and confirming transfer orders using RF - LM46 transaction.
During confirmation of transfer order, new HU is getting created for each line item. Is it possible to confirm multiple line items into single HU.
Is there any setting needs to be done to achieve the same.
Steps in current process
- Create transfer order using LT03 or Background job
- Go to LM46 - enter delivery and packaging material
- Confirm line item
- TO item information (Qty & batch) updating back to Delivery along with new HU number
- Material and qty getting packed to HU correctly..
As we have several small picks, we don't want new HU to be created automatically. If we can combine multiple TO items into single HU that will be helpful for the process.
Please let me know if you need further information.
Thanks in advance,
Naga MohanHi Nag,
I don't believe there is a straightforward way of doing that. The idea behind the design would be (for the two cases mentioned in this thread):
No HU exists, so new HU is generated during the TO confirmation (by entering only the packing material and $ as the HU number, triggering the label printing for shipping)
Hu exists, so the user would have the HU in front of them and would be packing directly into it.
Is your requirement for all deliveries within the warehouse? i.e Each delivery (regardless of the number of transfer orders) should only have one HU assigned?
Regards
Stephen -
How to Restrict Single Delivery Date for PO with Multiple Line Items
Dear Experts,
How to Restrict Single Delivery Date for PO with Multiple Line Items.
System needs to through Error Message if User Inputs Different Delivery Dates for PO with Multiple Line Items in ME21N Tcode.
Can we achive this by Some Enhancement in SAP or Not ???
If so how to do it.
Any Inputs is highly appreciated.
Thanks and Regards,
Selvakumar. MHi Selvakumar,
we can resrict the PO to have a single delivery date in all the line items by means of giving a error message or overwiting the delivery date keyed/determined in the line item.
You can use the BADI -> ME_PROCESS_PO_CUST. In which you need to implement the method PROCESS_SCHEDULE.
(for technical aid - This method will be called for each and every PO line item, From the imporing parameter im_schedule we can get all the details of current PO line, even we can change the data in the current PO line. )
Regards,
Madhu. -
Hi all ,
I have a requirement to Post Cash Journal Document using FBCJ tcode.
Is it possible multiple line items debit & single line item credit and different cost centers and different profit centers
for exp:
pk GL a/c description amount cost center profit center
40 400101 telephone exp 500 1403 P 1000
40 400101 telephone exp 100 1404 P 2000
50 200100 cash in hand 600-
This is My requirement is it possible in fbcj
Please suggest me.ASAP.
Regards
Naresh.Hi,
This you can do it in two ways:
1. Make three header under top level....one Product A, 2nd Product B ( as Billing element) and third as Common expense ( only cost). Now 1st & 2 nd WBS, you have to have sales order linking with individual lint item, for third you will accumulate all the common expense till the period end then make a reposting of the same in desired proportion to both products WBS hierarchy
(This is if you want to have a track on the common expense as well.......like planning, budgeting & control)
After this reposting, run RA for individual billing element and hence you will all the complement detailing and control over Revenue and expense with respect to Product A and Product B individually.
2. If you don't want to maintain that kind of detailing the common expense and keep track of it through project, then have cost centers accordingly and make an assesment/ distribution with respect to expenses accumulated at those cost centers for the period to the respective WBS under each product. Then execute the period end processes for the project.
Or
You can try with have two more line items in the costing sheet as an overhead against common expenses with respect each product.
I hope this should help you.
Regards
Avisek Bhardwaj -
Invoice Split based on number of line items
Dear all,
We are on CRM 7.0. We are doing billing in crm for service products . We have a requirement that if the number of line items in the invoice is more than 200, invoice split should happen. Has anyone worked on this scenario and if so pl. let me know how to go about this.
Regards
P.Bhaskaranmight give you better answers.
If this applies to your processes CRM Web Channel, the work will still be in the CRM backend.
Easwar Ram
http://www.parxlns.com -
Dear All,
I am writing BDC for F-28
Where wanted to add multiple line items in screen 0731 for the field rfo5a-sel01
It's urgent
Regards
ShashikantHi,
You can use the program RFBIBL00 to upload the FI documents.
Sample BDC
File Format : Below listed fields must be filled when you wnat to post new document. Program will recognize new document by itab-newdoc = 'X'.
NEWDOC , "New Doc
BLDAT(10) , "Doc Date
BUDAT(10) , "Posting Date
BLART(2) , "Document Type
XBLNR LIKE BKPF-XBLNR , "Refrence
BKTXT LIKE BKPF-BKTXT , "Doc Header Text
You need one serverfile. After sucessfully run of program you have to run the progrma RFBIBL00. Pass data transfer type = 'B'.
Regards,
Naimesh.
PS: Reward points, if it is useful..!
REPORT ZTEST_NP .
Tables
TABLES: BSEG ,
BGR00,
BBKPF,
BBSEG,
t001.
Internal Tables
DATA: BEGIN OF ITAB OCCURS 0 ,
NEWDOC , "New Doc
BLDAT(10) , "Doc Date
BUDAT(10) , "Posting Date
BLART(2) , "Document Type
XBLNR LIKE BKPF-XBLNR , "Refrence
BKTXT LIKE BKPF-BKTXT , "Doc Header Text
BSCHL(2) , "Posting Key
HKONT(10) , "Account
UMSKZ(1), "Sp GL ind
ZLSCH(1) , "Payment Method
ZLSPR(1) , "Payment Block
WRBTR(16), "Amount without sign
KOSTL(10), "Cost center
GSBER(4) , "Business Area
ZUONR LIKE BSEG-ZUONR , "Assignment
AUFNR LIKE BSEG-AUFNR , "Order
PERNR(8) , "Personal Number
SGTXT LIKE BSEG-SGTXT, "Line Item Text
END OF ITAB .
DATA: ITAB1 LIKE ITAB OCCURS 0 WITH HEADER LINE.
DATA: I_BBKPF LIKE BBKPF OCCURS 0 WITH HEADER LINE.
DATA: I_BBSEG LIKE BBSEG OCCURS 0 WITH HEADER LINE.
DATA: I_BWITH LIKE BWITH OCCURS 0 WITH HEADER LINE.
Data Declaration
DATA: C_NODATA(1) TYPE C VALUE '/',
W_CNT TYPE I.
FIELD-SYMBOLS <F>.
SELECTION-SCREEN: BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-T01.
PARAMETER: P_BUKRS LIKE BKPF-BUKRS OBLIGATORY,
PSESSION(12) OBLIGATORY DEFAULT 'Auto_FI',
P_SFILE LIKE RLGRAP-FILENAME OBLIGATORY ,
P_LFILE LIKE RLGRAP-FILENAME OBLIGATORY .
SELECTION-SCREEN: END OF BLOCK BLK1.
At Selection Screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_LFILE.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = P_LFILE.
Start Of Selection
START-OF-SELECTION .
OPEN DATASET P_SFILE FOR OUTPUT IN TEXT MODE .
PERFORM INIT_BGR00 USING C_NODATA.
PERFORM INIT_IBKPF USING C_NODATA.
PERFORM INIT_IBSEG USING C_NODATA.
PERFORM UPLOAD .
PERFORM SET_DATA.
*& Form INIT_BGR00
FORM INIT_BGR00 USING NODATA .
CLEAR BGR00.
BGR00-STYPE = '0'.
BGR00-GROUP = PSESSION.
BGR00-MANDT = SY-MANDT .
BGR00-USNAM = SY-UNAME .
bgr00-start = datum .
BGR00-XKEEP = 'X'.
BGR00-NODATA = NODATA.
TRANSFER BGR00 TO P_SFILE.
ENDFORM. " INIT_BGR00
*& Form INIT_IBKPF
FORM INIT_IBKPF USING NODATA .
Initialize data fields with NODATA:
W_CNT = 0.
DO.
ADD 1 TO W_CNT.
ASSIGN COMPONENT W_CNT OF STRUCTURE I_BBKPF TO <F>.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
MOVE NODATA TO <F>.
ENDDO.
ENDFORM.
*& Form INIT_IBSEG
FORM INIT_IBSEG USING NODATA.
Initialize data fields with NODATA:
W_CNT = 0.
DO.
ADD 1 TO W_CNT.
ASSIGN COMPONENT W_CNT OF STRUCTURE I_BBSEG TO <F>.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
MOVE NODATA TO <F>.
ENDDO.
ENDFORM.
*& Form INIT_BBKPF
FORM INIT_BBKPF.
MOVE I_BBKPF TO BBKPF.
BBKPF-STYPE = '1'.
ENDFORM. " INIT_BBKPF
*& Form INIT_BBSEG
FORM INIT_BBSEG.
MOVE I_BBSEG TO BBSEG.
BBSEG-STYPE = '2'.
BBSEG-TBNAM = 'BBSEG'.
ENDFORM. " INIT_BBSEG
*& Form UPLOAD
FORM UPLOAD.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = P_LFILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = ITAB
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
OTHERS = 8.
IF SY-SUBRC NE 0 .
MESSAGE S001(01) WITH 'The File Could not be Uploaded..!' .
LEAVE LIST-PROCESSING .
ELSE.
DELETE ITAB INDEX 1 .
ENDIF .
LOOP AT ITAB .
DO .
REPLACE '.' WITH '' INTO ITAB-BLDAT .
IF SY-SUBRC NE 0 .
CONDENSE ITAB-BLDAT NO-GAPS .
EXIT .
ENDIF .
ENDDO .
DO .
REPLACE '.' WITH '' INTO ITAB-BUDAT .
IF SY-SUBRC NE 0 .
CONDENSE ITAB-BUDAT NO-GAPS .
EXIT .
ENDIF .
ENDDO .
MODIFY ITAB .
ENDLOOP .
ENDFORM. " UPLOAD
*& Form SET_DATA
FORM SET_DATA.
DATA: L_DOCCNT TYPE I,
L_LNCNT TYPE I .
SELECT SINGLE * FROM T001
WHERE BUKRS = P_BUKRS.
LOOP AT ITAB .
IF ITAB-NEWDOC = 'X' OR ITAB-NEWDOC = 'x' .
CLEAR : L_LNCNT .
L_DOCCNT = L_DOCCNT + 1.
PERFORM INIT_BBKPF .
BBKPF-TCODE = 'FB01'.
BBKPF-BUKRS = P_BUKRS.
WRITE : ITAB-BLDAT DD/MM/YY TO BBKPF-BLDAT.
WRITE : ITAB-BUDAT DD/MM/YY TO BBKPF-BUDAT.
BBKPF-BLART = ITAB-BLART .
BBKPF-WAERS = T001-WAERS.
BBKPF-BKTXT = ITAB-BKTXT .
BBKPF-XBLNR = ITAB-XBLNR .
TRANSFER BBKPF TO P_SFILE.
ENDIF .
L_LNCNT = L_LNCNT + 1 .
IF L_LNCNT GT 990 .
MESSAGE S001(01) WITH 'Number of Records Exceed 990 Line Items'
'Program cannot be executed' .
LEAVE LIST-PROCESSING .
ENDIF .
PERFORM INIT_BBSEG .
BBSEG-NEWKO = ITAB-HKONT .
BBSEG-NEWBS = ITAB-BSCHL .
BBSEG-WRBTR = ITAB-WRBTR .
IF NOT ITAB-KOSTL IS INITIAL .
BBSEG-KOSTL = ITAB-KOSTL .
ELSE .
IF NOT ITAB-GSBER IS INITIAL .
BBSEG-GSBER = ITAB-GSBER .
ENDIF .
ENDIF .
BBSEG-ZUONR = ITAB-ZUONR.
BBSEG-SGTXT = ITAB-SGTXT .
IF NOT ITAB-AUFNR IS INITIAL .
BBSEG-AUFNR = ITAB-AUFNR .
ENDIF .
IF NOT ITAB-UMSKZ IS INITIAL .
BBSEG-NEWUM = ITAB-UMSKZ .
ENDIF .
IF ITAB-BSCHL = '29' OR ITAB-BSCHL = '39' OR ITAB-BSCHL = '09' .
BBSEG-ZFBDT = BBKPF-BLDAT .
ENDIF .
IF NOT ITAB-ZLSCH IS INITIAL .
BBSEG-ZLSCH = ITAB-ZLSCH .
ENDIF .
IF NOT ITAB-PERNR IS INITIAL .
BBSEG-PERNR = ITAB-PERNR .
ENDIF .
IF NOT ITAB-ZLSPR IS INITIAL .
BBSEG-ZLSPR = ITAB-ZLSPR .
ENDIF .
TRANSFER BBSEG TO P_SFILE.
ENDLOOP .
IF L_DOCCNT NE 0 .
WRITE :/ P_SFILE , 'has been created' .
WRITE :/ L_DOCCNT , 'DOCUMENTS UPLOADED' .
ELSE .
WRITE :/'INPUT FILE CONTAINS NO DATA' .
ENDIF .
CLOSE DATASET P_SFILE .
ENDFORM. " SET_DATA
Reward points if Useful
Regards
Gokul -
Creating a PO Using BAPI For Multiple PLants Or Multiple Line Items
Hi All
Can you please suggest me how to create a Purchase Order Using BAPI_PO_Create1 for Multiple Plants Or for Multiple Line items. The Requirement is like the PO is for single material for single vendor but for mulple stores i.e plants
NOte: Suggest me the Creation of PO for MUltiple Line items or for multiple plants Using BAPI . Hope you people will give me the needful.
Regards
Shivakumar BandariHi,
Here is the sample code to do that...
*---> po header data
wa_poheader-vendor = your vendor..
wa_poheader-doc_type = Your doc type..check with Functional contact....
wa_poheader-purch_org = Purchasing Org..
wa_poheader-pur_group = Purchasing Group
*---> po header data (change toolbar)
wa_poheaderx-vendor = 'X'.
wa_poheaderx-doc_type = 'X'.
wa_poheaderx-purch_org = 'X'.
wa_poheaderx-pur_group = 'X'.
*---> poitem data
data: item like ekpo-ebelp.
item = '0010'.
loop at t_parts.
it_poitem-po_item = '00010'.
IT_POITEM-PLANT = Plant..
IT_POITEM-STGE_LOC = Sloc...
*---> poitemx (item data change toolbar)
it_poitemx-po_item = '0010'.
it_poitemx-po_itemx = 'X'.
IT_POITEMX-PLANT = 'X'.
IT_POITEMX-STGE_LOC = 'X'.
*---> add record's to internal table
APPEND: it_poitem,
it_poitemx.
endloop.
*call bapi_po_create1
CLEAR v_ebeln.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = wa_poheader
poheaderx = wa_poheaderx
IMPORTING
exppurchaseorder = v_ebeln
TABLES
return = it_return
poitem = it_poitem
poitemx = it_poitemx.
*---> check the return table for error message
READ TABLE it_return WITH KEY type = 'E'.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
endif.
Thanks,
Murali -
Copying the item text in case of multiple line items
Hi All,
I have a scenario where the sales order gets created in our SAP through a 850 idoc. The incoming idoc has only one item segment which carries the total order quantity ( for example say 1000). Since my company has contractual agreements with the end customer for doing multiple shipments , our sales department splits the total quantity into multiple line items in the sales order. Say splitting the 1000 quantities into 5 line items of 200 each.
The problem here is that when the sales order got created , all the related item text were copied only to the first line item ( of 1000 qty) and which is standard SAP. Since the order quantity was manually split, the related item text are not carried to the subsequent line items. The issue comes when an outbound (810) idoc is sent to customer . As I told earlier since only the first line item has the item text , the 810 idoc which was created for the first line item only has the item text . The rest of the 810 which were subsequently created for multiple shipments/invoices on different dates didn't have the item text in the 810's. This is becoming a major problem as the 810 files are failing at our trading partners end because of missing text.
Now my question is, Is there a way that I can make the item text copy automatically when multiple line items are created manually by business. Like is there a way where I can modify MV45AFZZ to copy the item text in their respective segemnts ( z003,z004 etc) to "N" number of line items.
Also please suggest if there is a better way of doing it. Suggstions are most welcome !!!.
Regards
AmrithHi,
First of all try to avoid doing select into corresponding fields. THis would improve the performance of the program.
Try to do a single fetch from the BSIS table . fetch the hkont, belnr, dmbtr fields in to a master internal table. Manipulate and play with the data as required. Don't hit the data base table more than once (unless it is required) . This would improve the performance of your code.
Try to code this way.
types: begin of ty_bsis,
hkont type hkont,
belnr type belnr_d,
dmbtr type dmbtr,
end of ty_bsis.
data: it_bsis type standard table of ty_bsis,
wa_bsis type ty_bsis,
select hkont belnr dmbtr
from bsis
into table it_bsis
WHERE HKONT IN S_RACCT
AND PRCTR IN P_PRCTR
AND MONAT IN S_POPER
AND BUKRS EQ P_BUKRS
AND GJAHR EQ P_GJAHR
AND PRCTR IN S_PRCTR.
Using the data availabe in the it_bsis, you can manipulate as required.
Hope this would be helpful
Regards
Ramesh Sundaram -
One line item in po from multiple line items of Purchase Requisition
Can we merge multiple line items for same item from different different purchase requisition into a single line item in Purchase Order ?
For example, say department A and B made two different purchase requisition for 1 number of computer system. Now the purchaser viewed these requisitions and he want to make a purchase order to party X for 2 no of computer system. Now how he can do this in Oracle Purchasing.
Regards
Edited by: Saroj.Dash on May 31, 2010 6:02 AMHi !
thanx to all for your responses.
But, let me explain better.
Say Dept A raises an Requisition (Req No: 1 ) for 5 Chairs. In the same time Dept. B raises requisition (req no: 2 ) for 10 chairs.
Now Purchase Dept. wants to make an PO to procure chair with respective to these 2 requisitions i.e. req no 1 from dept A and req no 2 from Dept B.
Now my query is that, can the purchase dept. prepare a PO with 1 line item only i.e. for chair (5+10) of 15 numbers from these requisitions of dept A and B ?
If yes then how ?
Regards -
hi all,
i am developing bdc program to upload multiple line items for ml10.
i am uploading folling fields
spec_no
astyp
txz01,
sort1,
waers,
matkl,
ekorg,
srvpos ' service number
menge. 'quantity
service number and quantity are multiple line items.
i have developed a code which is taking single record only, it is not working for multiple service no and quantity.
include bdcrecx1.
parameters: filename like rlgrap-filename.
data: begin of record,
SPEC_NO(10),
ASTYP(4),
TXZ01(40),
SORT1(20),
WAERS(5),
MATKL(9),
EKORG(4),
NEW_ROW(10),
SRVPOS(18),
MENGE(13),
end of record.
data: itab_program like record occurs 0 with header line.
At Selection Screen
at selection-screen on value-request for filename.
perform query_filename changing filename.
*START-OF-SELECTION
start-of-selection.
*-- Upload flat data to ITAB.
perform upload_to_itab.
*{ chg001 -- modified as per requirement
perform open_group.
loop at itab_program.
perform upload_programs.
endloop.
perform close_group.
FORM UPLOAD_TO_ITAB *
form upload_to_itab.
call function 'WS_UPLOAD'
exporting
CODEPAGE = ' '
filename = filename
filetype = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
tables
data_tab = itab_program
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
write : 'File opening error.'.
endif.
endform.
FORM QUERY_FILENAME *
--> P_FILENAME *
form query_filename changing p_filename.
data : tmp_filename like filename.
call function 'WS_FILENAME_GET'
exporting
def_filename = filename
mask = ',.txt,.txt.'
mode = 'O'
title = 'Select the file to Upload'
importing
filename = tmp_filename
exceptions
inv_winsys = 01
no_batch = 02
selection_cancel = 03
selection_error = 04.
if sy-subrc = 0.
filename = tmp_filename.
endif.
endform.
*perform open_group.
*& Form UPLOAD_programs
text
--> p1 text
<-- p2 text
form upload_programs.
perform bdc_dynpro using 'SAPLMLSM' '0100'.
perform bdc_field using 'BDC_CURSOR'
'TEMP_SPEC-ASTYP'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'TMP_SPEC-SPEC_NO'
ITAB_PROGRAM-SPEC_NO.
perform bdc_field using 'TMP_SPEC-ASTYP'
ITAB_PROGRAM-ASTYP.
*****************************************************************SCREEN1
perform bdc_dynpro using 'SAPLMLSM' '0200'.
perform bdc_field using 'BDC_CURSOR'
'TMP_SPEC-EKORG'.
perform bdc_field using 'BDC_OKCODE'
'=SRV'.
perform bdc_field using 'TMP_SPEC-TXZ01'
ITAB_PROGRAM-TXZ01.
perform bdc_field using 'TMP_SPEC-SORT1'
ITAB_PROGRAM-SORT1.
perform bdc_field using 'TMP_SPEC-WAERS'
ITAB_PROGRAM-WAERS.
perform bdc_field using 'TMP_SPEC-MATKL'
ITAB_PROGRAM-MATKL.
perform bdc_field using 'TMP_SPEC-EKORG'
ITAB_PROGRAM-EKORG.
*****************************************************************END OF SCREEN2
perform bdc_dynpro using 'SAPLMLSP' '0201'.
perform bdc_field using 'BDC_OKCODE'
'=BZE'.
*perform bdc_field using 'RM11P-HEADTEXT'
ITAB_PROGRAM-TXZ01.
perform bdc_field using 'BDC_SUBSCR'
'SAPLMLSP'.
perform bdc_dynpro using 'SAPLMLSP' '0201'.
perform bdc_field using 'BDC_OKCODE'
'=BZE'.
perform bdc_field using 'BDC_CURSOR'
'ESLL-MENGE(01)'.
perform bdc_field using 'ESLL-SRVPOS(01)'
ITAB_PROGRAM-SRVPOS.
perform bdc_field using 'ESLL-MENGE(01)'
ITAB_PROGRAM-MENGE.
perform bdc_dynpro using 'SAPLMLSP' '0201'.
perform bdc_field using 'BDC_OKCODE'
'=SAV'.
perform bdc_field using 'BDC_SUBSCR'
'SAPLMLSP'.
perform bdc_transaction using 'ML10'.
endform. " UPLOAD_programs
can any body help me in this regard.
thanks in advance
sivaLoop at itab_program.
< Here will be your BDC Program>
call transaction..... .
endloop.
and all the records in you internal table itab_program will get updated...
Regards.
Jayant
<b>Please award if helpful</b> -
Select query in case of Multiple line items
Hi Gurus ,
I've a doubt in general SQL select query. I want to know , if suppose I've an internal table - itab . I've fetched G/L Account numbers 1st, based on the input selections . Next , I want to loop on those G/L accounts. However, if the G/L account has multiple line items, then I personally use this select query -- >
loop at itab.
select <field> from <table> appending corresponding fields of <itab1> where hkont eq itab-hkont.
endloop.
Now, the execution time for this query is longer than expected. The biggest problem here is, i've to sum up the totals as well. So totaling is an added load. I want to reduce the execution time of this. Kindly suggest me some good method in case u have any.
I've pasted the code which I've written , for u ppl to understand--
SELECT DISTINCT HKONT BELNR
FROM BSIS
INTO CORRESPONDING FIELDS OF TABLE OTAB
WHERE HKONT IN S_RACCT
* AND PRCTR IN P_PRCTR
AND MONAT IN S_POPER
AND BUKRS EQ P_BUKRS
AND GJAHR EQ P_GJAHR
AND PRCTR IN S_PRCTR.
***The code below takes a lot of time to execute.***
LOOP AT OTAB .
SELECT DMBTR HKONT
FROM BSIS APPENDING CORRESPONDING FIELDS OF TABLE CREDITS
WHERE HKONT EQ OTAB-HKONT
AND BELNR EQ OTAB-BELNR
AND MONAT IN S_POPER
AND BUKRS EQ P_BUKRS
AND GJAHR EQ P_GJAHR
AND PRCTR IN S_PRCTR
AND SHKZG EQ 'H'.
COLLECT CREDITS.
ENDLOOP.Hi,
First of all try to avoid doing select into corresponding fields. THis would improve the performance of the program.
Try to do a single fetch from the BSIS table . fetch the hkont, belnr, dmbtr fields in to a master internal table. Manipulate and play with the data as required. Don't hit the data base table more than once (unless it is required) . This would improve the performance of your code.
Try to code this way.
types: begin of ty_bsis,
hkont type hkont,
belnr type belnr_d,
dmbtr type dmbtr,
end of ty_bsis.
data: it_bsis type standard table of ty_bsis,
wa_bsis type ty_bsis,
select hkont belnr dmbtr
from bsis
into table it_bsis
WHERE HKONT IN S_RACCT
AND PRCTR IN P_PRCTR
AND MONAT IN S_POPER
AND BUKRS EQ P_BUKRS
AND GJAHR EQ P_GJAHR
AND PRCTR IN S_PRCTR.
Using the data availabe in the it_bsis, you can manipulate as required.
Hope this would be helpful
Regards
Ramesh Sundaram
Maybe you are looking for
-
2 Dimensions and a Fact - Join Paths
I have a scenario and I have been racking my brains out as to if what I am looking for could be set up. I have two dimenisions - Region and System - each System belongs to a Region. So the System Dimenison contains a Region_Key. I have a Fact table t
-
Hi, The export command failure in Oracle 10g windows, How to resolve the prblem? D:\oracle\product\10.1.0\admin>expdp scott/tiger@orcl1 schemas=SCOTT directory=TEST dumpfile=Test.DMP logfile=Test.log Export: Release 10.1.0.2.0 - Production on Tuesday
-
First Mac-need help with an "event"
Hi: After 3 days of busy activity with no freeze ups, I was feeling pretty confident. However, late last night I ran into an "event" that eventually required me to reload Tiger. (1) I was working along and for some reason, clicking my mouse di
-
Extra Blank Line gets added at the Beginning of the file by File Adapter...
Hello All, I have created an RFC to File Adapter scenario in PI 7,1 and I am using Content Conversion in the File Adapter to convert the payload structure to flat text file. The input Structure is simple as follows: <File> <FName>some file name</Fnam
-
DataInputStream twice on the same InputSrteam
The code below throws en exception: import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; public class TwiceDataInputStream { public static void main(String[] args) throws IOException {