Splitting a TO into Multiple Line Items
Hi,
I have a requirement like this.
TR-100 pc and TO created automatically for 100 pc. Now I want to break the TO into 3 line items for 40, 30, 30 pc. Is there a way to achieve this?
Thanks
Venkat
If the TR is manual, then maintain the required lines within the TR. Alternatively as Joao has siad, you can look at the TO split functionality however, this will create a new TO for each, rather than adding a new line.
Cheers
Similar Messages
-
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 -
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 -
Issue with splitting string into multiple lines
Hi Experts,
I have a long string s. I want to split this string into several lines each having 72 characters. For this I have done following programming:
String s = "For the first time it includes a supplementary report attempting to determine if extreme weather
events can be linked to human-induced climate change. The research team, including members
of the UK Met Office, identified recent episodes of extreme weather then used a computer to
estimate the likelihood of the episode happening in a world without increased CO2." ;
s = s.replaceAll("[\r\n]+", " ");
char[] sAr = s.toCharArray();
AbstractList RecepitsList7 = new Bapitrtext.Bapitrtext_List();;
int start = 0; // start with
int i = 72 ;
// for (int i = 71; i < sAr.length; i++) {
while (i < sAr.length) {
// { if (sAr[i] == ' ')
Bapitrtext Recepits7 = new Bapitrtext();
Recepits7.setTextid("TEXT");
Recepits7.setTextline(s.substring(start, i).replaceAll("[\r\n]+", ""));
RecepitsList7.add(Recepits7);
start = i+1;
i += 72;
input.setText(RecepitsList7);
The output of program is as below:
For the first time it includes a supplementary report attempting to dete
mine if extreme weather events can be linked to human-induced climate
hange. The research team, including members of the UK Met Office, iden
ified recent episodes of extreme weather then used a computer to estim
te the likelihood of the episode happening in a world without increased
Here as we can see last characters are getting deleted by program. For example in first line
determine 'r' is missing in extreme right.
In 3rd line c is missing in extreme left (word change is needed. Program
prints hange.
Also in 3rd line extreme right 't' is missing
Also in 4th line extreme right 'a' is missing
Also the last line is not being printed. In last line "CO2." " should appear.
There are two issues:
1. Why last word of each sentence is not being printed?
2. Why last sentence is not being printed?
I am struggling since last 2 days. Please help. I made all changes like replacing 72 by 71 etc.
By making such changes, I am able to print first line correctly. However under all cases
last character of 2nd line onward is not getting displayed.
Also last line is not getting displayed. I did every thing like using while instead of for loop etc.
Kindly help.
Regards,
Gary
Edited by: 945655 on Jul 10, 2012 11:39 PMString s = wdContext.currentContextElement().getExpense_Text();
s = s.replaceAll("[\r\n]+", " ");
char[] sAr = s.toCharArray();
AbstractList RecepitsList7 = new Bapitrtext.Bapitrtext_List();;
int start = 0; // start with
int i = 72;
while (i < sAr.length) {
Bapitrtext Recepits7 = new Bapitrtext();
Recepits7.setTextid("TEXT");
System.out.println(s.substring(start, i));
RecepitsList7.add(Recepits7);
start = i+1;
i += 72;
input.setText(RecepitsList7);
Edited by: 945655 on Jul 11, 2012 2:25 AM -
Mapping of Multiple Line Items
Hello All,
While trying to post a purchase order creation into R/3, there are several line items in the purchase order. Each has different quantity, GL account, cost center and unit price. So how should I map it to the target field.
Occurence of order detail
order detail 0..1
list of item details 1..1
Item detail 1..unbounded
base item detail 1..1
line item number 1..1
buyer line item num 1..1
So occurence of buyer line item number is not unbounded. so how can I duplicate this buyer line item number?
For example, In the XML source message I have 5 line items.....
for line item one, I have quantity A, GL account B, cost center C and unit price D,
for line item two, I have line item X, Quantity Y, GL account Z, Cost center M and unit price N, etc
When I am trying to map I am able to pick only the first line item. Can anyone throw some light on how I should map all the line items data?
If anyone can help me with mapping of this. A bit in detail please
Regards,
Neelima
CSCHi Neelima,
Check out this blog....
/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool ( with PO only)
Multiple line items are generated basically using Context.
Hope this will help.
Let me know if you need more details.
Nilesh -
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.... -
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 -
BDC to create SO(VA01) for multiple line items
Hi all,
My requirement is to create SO for multiple line items in ECC6.0
My recording for VA01 is like this.
start-of-selection.
perform open_group.
perform bdc_dynpro using 'SAPMV45A' '0101'.
perform bdc_field using 'BDC_CURSOR'
'VBAK-AUART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBAK-AUART'
'ZOR'.
perform bdc_field using 'VBAK-VKORG'
'2000'.
perform bdc_field using 'VBAK-VTWEG'
'10'.
perform bdc_field using 'VBAK-SPART'
'05'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBKD-BSTKD'
'open SO'.
perform bdc_field using 'VBKD-BSTDK'
'29.01.2008'.
perform bdc_field using 'KUAGV-KUNNR'
'100000'.
perform bdc_field using 'KUWEV-KUNNR'
'100000'.
perform bdc_field using 'RV45A-KETDAT'
'29.01.2008'.
perform bdc_field using 'RV45A-KPRGBZ'
'D'.
perform bdc_field using 'VBKD-PRSDT'
'29.01.2008'.
perform bdc_field using 'BDC_CURSOR'
'VBAP-WERKS(01)'.
perform bdc_field using 'RV45A-MABNR(01)'
'hrpocf'.
perform bdc_field using 'VBAP-POSNR(01)'
' 10'.
perform bdc_field using 'RV45A-KWMENG(01)'
' 55'.
perform bdc_field using 'VBAP-WERKS(01)'
'2010'.
perform bdc_dynpro using 'SAPLCEI0' '0109'.
perform bdc_field using 'BDC_CURSOR'
'RCTMS-MWERT(06)'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_field using 'RCTMS-MNAME(01)'
'A_THICK_MM'.
perform bdc_field using 'RCTMS-MNAME(02)'
'A_WIDTH_MM'.
perform bdc_field using 'RCTMS-MNAME(03)'
'A_EQUIVALENT_SPEC'.
perform bdc_field using 'RCTMS-MNAME(04)'
'A_BATCH_WEIGHT_MAX_SI'.
perform bdc_field using 'RCTMS-MNAME(05)'
'A_BATCH_WEIGHT_MIN_SI'.
perform bdc_field using 'RCTMS-MNAME(06)'
'A_COIL_INNER_DIA_MM'.
perform bdc_field using 'RCTMS-MWERT(01)'
'3.2'.
perform bdc_field using 'RCTMS-MWERT(02)'
'1200'.
perform bdc_field using 'RCTMS-MWERT(03)'
'IS_11513_GR_D_1985'.
perform bdc_field using 'RCTMS-MWERT(04)'
'26.4'.
perform bdc_field using 'RCTMS-MWERT(05)'
'26.4'.
perform bdc_field using 'RCTMS-MWERT(06)'
'610'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBKD-BSTKD'
'open SO'.
perform bdc_field using 'VBKD-BSTDK'
'29.01.2008'.
perform bdc_field using 'KUAGV-KUNNR'
'100000'.
perform bdc_field using 'KUWEV-KUNNR'
'100000'.
perform bdc_field using 'RV45A-KETDAT'
'29.01.2008'.
perform bdc_field using 'RV45A-KPRGBZ'
'D'.
perform bdc_field using 'VBKD-PRSDT'
'29.01.2008'.
perform bdc_field using 'VBKD-INCO1'
'EXW'.
perform bdc_field using 'VBKD-INCO2'
'mumbai east'.
perform bdc_field using 'VBKD-ZTERM'
'0001'.
perform bdc_field using 'BDC_CURSOR'
'VBAP-WERKS(02)'.
perform bdc_field using 'RV45A-MABNR(02)'
'hrpocf'.
perform bdc_field using 'VBAP-POSNR(02)'
' 11'.
perform bdc_field using 'RV45A-KWMENG(02)'
' 66'.
perform bdc_field using 'VBAP-WERKS(02)'
'2010'.
perform bdc_dynpro using 'SAPLCEI0' '0109'.
perform bdc_field using 'BDC_CURSOR'
'RCTMS-MWERT(06)'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_field using 'RCTMS-MNAME(01)'
'A_THICK_MM'.
perform bdc_field using 'RCTMS-MNAME(02)'
'A_WIDTH_MM'.
perform bdc_field using 'RCTMS-MNAME(03)'
'A_EQUIVALENT_SPEC'.
perform bdc_field using 'RCTMS-MNAME(04)'
'A_BATCH_WEIGHT_MAX_SI'.
perform bdc_field using 'RCTMS-MNAME(05)'
'A_BATCH_WEIGHT_MIN_SI'.
perform bdc_field using 'RCTMS-MNAME(06)'
'A_COIL_INNER_DIA_MM'.
perform bdc_field using 'RCTMS-MWERT(01)'
'3.1'.
perform bdc_field using 'RCTMS-MWERT(02)'
'1250'.
perform bdc_field using 'RCTMS-MWERT(03)'
'IS_11513_GR_D_1985'.
perform bdc_field using 'RCTMS-MWERT(04)'
'20.084'.
perform bdc_field using 'RCTMS-MWERT(05)'
'20.084'.
perform bdc_field using 'RCTMS-MWERT(06)'
'610'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=PDE3'.
perform bdc_field using 'VBKD-BSTKD'
'open SO'.
perform bdc_field using 'VBKD-BSTDK'
'29.01.2008'.
perform bdc_field using 'KUAGV-KUNNR'
'100000'.
perform bdc_field using 'KUWEV-KUNNR'
'100000'.
perform bdc_field using 'RV45A-KETDAT'
'29.01.2008'.
perform bdc_field using 'RV45A-KPRGBZ'
'D'.
perform bdc_field using 'VBKD-PRSDT'
'29.01.2008'.
perform bdc_field using 'VBKD-INCO1'
'EXW'.
perform bdc_field using 'VBKD-INCO2'
'mumbai east'.
perform bdc_field using 'VBKD-ZTERM'
'0001'.
perform bdc_field using 'BDC_CURSOR'
'VBAP-POSNR(01)'.
perform bdc_field using 'RV45A-VBAP_SELKZ(01)'
'X'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=T\09'.
perform bdc_field using 'BDC_CURSOR'
'VBKD-INCO2'.
perform bdc_field using 'VBKD-INCO1'
'EXW'.
perform bdc_field using 'VBKD-INCO2'
'mumbai'.
perform bdc_field using 'VBKD-ZTERM'
'0001'.
perform bdc_field using 'VBKD-FKDAT'
'29.01.2008'.
perform bdc_field using 'VBAP-TAXM1'
'1'.
perform bdc_field using 'VBAP-TAXM2'
'1'.
perform bdc_field using 'VBAP-TAXM3'
'0'.
perform bdc_field using 'VBAP-TAXM4'
'0'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=TP_DELETE'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=TP_CREATE'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=TP_DETAIL'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPLSTXX' '1100'.
perform bdc_field using 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
perform bdc_field using 'BDC_OKCODE'
'=TXVB'.
perform bdc_field using 'RSTXT-TXLINE(02)'
'FDGFDG'.
perform bdc_dynpro using 'SAPLSTXX' '1100'.
perform bdc_field using 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
perform bdc_field using 'BDC_OKCODE'
'=TXBA'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=T\10'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'VBKD-POSEX_E'.
perform bdc_field using 'VBKD-BSTKD'
'open SO'.
perform bdc_field using 'VBKD-BSTDK'
'29.01.2008'.
perform bdc_field using 'VBAP-POSEX'
'108128'.
perform bdc_field using 'VBKD-BSTKD_E'
'3011192'.
perform bdc_field using 'VBKD-POSEX_E'
'000005'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=PDE3'.
perform bdc_field using 'VBKD-BSTKD'
'open SO'.
perform bdc_field using 'VBKD-BSTDK'
'29.01.2008'.
perform bdc_field using 'KUAGV-KUNNR'
'100000'.
perform bdc_field using 'KUWEV-KUNNR'
'100000'.
perform bdc_field using 'RV45A-KETDAT'
'29.01.2008'.
perform bdc_field using 'RV45A-KPRGBZ'
'D'.
perform bdc_field using 'VBKD-PRSDT'
'29.01.2008'.
perform bdc_field using 'VBKD-INCO1'
'EXW'.
perform bdc_field using 'VBKD-INCO2'
'mumbai east'.
perform bdc_field using 'VBKD-ZTERM'
'0001'.
perform bdc_field using 'BDC_CURSOR'
'VBAP-POSNR(02)'.
perform bdc_field using 'RV45A-VBAP_SELKZ(02)'
'X'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=T\09'.
perform bdc_field using 'BDC_CURSOR'
'VBKD-INCO2'.
perform bdc_field using 'VBKD-INCO1'
'EXW'.
perform bdc_field using 'VBKD-INCO2'
'mumbai'.
perform bdc_field using 'VBKD-ZTERM'
'0001'.
perform bdc_field using 'VBKD-FKDAT'
'29.01.2008'.
perform bdc_field using 'VBAP-TAXM1'
'1'.
perform bdc_field using 'VBAP-TAXM2'
'1'.
perform bdc_field using 'VBAP-TAXM3'
'0'.
perform bdc_field using 'VBAP-TAXM4'
'0'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=TP_DELETE'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=TP_CREATE'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=TP_DETAIL'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPLSTXX' '1100'.
perform bdc_field using 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
perform bdc_field using 'BDC_OKCODE'
'=TXVB'.
perform bdc_field using 'RSTXT-TXLINE(02)'
'GFGFDG'.
perform bdc_dynpro using 'SAPLSTXX' '1100'.
perform bdc_field using 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
perform bdc_field using 'BDC_OKCODE'
'=TXBA'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=T\10'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'VBKD-POSEX_E'.
perform bdc_field using 'VBKD-BSTKD'
'open SO'.
perform bdc_field using 'VBKD-BSTDK'
'29.01.2008'.
perform bdc_field using 'VBAP-POSEX'
'108128'.
perform bdc_field using 'VBKD-BSTKD_E'
'3011192'.
perform bdc_field using 'VBKD-POSEX_E'
'000005'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'VBAP-POSEX'.
perform bdc_field using 'VBKD-BSTKD'
'open SO'.
perform bdc_field using 'VBKD-BSTDK'
'29.01.2008'.
perform bdc_field using 'VBAP-POSEX'
'108128'.
perform bdc_field using 'VBKD-BSTKD_E'
'3011192'.
perform bdc_field using 'VBKD-POSEX_E'
'5'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=KKAU'.
perform bdc_field using 'VBKD-BSTKD'
'open SO'.
perform bdc_field using 'VBKD-BSTDK'
'29.01.2008'.
perform bdc_field using 'KUAGV-KUNNR'
'100000'.
perform bdc_field using 'KUWEV-KUNNR'
'100000'.
perform bdc_field using 'RV45A-KETDAT'
'29.01.2008'.
perform bdc_field using 'RV45A-KPRGBZ'
'D'.
perform bdc_field using 'VBKD-PRSDT'
'29.01.2008'.
perform bdc_field using 'VBKD-INCO1'
'EXW'.
perform bdc_field using 'VBKD-INCO2'
'mumbai east'.
perform bdc_field using 'VBKD-ZTERM'
'0001'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-MABNR(01)'.
perform bdc_dynpro using 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'=T\02'.
perform bdc_field using 'BDC_CURSOR'
'VBKD-KONDA'.
perform bdc_field using 'VBAK-AUDAT'
'29.01.2008'.
perform bdc_field using 'VBAK-VKBUR'
'IN15'.
perform bdc_field using 'VBAK-WAERK'
'INR'.
perform bdc_field using 'VBKD-PRSDT'
'29.01.2008'.
perform bdc_field using 'VBKD-KDGRP'
'CF'.
perform bdc_field using 'VBKD-PLTYP'
'01'.
perform bdc_field using 'VBKD-KONDA'
'01'.
perform bdc_field using 'VBKD-BZIRK'
'NORTH'.
perform bdc_dynpro using 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'=T\03'.
perform bdc_field using 'BDC_CURSOR'
'VBKD-VSART'.
perform bdc_field using 'VBAK-VSBED'
'01'.
perform bdc_field using 'VBKD-KZAZU'
'X'.
perform bdc_field using 'VBKD-VSART'
'ER'.
perform bdc_dynpro using 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'=T\05'.
perform bdc_field using 'BDC_CURSOR'
'VBKD-INCO2'.
perform bdc_field using 'VBKD-INCO1'
'EXW'.
perform bdc_field using 'VBKD-INCO2'
'mumbai'.
perform bdc_field using 'VBKD-ZTERM'
'0001'.
perform bdc_field using 'VBKD-FKDAT'
'29.01.2008'.
perform bdc_field using 'VBAK-TAXK1'
'1'.
perform bdc_field using 'VBAK-TAXK3'
'l'.
perform bdc_dynpro using 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'=T\09'.
perform bdc_field using 'BDC_CURSOR'
'VBKD-ZLSCH'.
perform bdc_field using 'VBKD-KTGRD'
'01'.
perform bdc_field using 'VBKD-ZLSCH'
'c'.
perform bdc_dynpro using 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'=TP_DELETE'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'=TP_CREATE'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'=TP_DETAIL'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPLSTXX' '1100'.
perform bdc_field using 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
perform bdc_field using 'BDC_OKCODE'
'=TXVB'.
perform bdc_field using 'RSTXT-TXLINE(02)'
'BDFBFDB'.
perform bdc_dynpro using 'SAPLSTXX' '1100'.
perform bdc_field using 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
perform bdc_field using 'BDC_OKCODE'
'=TXBA'.
perform bdc_dynpro using 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'=T\11'.
perform bdc_dynpro using 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'=KSTC'.
perform bdc_dynpro using 'SAPLBSVA' '0300'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'J_STMAINT-ANWS(02)'.
perform bdc_field using 'J_STMAINT-ANWS(01)'
perform bdc_field using 'J_STMAINT-ANWS(02)'
'X'.
perform bdc_dynpro using 'SAPLBSVA' '0300'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'J_STMAINT-ANWS(03)'.
perform bdc_field using 'J_STMAINT-ANWS(02)'
perform bdc_field using 'J_STMAINT-ANWS(03)'
'X'.
perform bdc_dynpro using 'SAPLBSVA' '0300'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'J_STMAINT-ANWS(04)'.
perform bdc_field using 'J_STMAINT-ANWS(03)'
perform bdc_field using 'J_STMAINT-ANWS(04)'
'X'.
perform bdc_dynpro using 'SAPLBSVA' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_field using 'BDC_CURSOR'
'JOSTD-OBJNR'.
perform bdc_dynpro using 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-TXT_VBELN'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_field using 'VBKD-BSTKD'
'open SO'.
perform bdc_field using 'VBKD-BSTDK'
'29.01.2008'.
perform bdc_field using 'KUAGV-KUNNR'
'100000'.
perform bdc_field using 'KUWEV-KUNNR'
'100000'.
perform bdc_field using 'RV45A-KETDAT'
'29.01.2008'.
perform bdc_field using 'RV45A-KPRGBZ'
'D'.
perform bdc_field using 'VBKD-PRSDT'
'29.01.2008'.
perform bdc_field using 'VBKD-INCO1'
'EXW'.
perform bdc_field using 'VBKD-INCO2'
'mumbai'.
perform bdc_field using 'VBKD-ZTERM'
'0001'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-MABNR(01)'.
perform bdc_transaction using 'VA01'.
perform close_group.
if in excel file one row of records means i am succesfully creating SO.
But for multiple i am not getting idea to create SO.
My excel file details like this.In this excel file based on VBKD-BSTKD_E value i have to keep the records in line items.
VBAK-AUART :Order Type
VBAK-VKORG : Sales Org
VBAK-VTWEG : Distri Channel
VBAK-SPART : Division
VBAK-KUNNR : Sold-to-Party
VBPA-KUNNAR : Ship-to-Party
VBAK-BSTNK : PO No
VBAK-BSTDK : PO Date
VBAP-MATNR : Material No
A_THICK_MM
A_WIDTH_MM
A_EQUIVALENT_SPEC
A_COIL_INNER_DIA_MM
A_BATCH_WEIGHT_MIN_SI
A_BATCH_WEIGHT_MAX_SI
VBAP-KWMENG : Qty
VBAP-WERKS : Delivery Plant
VBKD-INCO2 : Incoterm2
VBKD-KONDA : Price Group
VBKD-VSART : Shipping Type
VBAK-TAXK1 : Cust Tax-1
VBAK-TAXK2 : Cust Tax-2
VBAK-TAXK3 : Cust Tax-3
VBAK-TAXK4 : Cust Tax-4
VBKD-ZLSCH : Payment Method
VBAP-TAXM1 : Mat tax clss-1
VBAP-TAXM2 : Mat tax clss-2
VBAP-TAXM3 : Mat tax clss-3
VBAP-TAXM4 : Mat tax clss-4
VBAP-POSEX : IMPS Order No
VBKD-BSTKD_E : old SO in 4.6c
VBKD-POSEX_E : old SO Item in 4.6c
Text Id : TDC No
Text Id-ES10 : Special Inst(Unld const & Veh)
ZOR,2000,10,5,100000,100000,PO NO 125,19.01.2008,HRPOCF,3.1,1200,IS_11513_GR_D_1985,610,20.084,20.084
51,2010,Mumbai,01Freight-pre paid,ER,2,0,L,0,c,1,1,0,0,108128,3011192, 1,PO 444 AMD 1,Spl Inst
based on VBKD-BSTKD_E line items has to create.
if VBKD-BSTKD_E = 3011192 is like 4 records in excel means for these 4 should be one SO
if it is changed to 3011193 then only different SO.
PLs If any one knows solution pls write some sample code for me.
If u send that code to my mail id also very thankful.
[email protected]
Pls help me this is urgent requirement.
Thanks & Regards,
J.LokeshHI,
Instead of using BDC , why dont you make use of BAPI.
As you are on ECC, you can make use of BAPI BAPI_SALESORDER_CREATEFROMDAT2
Collect all your records based on PO # and pass them into line item table structure ORDER_ITEMS_IN.
*--Logic something like this.
loop at it_exceldata into l_line.
loop at it_exceldata into l_so where bstkd_e eq l_line-bstkd.
*This will loop at all the same PO#
*collect the data related into corr tables. and append
endloop.
*Now you are outside the loop.
*Call the BAPI to update this SO
delete it_exceldata where bstkd_e eq l_line-bstkd_e.
endloop.
Also pass all the necessary data to header structure ORDER_HEADER_IN
Do not check for Sy-subrc at the end of execution.
Instead read the Return table with message type 'A' or 'E whichi means there is an error/abort in BAPI execution.
Remember to expicitly COMMIT_WORK after succesfull execution of BAPI using BAPI_TRANSACTION_COMMIT
Please let me know , if you need more help in this
Gary. -
BDC for multiple line items (VA01)
Hi Experts,
I create a BDC for VA01 transaction for single line item in that now i want to upload multiple line items also with o/p of total no. of records uploaded, no. of records posted and the no. of error records...
Can any body explain with sample code...Hi,
if the flat file is containing header and item records...
first split those records tooo two internal tables header and item..
Loop at header ...
process of recording steps for header....
Loop at item...
here create a varialbe with char 2 .. for index value....
process of item recording steps..
increment the index value by 1....
here u have to pass 'p+' OK_CODE..
Endloop ..(item)
Endloop...(header)
for more info goo through this link...
http://www.sap-img.com/bdc.htm
hope helpful
Raghunath.S -
1 line item in invoice for Multiple line items of SO
Hi SD Gurus,
My client requirement is multiple line items of the sales order should reflect as a single line item in the invoice ..?
For ex: I am using Service material type Dien & material created under different material groups.
My Sales order looks somthing like below with material no & amount:
10 Testing charges 10$ material group xx1
20 Baking charges 20$ material group xx2
30 Scan/Taping 20$ matierial group xx1
Now in the invoice its should reflect only with 1 line item with the whole amount 50$.
Kinldy let me know how this requriement can be fullfilled.
Thanks,
RahulDear Rahul
I think you can apply Rate Routing for this.
A rate routing is a routing for repetitive manufacturing. It enables you to easily reproduce the lean production process.
In the rate routing, the production rate per operation is defined (production time according to a base quantity). Set-up time is not usually defined, since no changes to setup are planned.
However, you can also use standard routings. A standard routing represents the various steps of production (such as setup, processing, teardown and so on), operation by operation, if necessary with suboperations.
A rate routing does, however, offer all the same functions as a standard routing.
<b>Structure</b>
If you use the same standard value key for all the work centers on the line, the system copies the descriptions of the standard values to the routing as the column headings of the operation overview.
If you use different standard value keys for the work centers, the system copies the descriptions into the routing that is entered in the control data for the routing in Customizing.
To create a Rate Routing, follow the steps as under:-
1) Starting from the main Line Design menu, choose Rate routing --> Create.
The system displays the initial screen for rate routings.
2) Enter the plant, the material and in the field Group, the group to which you want to assign the rate routing.
3) Choose Enter.
The system displays the screen Header details.
4) Enter the following data:
=> the routing description
=> the plant
=> the usage of the rate routing, i.e.production
=> the status, i.e. released
=> the unit of measure of the materials to be produced
5) Save your rate routing.
<b>Result</b>
You have created the rate routing. Continue creating the main production line and if necessary, feeder lines.
You can also take the help of your PP guy for this.
Thanks
G. Lakshmipathi -
"BDC for multiple line items of PO"
I am using this code to move data for multiple line items of a PO. But only one is getting transferred. I am using BDC for this.
FORM transaction_bdc .
DATA :
v_cnt(2) TYPE n,
v_bst(2) TYPE n,
v_bn TYPE i,
v_bstpo(25),
v_ebtyp(25),
v_menge(25),
v_eeind(25),
v_xblnr(25),
v_xblnr1(25),
v_ebelp(2) TYPE n,
v_ebelpt(2),
v_menge1(11),
v_ebt TYPE i,
v_vebtyp LIKE ekes-ebtyp,
v_eb(2) TYPE n,
v_tcselflag(40),
v_tem(2) TYPE n,
v_correct TYPE i,
v_file TYPE string.
DATA: ls_outtab TYPE tb_struc.
DATA: l_valid TYPE c,
l_locked TYPE c.
CALL METHOD g_grid->check_changed_data
IMPORTING
e_valid = l_valid.
IF l_valid EQ 'X'.
LOOP AT tb_output WHERE check EQ 'X' .
MOVE-CORRESPONDING tb_output TO itab_output.
APPEND itab_output.
CLEAR itab_output.
ENDLOOP.
IF tb_output-check <> 'X'.
MESSAGE e003 WITH text-004.
ENDIF.
ENDIF.
IF itab_output[] IS NOT INITIAL.
PERFORM open_group.
***looping at purchase order level.
LOOP AT itab_output where ebelp is not initial .
CLEAR v_bn.
CLEAR v_ebt.
PERFORM bdc_dynpro USING 'SAPMM06E' '0105'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06E-BSTNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RM06E-BSTNR'
itab_output-ebeln.
***Changing alphanumeric fields and quantity fields to character type**
*v_ebelp = tB_OUTPUT-ebelp.
*clear v_ebelpt.
*v_menge1 = tB_OUTPUT-menge.
*v_ebelpt = v_ebelp.
***End Of Changing**
*Checking for the exact number of the item**
LOOP AT tb_output where ebeln = itab_output-ebeln.
READ TABLE itab_output INDEX 1.
IF tb_output-ebelp = itab_output-ebelp.
exit.
ELSE.
v_bn = v_bn + 1.
ENDIF.
ENDLOOP.
v_bst = v_bn + 1.
*End Of Checking**
**Mapping items**
v_tem = 1.
CONCATENATE 'RM06E-BSTPO(' v_bst ')' INTO v_bstpo.
CONCATENATE 'RM06E-TCSELFLAG(' v_tem ')' INTO v_tcselflag.
PERFORM bdc_dynpro USING 'SAPMM06E' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_bstpo.
PERFORM bdc_field USING 'BDC_OKCODE'
'=DETA'.
PERFORM bdc_field USING 'RM06E-EBELP'
v_ebelpt.
PERFORM bdc_dynpro USING 'SAPMM06E' '0111'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EKPO-BSTAE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMM06E' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_bstpo.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BSTA'.
PERFORM bdc_field USING 'RM06E-EBELP'
v_ebelpt.
PERFORM bdc_field USING v_tcselflag
'X'.
**Checking weather Confirmation category already exists**
SELECT ebtyp FROM ekes INTO v_vebtyp WHERE ebelp =
itab_output-ebelp AND ebeln = itab_output-ebeln.
ENDSELECT.
IF sy-dbcnt > 0.
v_ebt = sy-dbcnt.
ENDIF.
v_eb = v_ebt + 1.
**End Of Checking**
**For Line items**
CONCATENATE 'EKES-EBTYP(' v_eb ')' INTO v_ebtyp.
CONCATENATE 'EKES-MENGE(' v_eb ')' INTO v_menge.
CONCATENATE 'RM06E-EEIND(' v_eb ')' INTO v_eeind.
CONCATENATE 'EKES-XBLNR(' v_eb ')' INTO v_xblnr.
**End**
PERFORM bdc_dynpro USING 'SAPLEINB' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_xblnr.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field USING v_ebtyp
itab_output-ebtyp.
PERFORM bdc_field USING v_eeind
itab_output-eindt.
PERFORM bdc_field USING v_menge
v_menge1.
PERFORM bdc_field USING v_xblnr
itab_output-xblnr.
**End Of Mappings**
*loop at itab_output.
MOVE-CORRESPONDING itab_output TO ekes.
modify ekes.
MOVE-CORRESPONDING itab_output TO eket.
MODIFY eket.
MOVE-CORRESPONDING tb_output TO ekpo.
MODIFY ekpo.
ENDLOOP.
CALL TRANSACTION 'ME22N'
USING itbdc
MODE 'E'.
commit work.
perform bdc_transaction using 'ME22N'.
**End Of Purchase Order Loop**
PERFORM close_group.
endloop.
endif.Hi Asha,
check the below code once...
LOOP AT tb_output where ebeln = itab_output-ebeln.
READ TABLE itab_output INDEX 1.
IF tb_output-ebelp = itab_output-ebelp.
exit.
ELSE.
v_bn = v_bn + 1.
ENDIF.
ENDLOOP.
Here you are reading the table itab_output with index 1, it means you alway reading the first record of that internal table.
Regards,
Satya. -
BAPI_SALESORDER_CREATEFROMDAT2 Multiple Line Items
Hi
How do I implement BAPI_SALESORDER_CREATEFROMDAT2 for multiple line items.
I am currently doing this to create a new SO:
loop at it_item into wa_item where group = wa_head-group.
add 10 to lv_item.
lw_item-itm_number = lv_item.
lw_item-material = wa_item-itemupc.
append lw_item to lt_item.
lw_schdl-itm_number = lv_item.
lw_schdl-sched_line = 1.
lw_schdl-req_date = sy-datum.
lw_schdl-req_qty = wa_item-itemqty.
append lw_schdl to lt_schdl.
endloop.
It's giving a message:
E |V4 |224 |Missing item number when you changed the <
Thanks!Here's part of the code the fills the BAPI tables
lw_head-doc_type = pa_auart.
lw_head-sales_org = pa_vkorg.
lw_head-distr_chan = pa_vtweg.
lw_head-division = pa_spart.
lw_head-purch_no_c = pa_file.
lw_head-purch_date = wa_head-postdate.
lw_headx-updateflag = 'I'.
clear lv_item.
loop at it_item into wa_item where group = wa_head-group.
add 10 to lv_item.
lw_item-itm_number = lv_item.
lw_item-material = wa_item-itemupc.
append lw_item to lt_item.
lw_schdl-itm_number = lv_item.
lw_schdl-sched_line = 1.
lw_schdl-req_date = sy-datum.
lw_schdl-req_qty = wa_item-itemqty.
append lw_schdl to lt_schdl.
endloop.
lw_part-partn_numb = lv_kunnr.
lw_part-partn_role = 'AG'.
append lw_part to lt_part.
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
exporting
order_header_in = lw_head
order_header_inx = lw_headx
importing
salesdocument = lv_vbeln
tables
return = lt_ret
order_items_in = lt_item
order_partners = lt_part
order_schedules_in = lt_schdl. -
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 -
URGENT: Multiple line items in delivery document created for a STO
Hi Gurus,
We ar ecreating deliveries using VL10b for a STO. Teh TSO has 40 - 50 line items. But the delivery is created with one line item only an dit creates a delivery for each line item. How cna we allow the inclusion of multiple line items in delivery?
We are using delivery type NL an ditem categor is NLN.
Geratly appreciate any help in that.
Thanks,
KHANHi Gianpaolo,
Thanks for your suggestion I have 5 shedule line itmes for one material and two shedule line for another material and when i changed the material by selecting one line for each sales document no and creates the delivery it is howing three line itmes for the 1st material and line items for the second and quantities equal to the changed quantity in VL02N. and I have value "1" in field "Split per sched.line" in "user role" view of VL10E.
Kindly help.
Thanks and Regards
Tanweer -
Hi all,
I wana pass multiple line items thru bdc me21n....can any1 please help me .if u guys have some code can mail me at [email protected] will be rewarded.
my code below is not working for passing multiple items.
report y1_po_test
no standard page heading line-size 255.
tables: mara,
lfa1,
eina,
eine,
eban,
zdrgsah, zdrgsap,
zdrgsup,
t100,
ekko,
a004, zprice_grpsal, mvke.
*Internal Table to get the input Data
data: begin of i_input occurs 0,
matnr like ekpo-matnr,
asqty like ekpo-menge,
ebeln like ekpo-ebeln,
posnr(5),
posnr like zdrgsap-posnr,
invno like zdrgsap-invno,
invdt like zdrgsah-invdt,
netpr like zdrgsap-netpr,
cntno like zdrgsap-cntno,
shcnm like zdrgsah-shcnm,
apcno like zdrgsap-apcno,
spcno like zdrgsap-spcno,
werks like ekpo-werks,
lgort like ekpo-lgort,
matkl like ekpo-matkl,
pack(10),
mvgr2 like mvke-mvgr2,
dpric type p decimals 6 ,
gpric type p decimals 6,
end of i_input.
data: begin of i_inputxt occurs 0,
matnr(18) ,
asqty(13) ,
ebeln(10) ,
posnr(6) ,
invno(10) ,
invdt(8) ,
netpr(11) ,
cntno(11) ,
shcnm(10) ,
werks(4) ,
lgort(4) ,
matkl(9) ,
pack(10),
end of i_inputxt.
data: begin of i_error occurs 0,
prnum like eban-banfn,
pritm like eban-bnfpo,
inmat like mara-matnr,
prmat like mara-matnr,
asqty like zdrgsap-asqty,
prqty like eban-menge,
remak(100),
remark(255) type c,
end of i_error.
data : begin of i_error1 occurs 0,
prnum like eban-banfn,
pritm like eban-bnfpo,
asqty like zdrgsap-asqty,
prqty like eban-menge,
remak(100),
end of i_error1.
data : begin of i_zsap occurs 0,
ebeln like zdrgsap-ebeln,
posnr(5),
menge like zdrgsap-menge,
asqty like zdrgsap-asqty,
end of i_zsap.
data : v_ebeln like eket-ebeln.
data : begin of i_a004 occurs 0,
matnr like a004-matnr,
knumh like a004-knumh,
kbetr like konp-kbetr,
end of i_a004,
i_a0041 like i_a004 occurs 0 with header line.
data : begin of i_konp occurs 0,
knumh like konp-knumh,
kbetr like konp-kbetr,
konwa like konp-konwa,
end of i_konp.
data : begin of i_konp1 occurs 0,
knumh like konp-knumh,
kbetr like konp-kbetr,
konwa like konp-konwa,
end of i_konp1.
data : begin of i_netpr occurs 0,
ebeln like eket-ebeln,
ebelp like eket-ebelp,
matnr like ekpo-matnr,
menge like ekpo-menge,
netpr like ekpo-netpr,
kbetr like konp-kbetr,
end of i_netpr.
data : begin of i_grpsal occurs 0,
pcode like zprice_grpsal-pcode,
fact like zprice_grpsal-fact,
wfact like zprice_grpsal-wfact,
end of i_grpsal.
data : begin of i_domsal occurs 0,
pcode like zprice_grpsal-pcode,
fact like zprice_grpsal-fact,
wfact like zprice_grpsal-wfact,
end of i_domsal.
data : begin of i_zsap1 occurs 0,
ebeln like zdrgsap-ebeln,
posnr(5),
asqty like zdrgsap-asqty,
end of i_zsap1.
data: begin of bdcdata occurs 0.
include structure bdcdata. " Batch input: New table field
data: end of bdcdata.
messages of call transaction
data: messtab like bdcmsgcoll occurs 0 with header line.
data: i_mara type mara occurs 0 with header line,
i_eina like eina occurs 0 with header line,
i_eine like eine occurs 0 with header line.
data : begin of i_inferr occurs 0,
matnr like eina-matnr,
infnr like eina-infnr,
werks like eine-werks,
end of i_inferr.
data : begin of i_inferrc occurs 0,
matnr like eina-matnr,
end of i_inferrc.
*Data declaration.
data: v_file type string, " Variable for uploading file
v_item(5) type c, " Line item number
v_itno(2) type n,
p_wkurs like zdrgkurs-wkurs,
v_matnr(20) type c,
v_menge(20) type c,
v_banfn(20) type c,
v_bnfpo(20) type c,
v_bednr(20) type c,
v_werks(20),
p_lifnr(10) ,
v_flag,
p_lifnrtxt(10),
p_wkurstxt(9),
p_bsartxt(4),
v_posnr(5), n type i,
v_quant(13),
v_asqty(13),
v_prqty(13),
v_apcno(6),
v_spcno(4),
v_itm(11),
v_cnt type i,
v_cntno(4),
v_pack(10),
v_order(15),
v_lifnr(10),
v_invdt like sy-datum,
v_waers like ekko-waers,
v_podat like ekko-bedat,
v_docdt1 like sy-datum,
v_docdt(10),
v_fnam(132).
data : begin of i_test occurs 0,
bnfpo like eban-bnfpo,
matnr like eban-matnr,
menge like eban-menge,
bsmng like eban-bsmng,
end of i_test.
data : begin of i_mvke occurs 0,
matnr like mvke-matnr,
mvgr2 like mvke-mvgr2,
end of i_mvke.
data : begin of i_invno,
ebeln like ekko-ebeln,
angnr like ekko-angnr,
end of i_invno.
data : i_final like zinvdiff occurs 0 with header line.
Constants
constants : c_pd01 like eine-werks value 'PD01'.
*Selection Screen Declarations
selection-screen begin of block b1 with frame title text-010.
parameters: p_invno like zdrgsah-invno obligatory,
p_bsart like ekko-bsart obligatory.
selection-screen end of block b1.
start-of-selection.
To Upload the data into Internal table.
perform f_upload_data.
To Validate the input data.
perform f_check_data.
if i_error[] is not initial or i_error1[] is not initial.
To display the error message
perform f_display_errors.
else.
To create PO
perform f_process_session.
endif.
perform f_check_calc_price.
perform f_display_data.
perform f_update_zinvdiff.
*& Form f_get_filename
text
form f_get_filename.
endform. " F_get_filename
*& Form f_upload_data
form f_upload_data .
select matwa as matnr asqty ebeln posnr b~invno invdt netpr cntno
shcnm apcno spcno into table i_input
from zdrgsah as a join zdrgsap as b on
a~invno = b~invno
where b~invno eq p_invno.
select ebeln
posnr
menge
asqty
from zdrgsap into table i_zsap
where invno = p_invno.
loop at i_zsap.
concatenate i_zsap-posnr(4) '0' into v_posnr.
i_zsap1-ebeln = i_zsap-ebeln.
i_zsap1-posnr = v_posnr.
i_zsap1-asqty = i_zsap-asqty.
collect i_zsap1.
clear i_zsap1.
endloop.
delete adjacent duplicates from i_zsap comparing posnr menge .
delete adjacent duplicates from i_input comparing ebeln posnr.
loop at i_input.
p_werks = i_input-werks.
v_invdt = i_input-invdt.
call function 'CONVERT_DATE_FORMAT'
exporting
i_date = v_invdt
importing
e_calc_date = v_invdt.
if i_input-apcno is initial.
v_apcno = '0000'.
else.
v_apcno = i_input-apcno.
endif.
if i_input-spcno is initial.
v_spcno = '0000'.
else.
v_spcno = i_input-spcno.
endif.
if i_input-cntno is initial.
i_input-cntno = '0000'.
endif.
concatenate v_apcno v_spcno into i_input-pack.
concatenate v_pack v_cntno into v_order separated by '-'.
i_input-order = v_order.
clear : v_itm, v_cnt, v_cntno, v_pack, v_apcno, v_spcno, v_order.
concatenate i_input-posnr(4) '0' into v_posnr.
select single lifnr into p_lifnr from zdrgsup
where shcnm = i_input-shcnm.
v_lifnr = p_lifnr.
if sy-subrc <> 0.
message e000(zcnc) with text-002.
endif.
select single * from eban
where banfn eq i_input-ebeln
and bnfpo eq v_posnr.
if sy-subrc eq 0.
move eban-werks to i_input-werks.
move eban-lgort to i_input-lgort.
move eban-matkl to i_input-matkl.
move eban-bnfpo to i_test-bnfpo.
move eban-matnr to i_test-matnr.
move eban-menge to i_test-menge.
move eban-bsmng to i_test-bsmng.
modify i_input.
if not i_input-matnr eq i_test-matnr.
move i_input-ebeln to i_error-prnum.
move v_posnr to i_error-pritm.
move i_input-matnr to i_error-inmat.
move eban-matnr to i_error-prmat.
i_error-remak = 'Material does not match'.
append i_error.
clear i_error.
endif.
v_quant = i_test-menge - i_test-bsmng.
read table i_zsap1 with key ebeln = i_input-ebeln posnr = v_posnr.
if not i_zsap1-asqty <= v_quant.
move i_input-ebeln to i_error1-prnum.
move i_zsap1-posnr to i_error1-pritm.
move i_zsap1-asqty to i_error1-asqty.
move eban-menge to i_error1-prqty.
move v_quant to i_error1-prqty.
i_error1-remak = 'Material Quantity does not match'.
append i_error1.
clear i_error1.
endif.
select single matnr infnr from eina
into corresponding fields of i_eina
where matnr eq i_input-matnr
and lifnr eq p_lifnr.
if sy-subrc = 0.
append i_eina.
check not i_eina[] is initial.
select single * from eine
into i_eine
where infnr eq i_eina-infnr
and werks eq eban-werks.
if sy-subrc <> 0.
move i_input-matnr to i_inferr-matnr.
move i_eina-infnr to i_inferr-infnr.
move eban-werks to i_inferr-werks.
append i_inferr.
clear i_inferr.
endif.
else.
move i_input-matnr to i_inferrc-matnr.
append i_inferrc.
clear i_inferrc.
endif.
clear : i_eina, i_eine.
clear : i_zsap, i_zsap1, i_input, v_posnr,
v_quant, i_test.
endif.
endloop.
delete adjacent duplicates from i_error1 comparing prnum pritm.
perform chk_info_rec.
endform. " f_upload_data
*& Form f_check_data
form f_check_data .
if not i_input[] is initial.
select * from mara
into table i_mara
for all entries in i_input
where matnr eq i_input-matnr.
endif.
loop at i_mara.
read table i_input with key matnr = i_mara-matnr.
if sy-subrc <> 0.
write : 'Following Part Numbers are not found in MARA'.
write : / i_input-matnr.
endif.
endloop.
if i_mara[] is initial.
loop at i_input.
format color col_heading intensified off.
write : 'Following Part Numbers are not found in MARA'.
format color col_normal intensified off.
write : / i_input-matnr.
endloop.
endif.
select single wkurs into p_wkurs from zdrgkurs
where invno = p_invno.
if sy-subrc ne 0.
message e000(zcnc) with text-s11.
endif.
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = p_lifnr
importing
output = p_lifnr.
p_lifnrtxt = p_lifnr.
p_wkurstxt = p_wkurs.
p_bsartxt = p_bsart.
loop at i_input.
move-corresponding i_input to i_inputxt.
append i_inputxt.
endloop.
select single ebeln
angnr from ekko
into i_invno
where angnr = p_invno.
if sy-subrc = 0.
perform display_err.
endif.
endform. " f_check_data
*& Form f_process_session
text
form f_process_session.
v_docdt1 = sy-datum.
write v_docdt1 to v_docdt using edit mask '__.__.____'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=MEDOCTYPE'.
perform bdc_field using 'BDC_CURSOR'
'MEPO_TOPLINE-BSART'.
perform bdc_field using 'MEPO_TOPLINE-BSART'
p_bsartxt.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
p_lifnrtxt.
perform bdc_field using 'BDC_CURSOR'
'MEPO1222-BUKRS'.
perform bdc_field using 'MEPO1222-EKORG'
'SBAP'.
perform bdc_field using 'MEPO1222-EKGRP'
'PG1'.
perform bdc_field using 'MEPO1222-BUKRS'
'SBA'.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=TABHDT2'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MEPO_TOPLINE-BSART'
p_bsartxt.
perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
p_lifnrtxt.
********************conditions***************************************
perform bdc_field using 'BDC_CURSOR'
'KOMV-KSCHL(08)'.
perform bdc_field using 'KOMV-KSCHL(07)'
'zot1'.
perform bdc_field using 'KOMV-KSCHL(08)'
'zinc'.
perform bdc_field using 'KOMV-KSCHL(09)'
'ziv1'.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=V69A_KOAN'.
perform bdc_field using 'BDC_CURSOR'
'KOMV-KSCHL(01)'.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KOMV-KSCHL(02)'
'zca1'.
perform bdc_field using 'KOMV-KSCHL(03)'
'zfa1'.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=TABHDT7'.
perform bdc_field using 'BDC_CURSOR'
'KOMV-KSCHL(09)'.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MEPO1229-IHRAN'.
perform bdc_field using 'MEPO1229-ANGNR'
p_invno.
perform bdc_field using 'MEPO1229-IHRAN'
v_invdt.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=MEV4001BUTTON'.
perform bdc_field using 'BDC_CURSOR'
'MEPO1229-IHRAN'.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=MEV4000BUTTON'.
perform bdc_field using 'BDC_CURSOR'
'MEPO1229-IHRAN'.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
loop at i_inputxt.
concatenate i_inputxt-posnr(4) '0' into v_posnr.
concatenate 'MEPO1211-EMATN(' v_itno ')' into v_matnr.
concatenate 'MEPO1211-MENGE(' v_itno ')' into v_menge.
concatenate 'MEPO1211-BANFN(' v_itno ')' into v_banfn.
concatenate 'MEPO1211-BNFPO(' v_itno ')' into v_bnfpo.
concatenate 'MEPO1211-BEDNR(' v_itno ')' into v_bednr.
concatenate 'MEPO1211-WERKS(' v_itno ')' into v_werks.
v_item = v_item + 10.
endif.
v_itno = v_itno + 1.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
v_matnr.
perform bdc_field using v_matnr "'MEPO1211-EMATN(01)'
i_inputxt-matnr.
perform bdc_field using v_menge "'MEPO1211-MENGE(01)'
i_inputxt-asqty.
perform bdc_field using v_banfn "'MEPO1211-BANFN(01)'
i_inputxt-ebeln.
perform bdc_field using v_bnfpo "'MEPO1211-BNFPO(01)'
i_inputxt-posnr.
perform bdc_field using 'DYN_6000-LIST'
v_itno.
loop at i_inputxt .
v_itno = sy-tabix.
clear v_fnam.
concatenate 'MEPO1211-EMATN(' v_itno ')' into v_fnam.
perform bdc_field using v_fnam
i_inputxt-matnr.
clear v_fnam.
concatenate 'MEPO1211-MENGE(' v_itno ')' into v_fnam.
perform bdc_field using v_fnam
i_inputxt-asqty.
clear v_fnam.
concatenate 'MEPO1211-BANFN(' v_itno ')' into v_fnam.
perform bdc_field using v_fnam
i_inputxt-ebeln.
clear v_fnam.
concatenate 'MEPO1211-BNFPO(' v_itno ')' into v_fnam.
perform bdc_field using v_fnam
i_inputxt-posnr.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
endloop.
loop at i_inputxt from 6.
v_itno = sy-tabix.
clear v_fnam.
concatenate 'MEPO1211-EMATN(' v_itno ')' into v_fnam.
perform bdc_field using v_fnam
i_inputxt-matnr.
clear v_fnam.
concatenate 'MEPO1211-MENGE(' v_itno ')' into v_fnam.
perform bdc_field using v_fnam
i_inputxt-asqty.
clear v_fnam.
concatenate 'MEPO1211-BANFN(' v_itno ')' into v_fnam.
perform bdc_field using v_fnam
i_inputxt-ebeln.
clear v_fnam.
concatenate 'MEPO1211-BNFPO(' v_itno ')' into v_fnam.
perform bdc_field using v_fnam
i_inputxt-posnr.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
endloop.
perform bdc_field using 'BDC_CURSOR'
'MEPO1320-SLFDT(01)'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=TABHDT2'.
perform bdc_field using 'DYN_6000-LIST'
' 2'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=V69A_KOAK'.
perform bdc_field using 'BDC_CURSOR'
'KOMV-KBETR(05)'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=MECHECKDOC'.
perform bdc_field using 'BDC_CURSOR'
'KOMV-KSCHL(01)'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_CURSOR'
'04/03'.
perform bdc_field using 'BDC_OKCODE'
'=&ONT'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=MEV4000BUTTON'.
perform bdc_field using 'BDC_CURSOR'
'MEPO_TOPLINE-BSART'.
perform bdc_field using 'DYN_6000-LIST'
' 2'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'KOMV-KBETR(08)'.
perform bdc_field using 'KOMV-KBETR(03)'
' .54'.
perform bdc_field using 'KOMV-KBETR(08)'
' .54'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=MESAVE'.
perform bdc_field using 'BDC_CURSOR'
'MEPO1211-NETPR(01)'.
perform bdc_transaction using 'ME21N'.
endform. "f_process_session
*& Form bdc_transaction
text
-->P_0464 text
form bdc_transaction using tcode.
data: l_mstring(480).
data: l_subrc like sy-subrc.
data: v_mode type c.
v_mode = 'A'.
refresh messtab.
call transaction tcode using bdcdata
mode v_mode
update 'S'
messages into messtab.
l_subrc = sy-subrc.
WRITE: / 'CALL_TRANSACTION',
TCODE,
'returncode:'(I05),
L_SUBRC,
'RECORD:',
SY-INDEX.
loop at messtab.
select single * from t100 where sprsl = messtab-msgspra
and arbgb = messtab-msgid
and msgnr = messtab-msgnr.
if sy-subrc = 0.
l_mstring = t100-text.
if l_mstring cs '&1'.
replace '&1' with messtab-msgv1 into l_mstring.
replace '&2' with messtab-msgv2 into l_mstring.
replace '&3' with messtab-msgv3 into l_mstring.
replace '&4' with messtab-msgv4 into l_mstring.
else.
replace '&' with messtab-msgv1 into l_mstring.
replace '&' with messtab-msgv2 into l_mstring.
replace '&' with messtab-msgv3 into l_mstring.
replace '&' with messtab-msgv4 into l_mstring.
endif.
condense l_mstring.
if messtab-msgtyp eq 'E' or messtab-msgtyp eq 'W'.
write: / messtab-msgtyp, l_mstring(250).
endif.
search l_mstring for 'SEA'.
if sy-subrc = 0.
write: / messtab-msgtyp, l_mstring(250).
endif.
else.
write: / messtab.
endif.
endloop.
endform. " bdc_transaction
Start new screen *
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform. "BDC_DYNPRO
Insert field *
form bdc_field using fnam fval.
if fval <> space.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endif.
endform. "BDC_FIELD
*& Form f_display_errors
form f_display_errors .
if i_error[] is not initial.
format color col_heading intensified off.
uline .
write :/ 'PR No ',
(10) 'Item No',
(20) 'PR Part No',
(30) 'Invoiced Part No',
(60) 'Remark'.
uline .
loop at i_error.
perform f_display_color.
write :/ i_error-prnum,
(10) i_error-pritm ,
(20) i_error-prmat,
(30) i_error-inmat,
(60) i_error-remak.
clear i_error.
endloop.
endif.
if i_error1[] is not initial.
format color col_heading intensified off.
uline .
write :/ 'PR No ',
(10) 'Item No',
(20) 'PR Quantity',
(30) 'Invoiced Quantity',
(60) 'Remark'.
uline .
loop at i_error1.
perform f_display_color.
if not i_error1-asqty is initial.
v_asqty = i_error1-asqty .
v_prqty = i_error1-prqty.
write :/ i_error1-prnum,
(10) i_error1-pritm ,
(20) v_prqty,
(30) v_asqty,
(60) i_error1-remak.
clear : v_asqty, v_prqty.
endif.
clear i_error1.
endloop.
endif.
endform. " f_display_errors
*& Form f_display_color
form f_display_color .
if v_flag = 0.
format color col_normal intensified on.
v_flag = 1.
elseif v_flag = 1.
format color col_normal intensified off.
v_flag = 0.
endif.
endform. " f_display_color
*& Form display_err
text
--> p1 text
<-- p2 text
form display_err .
format color col_heading intensified off.
write (120) text-006.
uline .
write : 'PR No ',
(15) 'Invoice No',
(30) 'Remark'.
uline.
format color col_negative intensified off.
write :/ i_invno-ebeln,
(15) p_invno ,
(30) 'Invoice Already Exists'.
endform. " display_err
*& Form f_check_calc_price
text
--> p1 text
<-- p2 text
form f_check_calc_price .
data : d_pric type p decimals 6 ,
g_pric type p decimals 6,
v_exch type p decimals 4 value '0.1049'.
select single ebeln
waers
bedat
from ekko into (v_ebeln , v_waers , v_podat)
where angnr eq p_invno.
loop at i_input.
concatenate i_input-posnr(4) '0' into v_posnr.
select single p~ebeln
p~ebelp
matnr
p~menge
netpr
into i_netpr
from eket as t inner join ekpo as p
on t~ebeln eq p~ebeln
and t~ebelp eq p~ebelp
where t~ebeln eq v_ebeln
and t~banfn eq i_input-ebeln
and t~bnfpo eq v_posnr.
if v_waers eq 'JPY'.
i_netpr-netpr = i_netpr-netpr * 100.
endif.
if not i_input-netpr eq i_netpr-netpr.
append i_netpr.
clear : i_input, i_netpr, v_posnr.
else.
clear : i_input, i_netpr, v_posnr.
endif.
endloop.
delete adjacent duplicates from i_netpr comparing ebeln ebelp matnr.
modify zinvdiff from table i_final.
if i_netpr[] is not initial.
select matnr
knumh
from a004
into table i_a004
for all entries in i_netpr
where matnr = i_netpr-matnr
and kschl = 'ZPR0'
and vkorg = 'SBAP'
and vtweg = 'DD'
and ( datab <= sy-datum and datbi => sy-datum ).
select matnr
knumh
from a004
into table i_a0041
for all entries in i_netpr
where matnr = i_netpr-matnr
and kschl = 'ZPR0'
and vkorg = 'EXPT'
and vtweg = 'BR'
and ( datab <= sy-datum and datbi => sy-datum ).
select matnr mvgr2 from mvke
into corresponding fields of table i_mvke
for all entries in i_netpr
where matnr = i_netpr-matnr
and vkorg = 'SBAP'
and vtweg = 'DD'.
if i_a004[] is not initial.
select knumh
kbetr
from konp
into table i_konp
for all entries in i_a004
where knumh = i_a004-knumh.
loop at i_a004.
read table i_konp with key knumh = i_a004-knumh.
i_konp-kbetr = i_konp-kbetr / 10.
move i_konp-kbetr to i_a004-kbetr.
modify i_a004.
clear : i_konp, i_a004.
endloop.
endif.
if i_a0041[] is not initial.
select knumh
kbetr
from konp
into table i_konp1
for all entries in i_a0041
where knumh = i_a0041-knumh.
loop at i_a0041.
read table i_konp1 with key knumh = i_a0041-knumh.
move i_konp1-kbetr to i_a0041-kbetr.
modify i_a0041.
clear : i_konp1, i_a0041.
endloop.
endif.
if i_mvke[] is not initial.
select pcode
fact
wfact
into table i_domsal
from zprice_grpsal
for all entries in i_mvke
where pcode = i_mvke-mvgr2
and vkorg = 'SBAP'
and vtweg = 'DD'
and lifnr = v_lifnr.
select pcode
fact
wfact
into table i_grpsal
from zprice_grpsal
for all entries in i_mvke
where pcode = i_mvke-mvgr2
and vkorg = 'EXPT'
and vtweg = 'BR'
and lifnr = v_lifnr.
endif.
loop at i_input .
read table i_mvke with key matnr = i_input-matnr.
if sy-subrc = 0.
move i_mvke-mvgr2 to i_input-mvgr2.
endif.
read table i_domsal with key pcode = i_input-mvgr2.
if sy-subrc = 0.
d_pric = i_domsal-fact / i_domsal-wfact.
i_input-dpric = i_input-netpr * d_pric * ( 112 / 100 ).
endif.
read table i_grpsal with key pcode = i_input-mvgr2.
if sy-subrc = 0.
g_pric = i_grpsal-fact * i_grpsal-wfact.
i_input-gpric = ( i_input-netpr * ( 112 / 100 ) ) / g_pric .
endif.
modify i_input.
clear i_input.
clear d_pric.
clear g_pric.
endloop.
endif.
endform. " f_check_price
*& Form f_display_data
text
--> p1 text
<-- p2 text
form f_display_data .
loop at i_netpr.
move i_netpr-ebeln to i_final-ebeln.
move i_netpr-ebelp to i_final-ebelp.
move i_netpr-matnr to i_final-matnr.
move i_netpr-netpr to i_final-poprc.
move i_netpr-menge to i_final-asqty.
move p_invno to i_final-invoice.
append i_final.
clear i_final.
endloop.
loop at i_final.
move v_podat to i_final-podat.
read table i_input with key matnr = i_final-matnr.
move i_input-netpr to i_final-invpr.
move i_input-dpric to i_final-dcalclp.Dear Santosh,
I haven't gone through your piece of code.
But I can suggest a way out, while handling multiple line-items.
The following code sample elucidate the use of multiple line-items. This is just an example for your understanding.
FORM BDC_OPERATION .
DATA: LV_ARBPL(15) TYPE C,
LV_ROWNO(2) TYPE N.
LOOP AT IT_TABDATA INTO WA_TABDATA.
CLEAR: LV_ARBPL
LV_ROWNO = SY-TABIX.
CONCATENATE 'PLPOD-ARBPL' '(' LV_ROWNO ')' INTO LV_ARBPL.
PERFORM BDC_DYNPRO USING 'SAPLCPDI' '1400'.
PERFORM BDC_FIELD USING 'BDC_CURSOR' LV_ARBPL.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=PICK'.
PERFORM BDC_FIELD USING LV_ARBPL WA_TABDATA-ARBPL.
ENDLOOP.
ENDFORM. " BDC_OPERATION
Regards,
Abir
Please don't forget to award points *
Maybe you are looking for
-
Function keys are not working correctly
I've been looking all over the various threads and I can't find an answer that solves my problem. Here are the details: I bought the computer in the U.S. where I live. I have a iMac 2.4GHz intel Core 2 Duo EMC 2133 with a 20" screen. Bought it new i
-
ITunes option to automatically open/sync no longer available.
Is it just me or has the latest iTunes update made things worse... Has the great APPLE gone PEAR shaped?! I used to plug in my iPhone and iTunes would open and sync, I updated both iTunes 10.2.1 and iOS3, seemingly a big mistake. Also my MAC desktop
-
I captured from mini-dv camcorder to FCP7 using control from my computer. I only find the capture clip in Finder. How do I get the clip in Finder to FCP7. Also my audio in the capture was not showing up on my audio meters on my computer-is this norma
-
Dear All 1. im making the vendor downpayment at that time TDS is deducting 2.im posting vendor invoice at that time also TDS dedcuting 3.when im clearing the down payment in (f-54) tds is not reversing only the amount is revrsing what could be the pr
-
My trackpad is jumpy/unresponsive--I'm going to try resetting my PMU, but I noticed from Apple's PMU page the following warning: Warning: Resetting the Power Manager on any PowerBook or iBook will permanently remove a RAM disk, if present, and all of