How to use collect statement for below
data : begin of itab,
n(3) type c,
n1 type n,
k(5) type c,
end of itab.
select n n1 from into itab table /zteest.
*internal table has
n n1 k
gar 100 uji
hae 90 iou
gar 90 uji
hae 87 iou
I want
gar 190
hae 177
How to use collect statement as n1 is n ..?
let me know..
Thanks
try this..
DATA : BEGIN OF itab OCCURS 0,
n(3) TYPE c,
n1(3) TYPE p DECIMALS 2,
k(5) TYPE c,
END OF itab.
itab-n = 'gar'.
itab-n1 = 100.
itab-k = 'uji'.
COLLECT itab .CLEAR itab.
itab-n = 'hae'.
itab-n1 = 90.
itab-k = 'iou'.
COLLECT itab .CLEAR itab.
itab-n = 'gar'.
itab-n1 = 90.
itab-k = 'uji'.
COLLECT itab .CLEAR itab.
itab-n = 'hae'.
itab-n1 = 87.
itab-k = 'iou'.
COLLECT itab .CLEAR itab.
Similar Messages
-
hi everybody,
how to use collect statement to get the total amount paid to different vendor payments
data : begin of wa occurs 0,
bukrs type bsak-bukrs,
lifnr type bsak-lifnr,
land1 type lfa1-land1,
name1 like lfa1-name1,
dmbtr like bsak-dmbtr,
count type i value 0,
tot_vend type i,
vend type i.
data :end of wa.
data : itab like table of wa.
select distinct bukrs lifnr waers from bsak into
corresponding fields of wa
where bukrs in s_bukrs
and lifnr in s_lifnr
and bschl in s_bschl.
i want the total amount paid according to vendor i am using this way but i am not getting
loop at itab into wa.
wa-dmbtr = bsak-dmbtr.
collect wa-dmbtr into itab.
modify itab from wa transporting dmbtr.
i am unalbe to get it
can anybody help me regarding this if possible with example.
thanks in advance,
regards,
venu.Hi Venu,
types: BEGIN OF ty,
NAME(20),
SALES TYPE I,
END OF ty.
data : itab type standard table of ty,
itab1 type standard table of ty,
wa type ty,
wa1 type ty.
wa-NAME = 'Duck'. wa-SALES = 10.
append wa to itab.
wa-NAME = 'Tiger'. wa-SALES = 20.
append wa to itab.
wa-NAME = 'Duck'. wa-SALES = 30.
append wa to itab.
loop at itab into wa.
wa1 = wa.
collect wa1 into itab1.
endloop.
loop at itab1 into wa1.
write : / wa1-name , wa1-sales.
endloop.
COLLECT is used to create unique or compressed datsets. The key fields are the default key fields of the internal table itab .
If you use only COLLECT to fill an internal table, COLLECT makes sure that the internal table does not contain two entries with the same default key fields.
<b>If, besides its default key fields, the internal table contains number fields (see also ABAP/4 number types ), the contents of these number fields are added together if the internal table already contains an entry with the same key fields.</b>
If the default key of an internal table processed with COLLECT is blank, all the values are added up in the first table line.
In the program you mentioned yesterday,I am not able to get the logic since many lines are commented. -
How to use collect statement properly
In PBID table , i will get 4 rows for a material . I will get the corresponding values of bdzei from the same table . Now i will pass this bdzei into pbhi table. then i will get some 200 rows of data. I have to sum up the field plnmg , by grouping the laeda field of pbhi. In short, i need to know the sum of pbhi-plnmg for a particular pbhi-laeda . I know a way to do it. But i want to know how to use the COLLECT statement for this purpose. My output should contain oly 1 line for 1 material ..
PBID table
Matnr BDZEI
p4471 457
1002
2309
2493
PBHI table
BDZEI LAEDA PLNMG
1002 06.08.2004 0.000
1002 06.08.2004 83.000
457 07.08.2004 12.000
457 07.08.2004 24.000
Reqd O/p
MATNR LAEDA PLNMG
p4471 06.08.2004 83
p4471 07.08.2004 36
Hope u understood my situation .please help me out ...
Thanking you in advance ..
ShankarREPORT zppr_zpipr NO STANDARD PAGE HEADING LINE-SIZE 150 LINE-COUNT 63.
TABLES: pbid,
pbhi,
makt,
mseg,
mkpf.
DATA: BEGIN OF it_pbid OCCURS 0,
matnr LIKE pbid-matnr, " Material
status TYPE c LENGTH 4, " For distinguishing materials from pbid and pbim .. will contain space for PBID and 'PBIM' for PBIM
bdzei LIKE pbid-bdzei,
laeda LIKE pbhi-laeda,
end of it_pbid.
DATA: BEGIN OF it_pbim OCCURS 0,
matnr LIKE pbid-matnr, " Material
status TYPE c LENGTH 4, " For distinguishing materials from pbid and pbim .. will contain space for PBID and 'PBIM' for PBIM
bdzei LIKE pbim-bdzei,
laeda LIKE pbhi-laeda,
end of it_pbim.
DATA: BEGIN OF it_pbid_pbim OCCURS 0,
matnr LIKE pbid-matnr, " Material
laeda LIKE pbhi-laeda, " Reduction Date
dbmng LIKE pbhi-dbmng, " Planned quantity in the data base
plnmg LIKE pbhi-plnmg, " Planned quantity
status TYPE c LENGTH 4, " For distinguishing materials from pbid and pbim .. will contain space for PBID and 'PBIM' for PBIM
mblnr LIKE mseg-mblnr, " Material Doc Number
pbfnr LIKE pbid-pbdnr, " Plan Number
maktx LIKE makt-maktx, " Matl Desc
aenam LIKE pbhi-aenam, " User Changed
erfmg LIKE mseg-erfmg, " Qty Invoiced
budat LIKE mkpf-budat, " Invoice date
bdzei LIKE pbid-bdzei, " Independent requirements pointer
werks LIKE pbid-werks, " plant
pirrednqty TYPE i, " PIR Reduction Quantity = pbih-plnmg - pbih-dbmng
diff TYPE i, " Difference
slno TYPE i, " Sl No
END OF it_pbid_pbim.
DATA: BEGIN OF it_allrows OCCURS 0.
INCLUDE STRUCTURE it_pbid_pbim.
DATA: END OF it_allrows.
*DATA: BEGIN OF it_final OCCURS 0.
INCLUDE STRUCTURE it_pbid_pbim.
*DATA: END OF it_final.
DATA: BEGIN OF line,
matnr LIKE pbid-matnr, " Material
laeda LIKE pbhi-laeda, " Reduction Date
plnmg LIKE pbhi-plnmg, " Planned quantity
maktx LIKE makt-maktx, " Matl Desc
dbmng LIKE pbhi-dbmng, " Planned quantity in the data base
mblnr LIKE mseg-mblnr, " Material Doc Number
pbfnr LIKE pbid-pbdnr, " Plan Number
aenam LIKE pbhi-aenam, " User Changed
erfmg LIKE mseg-erfmg, " Qty Invoiced
budat LIKE mkpf-budat, " Invoice date
bdzei LIKE pbid-bdzei, " Independent requirements pointer
werks LIKE pbid-werks, " plant
pirrednqty TYPE i, " PIR Reduction Quantity = pbih-plnmg - pbih-dbmng
diff TYPE i, " Difference
slno TYPE i, " Sl No
status TYPE c LENGTH 4, " For distinguishing materials from pbid and pbim .. will contain space for PBID and 'PBIM' for PBIM
END OF line.
DATA Itfinal1 LIKE STANDARD TABLE
OF LINE
WITH DEFAULT KEY.
DATA ITfinal LIKE ITfinal1.
DATA: BEGIN OF it_dates OCCURS 0,
date TYPE sy-datum,
END OF it_dates.
DATA: l_slno TYPE i.
DATA: l_zebra TYPE c.
SELECT-OPTIONS:
s_werks FOR pbid-werks obligatory.
SELECT-OPTIONS:
s_matnr FOR pbid-matnr.
SELECT-OPTIONS:
s_pbdnr FOR pbid-pbdnr.
SELECT-OPTIONS:
s_laeda FOR pbhi-laeda obligatory.
parameter:
c_print type checkbox.
SELECT matnr bdzei FROM pbid INTO (it_pbid-matnr, it_pbid-bdzei) WHERE werks IN s_werks AND matnr IN s_matnr AND pbdnr IN s_pbdnr.
it_pbid-status = 'PBID'.
APPEND it_pbid.
move-corresponding it_pbid to it_pbid_pbim.
Append it_pbid_pbim.
ENDSELECT.
SELECT matnr bdzei FROM pbim INTO (it_pbim-matnr,it_pbim-bdzei) WHERE werks IN s_werks AND matnr IN s_matnr AND pbdnr IN s_pbdnr.
APPEND it_pbim.
Append it_pbid_pbim.
ENDSELECT.
*break-point.
START-OF-SELECTION.
LOOP AT s_laeda.
it_dates-date = s_laeda-low.
APPEND it_dates.
ENDLOOP.
DATA: l_startdate LIKE sy-datum.
IF s_laeda-high EQ space.
ELSE.
l_startdate = s_laeda-low + 1.
DO.
IF l_startdate <= s_laeda-high.
it_dates-date = l_startdate.
APPEND it_dates.
ELSE.
it_dates-date = sy-datum.
EXIT.
ENDIF.
l_startdate = l_startdate + 1.
ENDDO.
ENDIF.
*break-point.
LOOP AT it_pbim.
LOOP AT it_dates.
it_pbim-laeda = it_dates-date.
it_pbim-status = 'PBIM'.
MODIFY it_pbim TRANSPORTING laeda status.
MOVE-CORRESPONDING it_pbim TO it_pbid_pbim.
APPEND it_pbid_pbim.
ENDLOOP.
ENDLOOP.
break-point.
l_zebra = 'X'.
DATA: l_toterfmg LIKE mseg-erfmg.
DATA: l_erfmg LIKE mseg-erfmg.
data: l_totpir type i.
**************************************PBID*************************************
LOOP AT it_pbid.
move-corresponding it_pbid to it_pbid_pbim.
append it_pbid_pbim.
SELECT SINGLE maktx FROM makt INTO (it_pbid_pbim-maktx) WHERE matnr = it_pbid-matnr.
MODIFY table it_pbid_pbim TRANSPORTING maktx.
SELECT aenam laeda FROM pbhi INTO (it_pbid_pbim-aenam,it_pbid_pbim-laeda) WHERE bdzei = it_pbid-bdzei AND aenam = 'Abbau-'.
MODIFY TABLE it_pbid_pbim TRANSPORTING aenam laeda. " debug here
select single sum( dbmng ) sum( plnmg ) FROM pbhi INTO (it_pbid_pbim-dbmng,it_pbid_pbim-plnmg) WHERE bdzei = it_pbid-bdzei AND aenam = 'Abbau-' and laeda = it_pbid_pbim-laeda..
MODIFY TABLE it_pbid_pbim TRANSPORTING dbmng plnmg. " debug here
endselect.
it_pbid_pbim-pirrednqty = it_pbid_pbim-dbmng - it_pbid_pbim-plnmg.
MODIFY table it_pbid_pbim TRANSPORTING pirrednqty.
IF ( it_pbid_pbim-laeda IN s_laeda AND it_pbid_pbim-aenam EQ 'Abbau-' ).
MOVE-CORRESPONDING it_pbid_pbim TO it_allrows.
append it_allrows.
ELSEIF NOT it_pbid_pbim-laeda IN s_laeda.
delete it_pbid_pbim index sy-tabix. " debug here
ENDIF.
ENDSELECT.
ENDLOOP.
**************************************PBIM*************************************
LOOP AT it_pbim.
move-corresponding it_pbim to it_pbid_pbim.
append it_pbid_pbim.
SELECT SINGLE maktx FROM makt INTO (it_pbid_pbim-maktx) WHERE matnr = it_pbim-matnr.
MODIFY table it_pbid_pbim TRANSPORTING maktx.
SELECT aenam laeda FROM pbhi INTO (it_pbid_pbim-aenam,it_pbid_pbim-laeda) WHERE bdzei = it_pbim-bdzei AND aenam = 'Abbau-'.
MODIFY TABLE it_pbid_pbim TRANSPORTING aenam laeda. " debug here
select single sum( dbmng ) sum( plnmg ) FROM pbhi INTO (it_pbid_pbim-dbmng,it_pbid_pbim-plnmg) WHERE bdzei = it_pbim-bdzei AND aenam = 'Abbau-' and laeda = it_pbid_pbim-laeda..
MODIFY TABLE it_pbid_pbim TRANSPORTING dbmng plnmg. " debug here
it_pbid_pbim-pirrednqty = it_pbid_pbim-dbmng - it_pbid_pbim-plnmg.
MODIFY table it_pbid_pbim TRANSPORTING pirrednqty.
IF ( it_pbid_pbim-laeda IN s_laeda AND it_pbid_pbim-aenam EQ 'Abbau-' ).
MOVE-CORRESPONDING it_pbid_pbim TO it_allrows.
append it_allrows.
ELSEIF NOT it_pbid_pbim-laeda IN s_laeda.
delete it_pbid_pbim index sy-tabix. " debug here
ENDIF.
ENDSELECT.
ENDLOOP.
sort it_allrows by matnr laeda status.
**********************************ALL ROWS************************
loop at it_allrows.
line-matnr = it_allrows-matnr.
line-laeda = it_allrows-laeda.
line-plnmg = it_allrows-plnmg.
line-dbmng = it_allrows-dbmng.
line-mblnr = it_allrows-mblnr.
line-pbfnr = it_allrows-pbfnr.
line-maktx = it_allrows-maktx.
line-aenam = it_allrows-aenam.
line-erfmg = it_allrows-erfmg.
line-budat = it_allrows-budat.
line-bdzei = it_allrows-bdzei.
line-werks = it_allrows-werks.
line-pirrednqty = it_allrows-pirrednqty.
line-diff = it_allrows-diff.
line-slno = it_allrows-slno.
line-status = it_allrows-status.
collect line into itfinal1.
endloop.
loop at itfinal1 into line.
collect line into itfinal.
write: / line-matnr, line-plnmg, line-dbmng,line-laeda,line-status..
endloop.
skip 4.
loop at itfinal into line.
write: / line-matnr, line-plnmg, line-dbmng,line-laeda,line-status..
endloop.
break-point. -
How to use Submit Statement for mutiple Spools.
Hi Gurus,
I have a requirement wherein I need to Submit a Report Program to SAP-SPOOL which generates output for multiple Idocs.
For each Idoc I need to attach the spool to a particular object_id.
As of now I am doing this by putting the Submit statement in a loop.
I want to meet the same functionality without using a loop for different Idocs.
Ex.
LOOP AT IDOCS.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
CALL FUNCTION 'JOB_OPEN'
IF sy-subrc = 0.
SUBMIT YFAPINV_IDOC_RPTS TO SAP-SPOOL "USING SELECTION-SCREEN '1000'
WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS print_parameters
WITH CREDATE IN CREDATE
WITH CRETIME IN CRETIME
WITH DOCNUM IN DOCNUM
WITH VENDOR IN VENDOR
WITH V_INVOIC IN V_INVOIC
WITH MESCODE IN MESCODE
WITH DOCSTAT IN DOCSTAT
WITH DC_NBR IN DC_NBR
WITH DOC_TYPE IN DOC_TYPE
WITH S_BSART IN S_BSART
WITH ap1_flag eq 'X'
AND RETURN.
IF sy-subrc EQ 0.
CALL FUNCTION 'JOB_CLOSE'
ENDIF.
ENDIF.
SELECT rqident rqcretime FROM tsp01
INTO (rqident,rqcretime)
WHERE rqowner = sy-uname
ORDER BY rqcretime DESCENDING.
EXIT.
ENDSELECT.
IF rqident IS NOT INITIAL.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
DATA l_line TYPE docs-lines.
LOOP AT l_tline.
CLEAR l_line.
MOVE l_tline-tdline TO l_line.
l_docs-lines = l_line.
APPEND l_docs.
ENDLOOP.
ENDIF.Hi,
Each submit will create only one spool. So I dont think this is possible. Yes what you can do though is that submit the program for all the IDocs at once ( provided your program YFAPINV can handle this) and then process the spool and separate the output for each IDoc after you retrieve the data from spool.
To retrieve the data from the spool, you can use the function 'RSPO_RETURN_ABAP_SPOOLJOB' pass the spool request number and it will return you a internal table with the spool data.
regards,
Advait -
How to use prepared statement - For Everyone Help
public String count()
int count = 0;
String fetchsize = "";
try
Connection conn = getOADBTransaction().getJdbcConnection();
Statement statement = conn.createStatement();
String Query = "select count(*) count from fnd_lookups where lookup_type like 'SAPE_BILL_TO_SHIP_TO_UPDATE'";
ResultSet resultset = statement.executeQuery(Query);
while (resultset.next())
count = (int)resultset.getInt("count");
fetchsize = ""+count;
catch(Exception e)
return fetchsize;
}Hi,
we can use prepare statement in Co....
import java.sql.PreparedStatement;
import java.sql.ResultSet;
try
PreparedStatement prpdStmt1 = am.getOADBTransaction().getJdbcConnection().prepareStatement("select full_name from per_all_people_f where person_id='"+empid+"' ");
ResultSet rs=prpdStmt1.executeQuery(); //Cursor fetch row
while(rs.next())
empname=rs.getString(1);
catch(Exception e)
System.out.println("Exception is"+e.getMessage());
t1.setValue(pageContext,empname);
Thanks
nani -
How to use select statement for one field
I want to fetch the data from table and only one field , the below code i written is correct or not , because only for one field i used endselct if i am not giving endselect it is showing error. Please suggest me.
DATA : SBELN TYPE VBAK-VBELN.
parameters : s_vbeln type vbak-vbeln.
select vbeln from vbak into sbeln
where vbeln = P_VBELN.
endselect.Hi ,
As because you want single field but not single record so SELECT SINGLE is not correct .
You need to create a internal table with the field of VBELN.
Then you need to fetch the records from the VBELN field of table VBAK.
Try this code --
DATA : t_itab like table of VBAK-VBELN.
parameters : s_vbeln type vbak-vbeln.
select vbeln from vbak into table t_itab
where vbeln = s_VBELN.
Regards
Pinaki -
How to use perform statements in sap scripts
how to use perform statements in sap scripts . and pls send me one progam for this
thnaks
rajaHi Raja,
<b>PERFORM</b> key work is used to include subroutine in sapscript form...
But the processing is lttle bit different form the one we use in ABAP.
Here the paramters passed to form is stored in internal table of name-value table. there are two table one for inbound parameter and other for outbound parameters.
Check out the example below to see how this is used..
<b>Definition in the SAPscript form:</b>
/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM
/ &BARCODE&
<b>Coding of the calling ABAP program:</b>
REPORT QCJPERFO.
FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA: PAGNUM LIKE SY-TABIX, "page number
NEXTPAGE LIKE SY-TABIX. "number of next page
READ TABLE IN_PAR WITH KEY PAGE.
CHECK SY-SUBRC = 0.
PAGNUM = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY NEXTPAGE.
CHECK SY-SUBRC = 0.
NEXTPAGE = IN_PAR-VALUE.
READ TABLE OUT_PAR WITH KEY BARCODE.
CHECK SY-SUBRC = 0.
IF PAGNUM = 1.
OUT_PAR-VALUE = |. "First page
ELSE.
OUT_PAR-VALUE = ||. "Next page
ENDIF.
IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = L. "Flag: last page
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.
Hope this is clear to understand...
Enjoy SAP.
Pankaj Singh. -
How to use union statement with declare & set function?
Hi Experts,
i have small query about how to use union statement with declare & set function?
Example as below :
DECLARE @name AS date
Declare @name2 AS date
/* SELECT FROM [2013].[dbo].[OINV] T0 */
/* WHERE */
SET @name = /* T0.DocDate */ '[%1]'
SET @name2 = /* T0.DocDate */ '[%2]'
select '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2013.dbo.orct t1
inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2013.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]
Union
/* SELECT FROM [2014].[dbo].[OINV] T0 */
/* WHERE */
SET @name = /* T0.DocDate */ '[%1]'
SET @name2 = /* T0.DocDate */ '[%2]'
select '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2014.dbo.orct t1
inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2014.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]You have to create stored procedure in SQL only .
Like u must have create for Crystal .
You can execute procedure in query manager but you have to enter parameter manually..
example
Exec @Test '20140101' '20140501'
Every time user has to enter it manually in yyyymmdd format in case of date parameters.
Example
Create Proc [@Test]
as begin
DECLARE @name AS date
Declare @name2 AS date
/* SELECT FROM [2013].[dbo].[OINV] T0 */
/* WHERE */
select '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2013.dbo.orct t1
inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2013.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between @Name and @Name2
Union
/* SELECT FROM [2014].[dbo].[OINV] T0 */
/* WHERE */
select '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2014.dbo.orct t1
inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2014.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between
between @Name and @Name2
end -
Hello ! pls give some ti[ps how to use bapi's for data uploading?
hello !
pls give some ti[ps how to use bapi's for data uploading?
regards,
ArjunHi,
See the below report extract:
where it_data is having uploaded data.
LOOP AT<b> it_data</b> INTO wa_data.
line_count = sy-tabix.
"Date Validation
CONCATENATE wa_data-uplft_date4(4) wa_data-uplft_date2(2) wa_data-uplft_date+0(2)
INTO wa_data-uplft_date.
"READ TABLE it_ekko INTO wa_ekko WITH KEY lifnr = wa_data-vendor.
LOOP AT it_ekko_temp INTO wa_ekko_temp WHERE lifnr = wa_data-vendor.
IF wa_ekko_temp-kdatb <= wa_data-uplft_date AND wa_ekko_temp-kdate >= wa_data-uplft_date.
MOVE-CORRESPONDING wa_ekko_temp TO wa_ekko.
APPEND wa_ekko TO it_ekko.
ENDIF.
ENDLOOP.
"IF sy-subrc = 0 AND wa_ekko-kdatb <= wa_data-uplft_date AND wa_ekko-kdate >= wa_data-uplft_date.
LOOP AT it_ekko INTO wa_ekko.
wa_data_header-pstng_date = wa_data-uplft_date.
wa_data_header-doc_date = sy-datum.
wa_data_header-bill_of_lading = wa_data-bill_of_lad.
wa_data_header-ref_doc_no = wa_data-del_no.
CONCATENATE wa_data-header_text1 '-'
wa_data-header_text2 '-'
wa_data-header_text3 '-'
wa_data-header_text4
into wa_data_header-HEADER_TXT.
IF wa_data-indicator = 'Y'.
wa_data_item-material = '000000000000200568'.
ELSE.
wa_data_item-material = '000000000000200566'.
ENDIF.
LOOP AT it_ekpo INTO wa_ekpo WHERE ebeln = wa_ekko-ebeln AND matnr = wa_data_item-material.
"Collect Item Level Data
wa_data_item-plant = '1000'.
wa_data_item-stge_loc = '1001'.
wa_data_item-move_type = '101'.
wa_data_item-vendor = wa_data-vendor.
wa_data-qnty = wa_data-qnty / 1000.
wa_data_item-entry_qnt = wa_data-qnty.
wa_data_item-po_pr_qnt = wa_data-qnty.
wa_data_item-entry_uom = 'KL'.
wa_data_item-entry_uom_iso = 'KL'.
wa_data_item-orderpr_un = 'KL'.
wa_data_item-orderpr_un_iso = 'KL'.
wa_data_item-no_more_gr = 'X'.
wa_data_item-po_number = wa_ekpo-ebeln.
wa_data_item-po_item = wa_ekpo-ebelp.
wa_data_item-unload_pt = wa_data-unload_pt.
wa_data_item-mvt_ind = 'B'.
APPEND wa_data_item TO it_data_item.
CLEAR wa_data_item.
ENDLOOP.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_data_header
goodsmvt_code = goodsmvt_code
testrun = 'X'
TABLES
goodsmvt_item = it_data_item
return = return.
READ TABLE return INTO wa_return WITH KEY type = 'S'.
IF sy-subrc <> 0.
DESCRIBE TABLE return LINES sy-tfill.
IF sy-tfill = 0.
CALL FUNCTION <b>'BAPI_GOODSMVT_CREATE'</b>
EXPORTING
goodsmvt_header = wa_data_header
goodsmvt_code = goodsmvt_code
testrun = ' '
TABLES
goodsmvt_item = it_data_item
return = return.
CALL FUNCTION <b>'BAPI_TRANSACTION_COMMIT'</b>
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
ENDIF.
ENDIF.
LOOP AT return INTO wa_return.
WRITE: 'Messsage TYPE ', wa_return-type,
/,'ID ', wa_return-id,
/, 'Number ', wa_return-number,
/, 'Message ', wa_return-message,
/, 'Long Text ', wa_return-message_v1,
wa_return-message_v2,
wa_return-message_v3,
wa_return-message_v4,
/, 'Failed at line', line_count.
ENDLOOP.
CLEAR: wa_ekko, wa_ekpo, wa_data, it_data_item[], wa_data_header.
ENDLOOP.
Reward if useful! -
How to Use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA
Hi ,
How to use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA.
May i know what are the input parameters & fields mandatory
for each Table structures ct_data , ct_datax , it_descript , it_longtext.
Can any one explain me Step by Step Process.
B'cos i tried with below code. Equipment is not getting created.
wa_itab-equipment_ext = '000000000100000001'.
wa_itab-descript = 'Test 2 -> Lube Oil Pump'.
wa_itab-text_language = 'EN'.
wa_itab-sdescript = 'Short Description'.
APPEND wa_itab TO it_itab.
CLEAR wa_itab.
LOOP AT it_itab INTO wa_itab.
ct_data-ta_guid = '000000000000000001'.
ct_data-equipment_ext = wa_itab-equipment_ext.
ct_data-descript = wa_itab-descript .
ct_data-valid_date = sy-datum.
ct_data-equicatgry = 'M'.
APPEND ct_data.
CLEAR ct_data.
ct_datax-ta_guid = '000000000000000001'.
ct_datax-equipment_ext = 'X'.
ct_datax-equipment = 'X'.
APPEND ct_datax.
CLEAR ct_datax.
it_descript-ta_guid = '000000000000000001'.
it_descript-text_language = wa_itab-text_language.
it_descript-descript = wa_itab-sdescript .
APPEND it_descript.
CLEAR it_descript.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'LTXT'.
it_longtext-text_line = 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'aaaaaaaaaaaaaaa'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'bbbbbbbbbbbb'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'cccccccccccccccc'.
APPEND it_longtext.
CLEAR it_longtext.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
call BAPI-function in this system
CALL FUNCTION 'BAPI_EQUIPMENT_SAVEREPLICA'
TABLES
ct_data = ct_data
ct_datax = ct_datax
it_descript = it_descript
it_longtext = it_longtext
return = return
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE : 'Successful'.
ENDIF.
IF NOT return IS INITIAL.
LOOP AT return.
IF return-type = 'A' OR return-type = 'E'.
WRITE : 'Error'.
ENDIF.
ENDLOOP.
ENDIF.
REFRESH return.
ENDLOOP.
Regards
SUrendarHi ,
How to use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA.
May i know what are the input parameters & fields mandatory
for each Table structures ct_data , ct_datax , it_descript , it_longtext.
Can any one explain me Step by Step Process.
B'cos i tried with below code. Equipment is not getting created.
wa_itab-equipment_ext = '000000000100000001'.
wa_itab-descript = 'Test 2 -> Lube Oil Pump'.
wa_itab-text_language = 'EN'.
wa_itab-sdescript = 'Short Description'.
APPEND wa_itab TO it_itab.
CLEAR wa_itab.
LOOP AT it_itab INTO wa_itab.
ct_data-ta_guid = '000000000000000001'.
ct_data-equipment_ext = wa_itab-equipment_ext.
ct_data-descript = wa_itab-descript .
ct_data-valid_date = sy-datum.
ct_data-equicatgry = 'M'.
APPEND ct_data.
CLEAR ct_data.
ct_datax-ta_guid = '000000000000000001'.
ct_datax-equipment_ext = 'X'.
ct_datax-equipment = 'X'.
APPEND ct_datax.
CLEAR ct_datax.
it_descript-ta_guid = '000000000000000001'.
it_descript-text_language = wa_itab-text_language.
it_descript-descript = wa_itab-sdescript .
APPEND it_descript.
CLEAR it_descript.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'LTXT'.
it_longtext-text_line = 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'aaaaaaaaaaaaaaa'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'bbbbbbbbbbbb'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'cccccccccccccccc'.
APPEND it_longtext.
CLEAR it_longtext.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
call BAPI-function in this system
CALL FUNCTION 'BAPI_EQUIPMENT_SAVEREPLICA'
TABLES
ct_data = ct_data
ct_datax = ct_datax
it_descript = it_descript
it_longtext = it_longtext
return = return
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE : 'Successful'.
ENDIF.
IF NOT return IS INITIAL.
LOOP AT return.
IF return-type = 'A' OR return-type = 'E'.
WRITE : 'Error'.
ENDIF.
ENDLOOP.
ENDIF.
REFRESH return.
ENDLOOP.
Regards
SUrendar -
How to use multiple statements inside the "THEN" block of CASE statement?
Below is the code:
SET @strTempString = case @strKeyMode
WHEN 'AUTO/CYCLE'
THEN @strRefID + '|' + @strRetID
WHEN 'CYCLE'
THEN @strRefID + '|' + @strRetID
WHEN 'COMMERCIAL'
THEN @strRefID + '|' + @strRetID
WHEN 'ISNAP'
THEN set @strFName = ltrim(rtrim((Left(dbo.CleanTheStringAdv(@strFName + ' ', 2) + ' ', 2))))
'' + @strRefID + '|' + @strLName + '|' + @strFName + '|' + @strZIPorPolType
WHEN 'ASNAP'
THEN @strRefID + '|' + @strRetID
WHEN 'MOAT'
THEN @strRefID + '|' + @strRetID
else '0'
end
The first 3 conditions are understandable. How to use multiple statements in 4th case?
Here I first want to set the value as:
set @strFName = ltrim(rtrim((Left(dbo.CleanTheStringAdv(@strFName + ' ', 2) + ' ', 2))))
and then return the string '' + @strRefID + '|' + @strLName + '|' + @strFName + '|' + @strZIPorPolType to @strTempString.
Please help me remove the syntax errors.
Thanks in advance.Try below SQL
DECLARE @strKeyMode varchar(20) = 'ISNAP'
DECLARE @SQL VARCHAR(MAX)
DECLARE @strRefID int=1
DECLARE @strRetID INT=2
--FIRST WAY
IF @strKeyMode ='AUTO/CYCLE'
SELECT CAST(@strRefID as varchar(10))
ELSE IF @strKeyMode ='CYCLE'
SELECT @sql = CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))
ELSE IF @strKeyMode='ISNAP'
SELECT @sql = CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))+'test'+'abc'
ELSE
SELECT @SQL='ABC'
print @sql
----SECOND WAY
SELECT @SQL = CASE @strKeyMode
WHEN 'AUTO/CYCLE' THEN CAST(@strRefID as varchar(10))
WHEN 'CYCLE' THEN CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))
WHEN 'ISNAP' THEN CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))+'test'+'abc'
ELSE 'No Record'
END
PRINT (@SQL)
--Prashanth -
How we use Surrogate Keys for snowflake dimension
Hi All,
my question is - How we use Surrogate Keys for snowflake dimension
i heard from some body Surrogate Keys only work with star schema.
please correct me if i wrong.
Regards,
ManishHi manishcal16PPS,
According to your description, you can only create natural key in your dimension. But it's not working when using surrogate key. Right?
In Analysis Services, the snowflake schema of the dimensions are represented by more than one dimension table in other words its takes multiple dimension tables to define a dimension. Surrogate key are just some extra, redundant, unique key based on the
natural key. So there's no direct relationship or some limitations between surrogate keys and snowflake schema.
In this scenario, since there's relationship between the two dimensions, you should create natural key. For using natural key or surrogate key. Please refer to an article below:
Surrogate Key vs. Natural Key
For understanding star/snowflake schema, please see:
Understanding Star and Snowflake Schemas
Regards,
Simon Hou
TechNet Community Support -
How to use Synth LookAndFeel for scrollbar?
Hello there,
I read many articles on Synth ookAndFeel but in any article I could not find how to use Synth LookAndFeel for ScrollBar.
How can use SynthLookAndFeel without using any extra LookAndFeelHi,
what u do is this:
<style id="button">
<state value="DEFAULT">
<imagePainter path="Synth/testdown.png" sourceInsets="6 6 6 6" paintCenter="false" stretch="true"/>
<color value="#3333FF" type="TEXT_FOREGROUND"/>
</state>
<state value="SELECTED">
<imagePainter path="Synth/test.png" sourceInsets="6 6 6 6" paintCenter="false" stretch="true"/>
<color value="#0000FF" type="TEXT_FOREGROUND"/>
</state>
<state value="PRESSED">
<color value="#0000FF" type="TEXT_FOREGROUND"/>
<imagePainter path="Synth/test.png" sourceInsets="6 6 6 6" paintCenter="true" stretch="true"/>
</state>
</style>
<bind style="button" type="region" key="BUTTON"/>the <bind> element applys the style 2 the object (JButton). It's actually a region, u can get all the regions at
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/plaf/synth/Region.html
good luck!
DirectXMan
P.S. If u find more sites on Synth please post them. -
How to use collective confirmation CO12
can any body explain me how to use collective confirmation CO12 with screen dump.
Plz helpHi Viswa,
Prerequisites:
You can predefine values to identify confirmations and to determine default values in Conf. parameters for collective confirmation/fast entry (Customizing for Shop Floor Control by choosing Operations ® Confirmation ® Confirmation Parameters Collective Entry/Fast Entry):
Identifying the confirmation
You can identify an individual confirmation either by the confirmation number or the order number/operation number.
Suggest actual data
You can define whether and when (after entry, during saving) quantities (see Determining a Default for Yield) or activities are suggested. The default setting is that no quantities are suggested and activities are determined during saving. Personnel data and dates are always suggested.
Procedure:
Choose Logistics ® Production ® Shop floor control ® Confirmation ® Enter ® For operation ® Collective entry.
The screen for collective entry of confirmations appears.
In this screen you can enter confirmations in a table (table control). You enter a new confirmation in each line. You can control the appearance of the table yourself.
You can change the type of confirmation identification during input. To do so choose Other view.
Enter all the data needed for the confirmations. Each line corresponds to a new confirmation. In this line you have all the fields that are available in single entry of a time ticket confirmation.
On the top line of the screen you can enter default values (for example unit of measure, personnel number) that are copied to all confirmations. Enter the values and choose This graphic is explained in the accompanying text. You can save these default values for a specific user, so that they are preset the next time the user logs on. You can also delete these defaults.
With this function, you can let the system suggest actual data (quantities, activities, dates, personnel data). To do so, select the confirmations, choose This graphic is explained in the accompanying text Propose actual data, set the indicator for the relevant actual data and choose This graphic is explained in the accompanying text. This data overwrites data that you may have already entered.
Save your confirmations.
Note
To reach the Actual data screen for the selected confirmations choose This graphic is explained in the accompanying text. Here you have the complete functionality of time ticket confirmation. From this screen you can go to the detail screens and to the goods movement overview. If several confirmation have been selected, you can switch between the individual confirmations.
Note
You can switch to the goods movement overview from the collective entry screen (choose This graphic is explained in the accompanying text Goods movements). In this screen the goods movements for the selected confirmations are displayed.
You can check and, if necessary, change the goods movements. When you go back to the collective entry screen, the GM indicator is set for the selected confirmations (goods movements for confirmations already determined). As soon as you save a confirmation, the goods movements are also posted.
For more information choose the GOODS MOVEMENT OVER VIEW.
Regards,
Madhu.G
Edited by: madhu333mac on Jan 11, 2012 11:34 PM -
How to use Batch operation for two xsodata services?
Hi All,
I have two xsodata services. How to use submit batch for two xsodata services
Thanks,
MjGateway Batch Calls from SAPUI5
Maybe you are looking for
-
Delete flat file from the local drive after downloading in the program
how to <b>delete flat file from the local drive after downloading in the program</b> I am using gui_upload to upload flat file data in internal table. and after that i dont want that flat file in the disk. i want to delete it.
-
Windows 8.1 Pro N & Windows 8.1 Pro (DreamSpark)
I Recently downloaded windows Pro 8.1 N from dreamspark. They then uploaded Windows 8.1 Pro which i am unable to download: The item cannot be added to your cart because you have already ordered this item (or a related item) and cannot order it again
-
How to create an image marquee for Dreamweaver
Hello, I would like to know the best image tool to use for a Dreamweaver homepage site to create a simple three images marquee? Should I use Photoshop, Flash or fireworks? Which application is the simplist way to do this? I am a beginner using Drea
-
Adding Field on Sales online Quote Line Page
Hi We need to add three additional columns on âQuotation Linesâ Page in Sales Online module. In that one column value come from data base(Standard Cost) and two other columns(total gross, total gross%) are summary columns. We have added those col
-
I have a dynamic form that contains confidential financial data fields. How do I configure the form to not present a list of cached values from previous entries that match the string that is entered to that point? I'd really hate for client B to see