Selecting many records for each material...
Hi all,
I have an internal table that contains a list of materials. I want to loop over that list and retrieve a group of purchase reqs from EBAN for each material...appending each group of rews to my req table for each pass over the material list. Sample code;
LOOP AT GT_MATERIALS INTO WA_MATERIALS.
SELECT MENGE LFDAT
INTO CORRESPONDING FIELDS OF TABLE GT_EBAN_FIELDS
FROM EBAN
WHERE MATNR EQ WA_MATERIALS-MATNR.
???DO I DO AN APPEND OF SOME KIND HERE???
ENDLOOP.
Regards,
Mat
Hi Mathew,
From performance point of view, the SELECT QUERY should not be under a loop. So you can do the following :
<b>SORT GT_MATERIALS.
IF not gt_materials is initial.</b>
SELECT MENGE LFDAT
INTO CORRESPONDING FIELDS OF TABLE GT_EBAN_FIELDS
FROM EBAN
<b>FOR ALL ENTRIES IN GT_MATERIALS</b>
WHERE MATNR EQ GT_MATERIALS-MATNR.
<b>ENDIF.</b>
Also if the structure of table GT_EBAN_FIELDS has only two fields MENGE, LFDAT then please remove INTO CORRESPONDING FIELDS, instead use INTO TABLE GT_EBAN_FIELDS. This is becz INTO CORRESPONDING FIELDS would affect the performance.
Best regards,
Prashant
Similar Messages
-
Select one record for each member of the group
Hi,
am having a table where in i will be having data for so many group members. i need to fetch data for a particular group members whose number of rows of data may be more in numbers (but i want only one row of data for each member of the group)
here is the query for fetching all rows of data
select RI.RESOURCE_NAME,TR.MSISDN,TR.ADDRESS1_GOOGLE, TR.MSG_DATE_INFO, FROM TRACKING_REPORT TR, RESOURCE_INFO RI
WHERE TR.MSISDN IN (SELECT MSISDN FROM RESOURCE_INFO WHERE GROUP_ID ='1' AND COM_ID=2 ) AND RI.MSISDN=TR.MSISDN
order by MSG_DATE_INFOoutput of this query is...
>
ddd 12345 13-Mar-10 19:43:03
eee 54321 Tamil Nadu, India 13-Mar-10 19:39:48
ddd 12345 13-Mar-10 19:32:58
eee 54321 Tamil Nadu, India 13-Mar-10 19:30:07
ddd 12345 13-Mar-10 19:23:08
eee 54321 Tamil Nadu, India 13-Mar-10 19:20:14
fff 98765 13-Mar-10 19:19:22
ddd 12345 13-Mar-10 19:13:01
eee 54321 Tamil Nadu, India 13-Mar-10 19:09:50
ddd 12345 13-Mar-10 19:02:56
eee 54321 tn,ind 13-Mar-10 18:59:49
ddd 12345 13-Mar-10 18:53:08
eee 54321 tn,ind 13-Mar-10 18:49:50
ddd 12345 13-Mar-10 18:42:56
eee 54321 tn,ind 13-Mar-10 18:39:50
ddd 12345 13-Mar-10 18:33:00
eee 54321 tn,ind 13-Mar-10 18:29:50
ddd 12345 13-Mar-10 18:22:54
eee 54321 tn,ind 13-Mar-10 18:19:50
ddd 12345 13-Mar-10 18:12:56
eee 54321 tn,ind 13-Mar-10 18:09:50
ddd 12345 13-Mar-10 18:02:54
eee 54321 tn,ind 13-Mar-10 18:00:02
fff 98765 Tamil Nadu, India 13-Mar-10 17:59:26
fff 98765 Tamil Nadu, India 13-Mar-10 17:54:26
ddd 12345 13-Mar-10 17:52:56
eee 54321 tn,ind 13-Mar-10 17:49:50
fff 98765 Tamil Nadu, India 13-Mar-10 17:49:25
fff 98765 Tamil Nadu, India 13-Mar-10 17:44:26
ddd 12345 13-Mar-10 17:42:56
>
from this output i want only one latest record for each member(ddd,eee,fff). i.e
>
ddd 12345 13-Mar-10 19:43:03
eee 54321 Tamil Nadu, India 13-Mar-10 19:39:48
fff 98765 13-Mar-10 19:19:22
>
how to modify the query to achieve this...?Hi,
This is not giving the result which i want...
table is
CREATE TABLE TRACKING_REPORT
ID NUMBER,
MSISDN NUMBER(12) NOT NULL,
X NUMBER(15,8) NOT NULL,
Y NUMBER(15,8) NOT NULL,
TIME_STAMP DATE,
MSG_DATE_INFO DATE DEFAULT sysdate,
ADDRESS1_GOOGLE VARCHAR2(400 BYTE),
ADDRESS2_GOOGLE VARCHAR2(400 BYTE),
ADDRESS_MLINFO VARCHAR2(400 BYTE),
REQ_ID VARCHAR2(30 BYTE)
CREATE TABLE RESOURCE_INFO
RESOURCE_ID NUMBER,
MSISDN NUMBER,
RESOURCE_NAME VARCHAR2(25 BYTE),
ADDRESS VARCHAR2(100 BYTE),
COM_ID VARCHAR2(20 BYTE),
ADMIN_ID NUMBER,
TIME_STAMP DATE DEFAULT SYSDATE,
GROUP_ID NUMBER
) -
I need a query that selects the amount of records for each day in a table.
I need a query that selects the amount of records for each
day in a table.
Eg the result would be:
date 1 14
date 2 3
etc
Any ideas?sorted:
SELECT count([commentID]),convert(varchar, dateAdded, 112)
FROM COMMENTSgroup by convert(varchar, dateAdded,
112) -
SQL help: return number of records for each day of last month.
Hi: I have records in the database with a field in the table which contains the Unix epoch time for each record. Letz say the Table name is ED and the field utime contains the Unix epoch time.
Is there a way to get a count of number of records for each day of the last one month? Essentially I want a query which returns a list of count (number of records for each day) with the utime field containing the Unix epoch time. If a particular day does not have any records I want the query to return 0 for that day. I have no clue where to start. Would I need another table which has the list of days?
Thanks
RayPeter: thanks. That helps but not completely.
When I run the query to include only records for July using a statement such as following
============
SELECT /*+ FIRST_ROWS */ COUNT(ED.UTIMESTAMP), TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD') AS DATA
FROM EVENT_DATA ED
WHERE AGENT_ID = 160
AND (TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY')+(ED.UTIMESTAMP/86400)), 'MM/YYYY') = TO_CHAR(SYSDATE-15, 'MM/YYYY'))
GROUP BY TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD')
ORDER BY TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD');
=============
I get the following
COUNT(ED.UTIMESTAMP) DATA
1 07/20
1 07/21
1 07/24
2 07/25
2 07/27
2 07/28
2 07/29
1 07/30
2 07/31
Some dates donot have any records and so no output. Is there a way to show the missing dates with a COUNT value = 0?
Thanks
Ray -
Assign different ship to party for each material in a sales order in CRM?
Hi all,
I need to create a sales order in CRM, such that the sales order contains more than 100 materials at item level and each material should be shipped to a different ship to party.
That is for 100 materials in sales order I need to ship to 100 different customers.
The 100 ship to partyu2019s are maintained for the business partner in relation ships tab in /nBP.
The CRM configuration is done in such a way that when we enter a material while creating a sales order in CRM,u2026u2026.a window pops up asking us to select the ship to party for that material.
No I need to replicate this programmatically. I generated a sales order in CRM programmatically using BAPI_SLSTRANSACT_CREATEMULTI. u2026 Now I need to make changes such that I have a provision to assign ship to party for each materialu2026
How can I do this? Can any one tell me if there is a BAPI or Function Module available so that I can assign a different ship to party for each material in sales order?
Regards,
Jessica SamHere is sample code. In that highlighted portion is different. check this out
DATA: ls_partner TYPE crmt_partner_com,
ls_input_fields TYPE crmt_input_field,
lt_fieldname TYPE crmt_input_field_names_tab,
ls_fieldname LIKE LINE OF lt_fieldname.
ls_partner-ref_handle = p_iv_handle.
ls_partner-ref_partner_handle = 1.
ls_partner-ref_kind = 'A'.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-kind_of_entry = 'C'.
licensee
ls_partner-partner_fct = '00000069'.
ls_partner-partner_no = w_but000-partner.
INSERT ls_partner INTO TABLE gt_partner.
Bill to party
IF NOT w_con_header-billtoparty IS INITIAL.
ls_partner-partner_fct = '00000003'.
ls_partner-partner_no = w_but001-partner.
INSERT ls_partner INTO TABLE gt_partner.
ENDIF.
IF w_con_header-billtoparty IS INITIAL.
ls_partner-partner_fct = '00000003'.
ls_partner-partner_no = w_but000-partner.
INSERT ls_partner INTO TABLE gt_partner.
ENDIF.
Employee
ls_partner-partner_fct = '00000014'.
ls_partner-partner_no = w_con_header-empresp.
INSERT ls_partner INTO TABLE gt_partner.
+*lsinput_fields-ref_handle = p_iv_handle.*+_
+*lsinput_fields-ref_kind = 'A'.*+_
ls_input_fields-logical_key = ls_partner-ref_partner_handle.
ls_input_fields-objectname = 'PARTNER'.
ls_fieldname-fieldname = 'DISPLAY_TYPE'.
INSERT ls_fieldname INTO TABLE lt_fieldname.
CLEAR ls_fieldname.
ls_fieldname-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_fieldname INTO TABLE lt_fieldname.
CLEAR ls_fieldname.
ls_fieldname-fieldname = 'NO_TYPE'.
INSERT ls_fieldname INTO TABLE lt_fieldname.
CLEAR ls_fieldname.
ls_fieldname-fieldname = 'PARTNER_FCT'.
INSERT ls_fieldname INTO TABLE lt_fieldname.
CLEAR ls_fieldname.
ls_fieldname-fieldname = 'PARTNER_NO'.
INSERT ls_fieldname INTO TABLE lt_fieldname.
CLEAR ls_fieldname.
ls_input_fields-field_names = lt_fieldname.
INSERT ls_input_fields INTO TABLE gt_input_fields. -
Error during creation of info record for pipline material.(Urgent)
Hi All,
We are getting the following error during creation of Info record for pipeline material
" Material XXXXX is not a pipline material"
we have checked the material master and found it is a pipeline material.
Kindly advice on the same.
Help in any form will be rewarded.
Best Regards
ArihanthHi Arahanth,
The steps u need to check are;
1) The Material Type ( If standard then it is PIPE or if defined own Material Type check the settings once preferably in special material type a tick at pipeline mandatory)
2) when u create the info record (ME11) ensure the info category is selected as pipeline.
Hope its clear to u
if solved do reward me points
Regards
Anil Thai -
When we drilldown at document level it displays one record for each cube
Dear Experts .
The users want to see the report by status for the order detail report at document level it displays one record for each cube .
They want to see the single line for the order quantity , Amount, Billing quantity delivery and amount along with the Sales order number , billing document number billing date , delvert date ..et in signgle line. ( Sale order DeliveryBilling)
When we are doing on Multiprovider recording displaying from each cube.
We have tried with Constant selections and it is not giving the required results m since these want to see by status. Due to huge data performance reasons we re unable to use it .
Please provide your valuable inputs.
Thanks,
Mahesh.Mahesh,
If you want to get detail data with respect to Sales order - delivery - Billing, on top of Multiprovider you can come up with Constant selection.
But I am not clear that why constant selection is not working properly, can I have some light on that.
Probably, you are struggling with multiple records .
I suggest you to go with end routine and map all fields to one IC and do reporting on that single IC, then your requirement will fulfill.
But here we need to take care of performance issues and process chain scheduling wile loading deltas.
If Multiprovider is not working properly , then try with Infoset(If you have more than 2 ICs it not possible).
Regards,
rvc -
Loading the cube from 3 datasources and getting 3 records for each keyfield
Hi All,
I am loading an InfoCube from 3 separated datasources. These 3 datasources are UD Datasources and their unique source system is UD Connect.
Each of the datasource contains a unique key field 'Incident Number' (same as we use have in Datasources for DSO).
The problem is, when I am loading data with these 3 datasources to the cube, for each 'Incident number' there becomes 3 records.
We have reports on this Infocube and the report also displays 3 records for each incident number.
If I remove Incident Number key field from 2 of the Datasources, the data from these datasources do not reach to the Cube.
For many of you, this may be a minor problem ( or may not be a problem at all !!! ) , but as a New Joinee in SAP field, this has become a showstopper issue for me.
Please suggest.
Thanks in Advance.Hi Pravender,
Thanks for your interest.
The scenario is, I have 3 datasources form the same source system, All the 3 datasources have different fields except 'Incident Number'. So, each and every field has only one value in the report. But due to 3 separate datasources, it creates 3 records displahying values of each datasource in a separate record.
There is no field in the query output which is having different values for the different source systems. Due to 3 records in the cube, one record will contain the value for a particular field and the other two records will show a Blank for that field.
Regards. -
Dear friends
When i run Forecast based MRP in a Hotel, i am getting One P.R for every material, i having more than 2000 materials,. Can u pl guide me how can i combine the purchase requisition. what are the settings needed to avoide one P.R for each material.
Thanks
ShivaniShivani,
MRP is a planning tool, which processes one part number at a time. It is not designed to manage your client's requirements to consolidate purchase requisitions across multiple part numbers.
If your client requires that purchase requisitions be consolidated, then that is a custom requirement and will require custom programming. Get the detailed specs from the client and submit them to an ABAP'er. It would be a simple matter for a custom program to select specified purchase reqs, and consolidate them into a smaller number of reqs, and then delete the original reqs that are no longer needed.
Rgds,
DB49 -
Ship to party for each material using BAPI_SLSTRANSACT_CREATEMULTI
i am able to generate sales order for in CRM. I am inputting the sold to party, ship to party, bill to party and payer at the header level...
CRM is currently configured in such a way that , there is a provision to assign ship to party at item level for each material.
How can i programatically replicate this? I need to assign a diiferent ship to party for each material in the sales order.*
how can i programatically replicate this?...
this is my code for cresating a sales order in CRM with sold to party, ship to party, bill to party and payer at the header level...
*************include constants
include crm_direct.
************// GUIDs
data: lv_guid_h type GUID_32, "HEADER GUIDE
lv_guid_i type GUID_32, "ITEM GUIDE
lv_guid_sl type GUID_32, "SCHEDULE LINE GUIDE
lv_guid_p type GUID_32. "PARTNER GUIDE
***********// Handles
data: lv_current_handle type crmt_handle, "CURRENT HANDLE
lv_handle_h type crmt_handle, "HEADER HANDLE
lv_handle_i type crmt_handle, "ITEM HANDLE
lv_handle_sl type crmt_handle, "SCHEDULE LINE HANDLE
lv_handle_p type crmt_handle. "PARTNER HANDLE
***********// Administration header + item + etc
data: lt_salesorder_header type table of bapibus20001_header_ins, "LT_SALESORDER_HEADER
ls_salesorder_header type bapibus20001_header_ins, "LS_SALESORDER_HEADER
lt_salesorder_item type table of bapibus20001_item, "LT_SALESORDER_ITEM
ls_salesorder_item type bapibus20001_item, "LS_SALESORDER_ITEM
lt_scheduleline type table of BAPIBUS20001_SCHEDLIN, "LT_SCHEDULELINE
ls_scheduleline type BAPIBUS20001_SCHEDLIN, "LS_SCHEDULELINE
lt_partner type table of BAPIBUS20001_PARTNER_INS, "LT_PARTNER
ls_partner type BAPIBUS20001_PARTNER_INS, "LS_PARTNER
ls_logical_key TYPE crmt_partner_logic_partner_key, "LS_LOGICAL_KEY
lt_organisation type table of BAPIBUS20001_ORGMAN_INS, "LT_ORGANISATION
ls_organisation type BAPIBUS20001_ORGMAN_INS. "LS_ORGANISATION
*********// Saved sales orders
data: lt_saved_process type table of bapibus20001_object_id, "LT_SAVED_PROCESS
data:
ls_saved_process type bapibus20001_object_id, "LS_SAVED_PROCESS
ls_salesorder type CRMT_RETURN_OBJECTS_STRUC. "LS_SALESORDER
data: lt_input_fields type table of bapibus20001_input_fields, "LT_INPUT_FIELDS
ls_input_fields type bapibus20001_input_fields, "LS_INPUT_FIELDS
ls_return type bapiret2. "LS_RETURN
data: lt_return type table of bapiret2. "LT_RETURN
***********// Macro definition to populate structure and input field This, called as
*_set_field ls_salesorder_header GUID lv_guid_h
*is exploded as
ls_salesorder_header-GUID = lv_guid_h.
ls_input_fields-fieldname = 'GUID'.
append ls_input_fields to lt_input_fields.
*Note 1: &2 (field name) MUST be uppercase
*Note 2: for the salesorder header, Macro has not been used to show how the code should look like.
*except for that the macro has been used everywhere else.
define setfield.
&1-&2 = &3.
ls_input_fields-fieldname = '&2'.
append ls_input_fields to lt_input_fields.
end-of-definition.
*****// end of macro definition
******// fill order administration header
perform get_guid changing lv_guid_h.
add 1 to lv_handle_h.
ls_salesorder_header-guid = lv_guid_h.
ls_salesorder_header-handle = lv_handle_h.
ls_salesorder_header-process_type = 'ZWEB'.
clear ls_input_fields.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_guid = lv_guid_h.
*ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-orderadm_h.
ls_input_fields-fieldname = 'GUID'.
append ls_input_fields to lt_input_fields.
ls_input_fields-fieldname = 'HANDLE'.
append ls_input_fields to lt_input_fields.
ls_input_fields-fieldname = 'PROCESS_TYPE'.
append ls_input_fields to lt_input_fields.
append ls_salesorder_header to lt_salesorder_header.
**********// fill organisation data (Interface needs this, some times may rely on sales org determination instead...
clear ls_input_fields.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-orgman.
setfield ls_organisation REF_GUID lv_guid_h.
setfield ls_organisation REF_HANDLE lv_handle_h.
setfield ls_organisation REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_organisation SALES_ORG_RESP SO_RESP . "(input).
setfield ls_organisation SALES_ORG SALES_ORG. "(input).
setfield ls_organisation DIS_CHANNEL DIS_CHNL. "(input).
setfield ls_organisation DIVISION DIVISION. "(input).
append ls_organisation to lt_organisation.
**********// fill order administration item
perform get_guid changing lv_guid_i.
lv_handle_i = lv_handle_h.
add 1 to lv_handle_i.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_i.
ls_input_fields-ref_handle = lv_handle_i.
*ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_i.
ls_input_fields-objectname = gc_object_name-orderadm_i.
setfield ls_salesorder_item GUID lv_guid_i.
setfield ls_salesorder_item HEADER lv_guid_h.
setfield ls_salesorder_item HANDLE lv_handle_i.
setfield ls_salesorder_item HEADER_HANDLE lv_handle_h.
setfield ls_salesorder_item ORDERED_PROD PRODUCT . "(input).
setfield ls_salesorder_item ITM_TYPE 'ZTAN'.
setfield ls_salesorder_item MODE 'A'.
*adjustment taken from standard include LCMS_MAPPERF04
*(see where-used-list for BAPI_SLSTRANSACT_CREATEMULTI, program LCMS_MAPPERU11)
delete lt_input_fields where fieldname = 'HANDLE'
OR
fieldname = 'HEADER_HANDLE'.
append ls_salesorder_item to lt_salesorder_item.
********// fill schedule line for item
perform get_guid changing lv_guid_sl.
add 1 to lv_handle_sl.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_i.
ls_input_fields-ref_handle = lv_handle_i.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_i.
ls_input_fields-objectname = gc_object_name-schedlin.
setfield ls_scheduleline ITEM_GUID lv_guid_i.
setfield ls_scheduleline GUID lv_guid_sl.
setfield ls_scheduleline HANDLE lv_handle_sl.
setfield ls_scheduleline ITEM_HANDLE lv_handle_i.
setfield ls_scheduleline QUANTITY quantity. "(input).
append ls_scheduleline to lt_scheduleline.
********// fill partner line
*perform get_guid changing lv_guid_p.
*the partner use the logical key as well
ls_logical_key-ref_partner_handle = '0001'.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0001'.
setfield ls_partner KIND_OF_ENTRY 'C'.
setfield ls_partner PARTNER_FCT '00000001'.
setfield ls_partner PARTNER_NO SOLD_TO. "(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
ls_logical_key-ref_partner_handle = '0002'.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0002'.
setfield ls_partner KIND_OF_ENTRY 'C'.
setfield ls_partner PARTNER_FCT '00000002'.
setfield ls_partner PARTNER_NO SHIP_TO . "(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
ls_logical_key-ref_partner_handle = '0003'.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0003'.
setfield ls_partner KIND_OF_ENTRY 'C'.
setfield ls_partner PARTNER_FCT '00000003'.
setfield ls_partner PARTNER_NO BILL_TO ."(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
ls_logical_key-ref_partner_handle = '0004'.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0004'.
setfield ls_partner KIND_OF_ENTRY 'C'.
setfield ls_partner PARTNER_FCT '00000004'.
setfield ls_partner PARTNER_NO PAYER ."(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
*******// example of a second partner function (custom) with data override
*ls_logical_key-ref_partner_handle = '0002'.
*clear ls_input_fields.
*ls_input_fields-ref_guid = lv_guid_h.
*ls_input_fields-ref_handle = lv_handle_h.
*ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
*ls_input_fields-objectname = gc_object_name-partner.
*ls_input_fields-logical_key = ls_logical_key.
*_set_field ls_partner REF_GUID lv_guid_h.
*_set_field ls_partner REF_HANDLE lv_handle_h.
*_set_field ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
*_set_field ls_partner REF_PARTNER_HANDLE '0002'.
*_set_field ls_partner KIND_OF_ENTRY 'B'. "manual entry...
*_set_field ls_partner PARTNER_FCT customFct(input).
*_set_field ls_partner PARTNER_NO bpNumber(input).
*_set_field ls_partner NO_TYPE 'BP'.
*_set_field ls_partner DISPLAY_TYPE 'BP'.
*_set_field ls_partner TITLE 'Mr.'.
*_set_field ls_partner FIRSTNAME 'John'.
*_set_field ls_partner LASTNAME 'Smith'.
*_set_field ls_partner STR_SUPPL1 'John Smith and Co'.
*_set_field ls_partner STREET 'Street1'.
*_set_field ls_partner STR_SUPPL3 'Street4'.
*_set_field ls_partner HOUSE_NO '42'.
*_set_field ls_partner CITY 'Townville'.
*_set_field ls_partner DISTRICT 'Districtshire'.
*_set_field ls_partner POSTL_COD1 'AA1 2BB'.
*note now ...
*adjustment taken from standard include LCMS_MAPPERF04
*(see where-used-list for BAPI_SLSTRANSACT_CREATEMULTI, program LCMS_MAPPERU11)
*I don't use macro because name of the field in input_table is different
*_set_field ls_partner COUNTRYISO 'GB'.
*instead
ls_partner-COUNTRYISO = 'GB'.
ls_input_fields-fieldname = 'COUNTRY'.
append ls_input_fields to lt_input_fields.
*_set_field ls_partner LANGU_ISO 'EN'.
ls_partner-LANGU_ISO = 'EN'.
ls_input_fields-fieldname = 'LANGU'.
append ls_input_fields to lt_input_fields.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
*Create sales orders *
call function 'BAPI_SLSTRANSACT_CREATEMULTI'
EXPORTING
testrun = false
TABLES
header = lt_salesorder_header[]
item = lt_salesorder_item[]
partner = lt_partner[]
organisation = lt_organisation[]
input_fields = lt_input_fields[]
scheduleline = lt_scheduleline[]
saved_process = lt_saved_process[]
return = lt_return[].
*************// get the GUID of the created object
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = lt_return1.
INCLUDE ZZGVBAPISALESORDER_GET_GUIDF01.
Edited by: jessica sam on Dec 22, 2008 4:25 PM
Edited by: jessica sam on Dec 22, 2008 4:27 PM
Edited by: jessica sam on Dec 22, 2008 7:05 PM
Edited by: jessica sam on Dec 23, 2008 5:18 AMI know how to trace the Ship to party at line item. When i create an order manually on CRM then the table CRMD_PARTNER has the required entries and the Ship to party at line item is getting populated correctly. Also if i open the order in CRMD_ORDER the ship pto party are being populated correctly at line item..
But if i am trying to replicate this programatcally using the BAPI, i see that the ship to at header is being copied to each line item and this is not what is expected.
If i go and check in the CRMD_PARTNER the data is not filled
correctly as I dont have any ship to party at line item
So finally I even tried to insert the data manually in the CRMD_PARTNER table using an
INSERT statement and even that doesnt work...
https://www.sdn.sap.com/irj/scn/forums
So i am unable to ficgure out what is going wrong
Any body if they have any idea on poulating ship to party programatically in
sales order for each line item please help
I am unable to figure out how to fill PArtner table of this BAPI to populate ship to at line item level
Kindly Help..
Regards,
Jessica Sam -
Two Purchase Info Records for Same Material & Plant Combination
Hi,
2 Purchase Info Records are there for Same Material & Plant for 2 Different Vendors & Net Price is maintained in both Info Records
1. Material M1 - Plant 1000 - Vendor A - Net Price Rs.4
2. Material M1 - Plant 2000 - Vendor B - Net Price Rs.3
Vendor A is Regular Vendor
(Tick as Regular Vendor is his Purchase Info Record)
It is observed that Rs.3 is picked up for Costing Purposes
Requirement is that - Net Price within Pur. Info Record of Regular Vendor i.e Rs. 4 must be picked up always for Costing Puposes.
Is this possible???
What Logic system uses while picking up the Price in case where there are 2 Pur. Info Records for same Material & Plant???
Thanks & Regards...
Ameya...Hi,
1. Material M1 - Plant 1000 - Vendor A - Net Price Rs.4
(Validity - 28.04.2008 To 31.12.2008)
2. Material M1 - Plant 1000 - Vendor B - Net Price Rs.3
(Validity - 01.01.08 To 31.12.2008)
Thanks & Regards...
Ameya... -
Print out of line item wise tax for each material code.
hello all,
Requirement is that my client want to print tax of all item in purchase order seperatelyi.e.line item wise tax for each material type.
is there any standard procedure available in sap?
Your valuable input will be apperciable.
Regards
sumit bislaTake the help from ABAPer and give your requirment to print the tax at item level.
-
The quantity received/required for each material (only sum of Dep and Foreq
Hi all
I have a report and I need it to show the <b>quantity received/required</b> for each material (<b>only sum of Depreq and ForReq</b>) in a plant due to MRP execution.
Basically something like MD04 showing each MRP element entry (only sum of Depreq and ForReq)
Do anyone knows a function, bapi, or other that can helps calculate this?
Thanks in advanceHi srivalli,
U mean that for every material u need sum of recieved quntity and required qunatity? if this is your requirement.
Try the synax below.
Example.
itab - internal table of any sturcture. suppose itab consits of materil and quantity fiedls.
sort itab by matnr.
loop at itab.
At end of matnr.
Sum.
Write: itab-matnr, itab-menge.
ENDAT.
endloop.
This syntax will display the sum of quantity for each material.
<b>Reward if useful</b>
Any thing please reply back if you have any other doubt.
Regards,
sunil kairam. -
Join two tables, return max 1 record for each left
I want to join tables A and B, but I only want to return a maximum of one record for each record on the left. For example
Table A
Bob,1
John,2
Jill,3
Table B
1,MountainTime
1,MountainTime
2,CentralTime
3,PacificTime
Result
Bob,MountainTime
John,CentralTime
Jill,PacificTimeHi Andrew,
Create a report by joining two tables and insert a group on code(1) and place your fields on goup footer.
This will give only one record.
Thanks,
Sastry -
How Assign a Buyer for Each Material
Dear experts ,
How Assign a Buyer for Each Material , for example,This person is going to buy this material in purchase dept. is there any possiblities
regards,
Rajahello,
u can achieve same results by following simple way
create purchase document types for example for raw material purchase,consumable purchase etc
then assign buyer from personal setting from each buyers computer.
regards
kedar
Maybe you are looking for
-
I had an existing laters 3 point whatever version of Firefox and recently upgraded to Firefox 10. This new version still has the old toolbar across the top, but there is no "Firefox button" which one has to use to activate certain action such as "pri
-
Adobe Premiere Elements 12 doesn't import MOV Files
Hi, All! I'm working on Windows 8.1 64 bit and use Adobe Premiere Elements 12. I've downloaded and installed on my PC latest version of Apple QuickTime 7.7.4.1680.86 from http://www.apple.com/quicktime/download/ I've trying to use some free stuff fro
-
Will reseting my iPhone 4 update it to iOS 7?
Will reseting my iPhone to factory settings (Out of the box) update me from 6.1.3 to iOS 7? I don't want iOS 7, but every app (Even system apps, app store, messages, phone) get frozen and then crash when I open them, I tried many things that I found
-
How excactley is is the mail software from Apple works? Twice now I have experienced guys sending replies to me without me noticing because the incomin mail have been stored in the "stack" for the conversation, you know what I mean? I have though see
-
I know Adobe Flash files and content do not work on the Ipad but will they work on the Macbook Pro?