Regarding internal table
Hi ,
i have an internal table
DATA: BEGIN OF tbl_infile OCCURS 0,
Aufnr(12) type c,
budat(8) TYPE c,
tubes(13) type c,
srap(13) type c,
batches(13) type c,
runmin(13) type c,
stopmin(13) type c,
END OF tbl_infile.
here the date from file comes into internal table as 140409 i want to change this to 14.04.2009 and place back into internal table how to change the internal table ?
Thanks in advance
Hi,
This is very simple:
1.Change the lenght of the budat from 8 to 10
2.either use the FM 'CONVERT_DATE_TO_EXTERNAL' to convert the date or
use the below snippet
3.Declare 3 local variable of type c each of lenght 2
data:var1(2) tyep c,
var2(2) tyep c,
var3(2) tyep c,
4.extract the dd,mm and yy using the offset from the budat
var1 = budat+0(2).
var2 = budat+2(2).
var3 = budat+4(2).
5.finally concatenate the above 3 variable into budat of internal table.
concatenate var1 '.' var2 '.' var3 into budat.
Hope this might solve your problem.
Pooja
Edited by: Pooja Gupta on Mar 13, 2009 4:46 AM
Similar Messages
-
Regarding Internal Table Field Validation [Modification]
Hi All,
I have a small issue with formatting of a field.
The Field is POTX1 - it would get the value as 'New MT-EPPE0097-COMP02',
Means i have one internal table field as i_error-POTX1 in that some times we get value as 'New MT-EPPE0097-COMP02'.
Whenever i get 'New' literal in that internal table field i have to remove that literal from that internal table field. And Left Justify the remaining part of the field.
Ex: 'New MT-EPPE0097-COMP02'
should become 'MT-EPPE0097-COMP02'.
For this first i have to find wether 'New' Literal exists in the Internal table field or not then i have to remove it.
Can anybody tell me how can i solve this issue.
Thanks in advance.
Thanks & Regards,
Rayeezuddin.Hi,
Take a look :
loop at i_error.
if i_error-potx1(3) = 'New'
w_potx1 = i_error-potx1.
i_error-potx1 = w_potx1+3(37).
MODIFY i_error.
endif.
ENDLOOP.
Regards,
Erwan.
Message was edited by: Erwan LE BRUN -
Regarding Internal Table Manipulation
Hi All,
I have a issue when working against Internal Table inside a function module.
Issue is:
My I.Table declaration is as below:
<b>DATA: BEGIN OF i_vbfa_tab OCCURS 0.
INCLUDE STRUCTURE vbfa.
DATA: END OF i_vbfa_tab.</b>
Then in code i had written following logic:
SELECT VBELV
VBELN
VBTYP_N
VBTYP_V
FROM VBFA
INTO ( V_VBELV, V_VBELN, V_VBTYP_N, V_VBTYP_V )
WHERE VBELN = V_SO_ORDER2 AND
VBTYP_N = 'G' AND
STUFE = '00'.
IF SY-SUBRC EQ 0.
I_VBFA_TABVBELN = V_VBELN.
I_VBFA_TABVBELV = V_VBELV.
I_VBFA_TABVBTYP_N = V_VBTYP_N.
I_VBFA_TABVBTYP_V = V_VBTYP_V.
APPEND I_VBFA_TAB.
CLEAR I_VBFA_TAB.
ENDIF.
Then when i am checking for <b>F2[Syntax]</b> it is giving error as <b>'The Field I_VBFA_TAB-VBELN is unknown'</b>. This is the case with all 4 assignment statements.
Can anybody tell me what is the issue over here.
What can i do to assign those values to internal table and append. I had tried with <b>MOVE</b> that is also giving same error.
Can anybody solve my issue.
Thanks in advance.
Thanks & Regards,
Prasad.If you are doing something like:
call function 'Z_FUNC'
tables i_vbfa_tab = vbfa_tab.
and in the FM:
function z_func
*" TABLES
*" i_vbfa_tab STRUCTURE vbfa OPTIONAL
perform get_vbfa.
and then in an include
form get_vbfa
SELECT VBELV
VBELN
VBTYP_N
VBTYP_V
FROM VBFA
INTO ( V_VBELV, V_VBELN, V_VBTYP_N, V_VBTYP_V )
WHERE VBELN = V_SO_ORDER2 AND
VBTYP_N = 'G' AND
STUFE = '00'.
I think you'll get the syntax arror you describe. Try:
call function 'Z_FUNC'
tables i_vbfa_tab = vbfa_tab.
and in the FM:
function z_func
*" TABLES
*" i_vbfa_tab STRUCTURE vbfa OPTIONAL
perform get_vbfa
<b> tables i_vbfa_tab.</b>
and then in the include
form get_vbfa
<b> tables i_vbfa structure vbfa.</b>
data: v_vbelv like vbfa-vbelv,
v_vbeln like vbfa-vbeln,
v_VBTYP_N like vbfa-VBTYP_N,
v_VBTYP_v like vbfa-VBTYP_v,
SELECT VBELV
VBELN
VBTYP_N
VBTYP_V
FROM VBFA
INTO ( V_VBELV, V_VBELN, V_VBTYP_N, V_VBTYP_V )
WHERE VBELN = V_SO_ORDER2 AND
VBTYP_N = 'G' AND
STUFE = '00'.
IF SY-SUBRC EQ 0.
I_VBFA_TABVBELN = V_VBELN.
I_VBFA_TABVBELV = V_VBELV.
I_VBFA_TABVBTYP_N = V_VBTYP_N.
I_VBFA_TABVBTYP_V = V_VBTYP_V.
APPEND I_VBFA_TAB.
CLEAR I_VBFA_TAB.
ENDIF.
I didn't test this, so if you use it, test it thoroughly.
Rob -
Regarding internal table read.
Hi,
i want to read internal table and compare the one variable existing with in from date and to date.
the psudo code is like this
READ TABLE L_TABEMPLOYEE INTO L_WAEMPLOYEE WITH KEY EMPLOYEE = SOURCE_FIELDS_RULE-PERNR
ULTIMO BETWEEN L_WAEMPLOYEE-DATEFROM AND L_WAEMPLOYEE-DATETO.
but this statement gives error.
how to code for the same requirement.
regards,
swami.Hi,
Recode like this.It will definitely work
LOOP AT L_TABEMPLOYEE INTO L_WAEMPLOYEE
WHERE EMPLOYEE = SOURCE_FIELDS_RULE-PERNR
AND ULTIMO > L_WAEMPLOYEE-DATEFROM
AND ULTIMO < L_WAEMPLOYEE-DATETO.
<Write what you want to do here >
ENDLOOP.
Please reward if useful
Thanks Arjun
Edited by: Arjun Puthuruthy on Mar 26, 2008 10:52 AM -
Regarding Internal table and access performance
hey guys.
In my report , Somehow i reduced the query performance time by selecting minimum key fields and moved the selected records to internal table.
Now from this internal table i am restricting the loop
as per my requirements using where statements.(believing that internal table retrieval is more faster than database acces(using query)).
But still my performance goes down.
Could you pls suggest me how to reduce the execution time
in abap programming.
I used below commands.
Read using binary search.
loop ...where statement.
perform statements.
collect staements.
delete itab.(delete duplicates staements too)
sort itab(sorting).
For each above statements do we have any faster way to retrieval records.
If i see my bottle neck at se30.it shows
ABAP programming to 70 percent
database access to 20 percent
R3 system as 10percent.
now how to reduce this abap process.
could you pls reply.
ambichan.
ambichan.Hello Ambichan,
It is difficult to suggest the improvements without looking at the actual code that you are running. However, I can give you some general information.
1. READ using the BINARY SEARCH addition.
This is indeed a good way of doing a READ. But have you made sure that the internal table is <i>sorted by the required fields</i> before you use this statement ?
2. LOOP...WHERE statement.
This is also a good way to avoid looping through unnecessary entries. But further improvement can certainly be achieved if you use FIELD-SYMBOLS.
LOOP AT ITAB INTO <FIELD_SYMBOL_OF_THE_SAME_LINE-TYPE_AS_ITAB>.
ENDLOOP.
3. PERFORM statements.
A perform statement can not be optimized. what matters is the code that you write inside the FORM (or a subroutine).
4. COLLECT statements.
I trust you have used the COLLECT statement to simplify the logic. Let that be as it is. The code is more readable and elegant.
The COLLECT statement is somewhat performance intensive. It takes more time with a normal internal table (STANDARD). See if you can use an internal table of type SORTED. Even better, you can use a HASHED internal table.
5. DELETE itab.(delete duplicates staements too)
If you are making sure that you are deleting several entries based on a condition, then this should be okay. You cannot avoid using the DELETE statement if your functionality requires you to do so.
Also, before deleting the DUPLICATES, ensure that the internal table is sorted.
6. SORT statement.
It depends on how many entries there are in the internal table. If you are using most of the above points on the same internal table, then it is better that you define your internal table to be of type SORTED. That way, inserting entries will take a little more time (to ensure that the table is always sorted), but alll the other operations are going to be much faster.
Get back to me if you need further assistance.
Regards,
<a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=zwcc%2fwm4ups%3d">anand Mandalika</a>. -
Issue regarding internal tables
Dear all,
My issue is that , I need to enter data into a single internal table by fetching data from two sap tables using two different selct quries. I should not use joins or for all entries. And display the internal table data in the list.
Problem am facing is only one select query is geeting fetched and the other table data in not in the list.
Pleas provide the possible solutions.
Thanks & Regards,
Madhavi.MDATA: BEGIN OF itab1 OCCURS 0,
qmnum LIKE qmel-qmnum,
qmtxt LIKE qmel-qmtxt,
indtx LIKE qmel-indtx,
qmdat LIKE qmel-qmdat,
ltrmn LIKE qmel-ltrmn,
priok LIKE qmel-priok,
aufnr LIKE qmel-aufnr,
bezdt LIKE qmel-bezdt,
qmnam LIKE qmel-qmnam,
qmart LIKE qmel-qmart,
END OF itab1.
DATA: BEGIN OF itab2 OCCURS 0,
qmnum LIKE qmih-qmnum,
btpln LIKE qmih-btpln,
ingrp LIKE qmih-ingrp,
END OF itab2.
DATA : itab3 TYPE TABLE OF z_notif WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS : notnum FOR qmel-qmnum OBLIGATORY,
notype FOR qmel-qmart,
floc FOR qmih-btpln,
name FOR qmel-qmnam.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
To fetch the values in the internal table ****************
from ztable corresponding to the entries made *************
by the user in the selection screen ******************
SELECT qmnum qmtxt indtx qmdat ltrmn priok aufnr bezdt qmnam qmart INTO
TABLE itab1 FROM qmel WHERE qmnum IN notnum
AND qmart IN notype AND qmnam IN name.
SELECT qmnum btpln ingrp INTO TABLE itab2 FROM qmih FOR ALL ENTRIES IN
itab1 WHERE qmnum = itab1-qmnum AND btpln IN floc.
To move the contents of ITAB1 to ITAB3 ***************
LOOP AT itab1.
itab3-qmnum = itab1-qmnum.
itab3-qmtxt = itab1-qmtxt.
itab3-indtx = itab1-indtx.
itab3-qmdat = itab1-qmdat.
itab3-ltrmn = itab1-ltrmn.
itab3-priok = itab1-priok.
itab3-aufnr = itab1-aufnr.
itab3-bezdt = itab1-bezdt.
itab3-qmnam = itab1-qmnam.
itab3-qmart = itab1-qmart.
READ TABLE itab2 WITH KEY qmnum = itab1-qmnum.
To move the contents of ITAB2 to ITAB3 ***************
itab3-btpln = itab2-btpln.
itab3-ingrp = itab2-ingrp.
APPEND itab3.
ENDLOOP.
have a look at this example this may help you.....
reward if helpful..... -
This is Regarding internal tables
Hi to all,
I have 3 internal tables like this.
it_itab1 It_itab2 it_final
!--f1 !-f3 !---f1
!--f2 !-f4 !---f2
!---f3
!---f4
the fields are like this.now i want to move the data from first two internal tables to final internal table.
how to do this.
thanks and regards,
screate ur final internal table with the same data element as the fields of 1 and 2 itabs
and say move- corresponding to it_final.. -
This is regarding internal table
Hi to all,
types : begin of it_itab,
name type ztab-name,
tval like ztab-tval,
fval like ztab-fval,
end ofit_itab,
it_jtab type standard table of it_itab.
What is the meaning of this it_jtab type standard table of it_itab.
what it specifies exactly.
Thanks and regards,
sHi,
types : begin of it_itab,
name type ztab-name,
tval like ztab-tval,
fval like ztab-fval,
end ofit_itab,
Types defines the standard strcuture which you can use any where in the report.
<b>it_jtab type standard table of it_itab.</b>
As strcuture doesnot contain morethan one data, we declaring the internal using the strcuture which defined.<b> The above statement is used to create a internal table without header line and the internal table type is of standard.</b>
Thanks,
Sriram Ponna. -
Regarding Internal table logic
Hi,
I have my internal table as follows:
DATA: BEGIN OF I_DATA OCCURS 0,
prgname TYPE SYST-REPID,
matnr TYPE mara-matnr,
berid TYPE mdma-berid,
END OF I_DATA.
Data that fills into can be as follows:
Ex:
PROGRAM1,1000,MRP1
PROGRAM1,1000,MRP1
PROGRAM1,2000,MRP1
PROGRAM2,1000,MRP1
PROGRAM2,1000,MRP1
PROGRAM2,2000,MRP1
PROGRAM3,1000,MRP1
PROGRAM3,1000,MRP1
PROGRAM3,2000,MRP1
It can any order in above way.
Then i will sort the above data as follows:
SORT I_DATA BY prgname matnr berid.
Now here my issue is:
DATA: t_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE.
I need to push the above internal table data into T_OBJTXT internal table as follows:
It should first Display program Name as Program Name: Program3, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
When 2nd program comes again i have to write Program Name: Program2, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
When 3nd program comes again i have to write Program Name: Program3, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
Etc. Same process we need to follow.
The final out put should be as below:
PROGRAM NAME : PROGRAM1
MATNR, BERID
1000,MRP!
1000,MRP1
2000,MRP1
PROGRAM NAME : PROGRAM2
MATNR, BERID
1000,MRP!
1000,MRP1
2000,MRP1
PROGRAM NAME : PROGRAM3
MATNR, BERID
1000,MRP!
1000,MRP1
2000,MRP1
Like wise o/p need to be send to I_OBJTXT and to email.
<b>The logic i have written is as follows:</b>
LOOP AT I__DATA.
AT NEW PRGNAME.
MOVE '*****************************************' TO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
CONCATENATE t_objtxt-line 'PROGRAM NAME : '
I_DATA-PRGNAME
INTO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
MOVE '*****************************************' TO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
CONCATENATE TEXT-024 " Material
TEXT-025 " MRP
INTO t_objtxt-line
SEPARATED BY C_COMMA.
APPEND t_objtxt.
CLEAR t_objtxt.
MOVE '-----------------------------------------' TO t_objtxt-line.
CONCATENATE t_objtxt-line '------------------' INTO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
ENDAT.
* MOVE '' TO t_objtxt-line.
* APPEND t_objtxt.
* CLEAR t_objtxt.
CONCATENATE I_DATA-MATNR
I_DATA-BERID
INTO t_objtxt-line
SEPARATED BY C_COMMA.
APPEND t_objtxt.
CLEAR t_objtxt.
AT END OF MATNR.
MOVE '' TO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
MOVE '*****************************************' TO t_objtxt-line.
CONCATENATE t_objtxt-line '******************' INTO t_objtxt-line.
CONCATENATE t_objtxt-line '******************' INTO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
ENDAT.
ENDLOOP.
The above logic is not working correctly.
Can anybody give me correct logic for the same.
Thanks in advance.
Thanks,
Deep.Can you paste the total code.
santhosh -
Pls provide information regarding internal tables
hi
i would like to know can we create relationship between two internal tables.
like foriegn key relationship . if yes pls tell me how .hi...
there is actual relationship that can b created for 2 internal tables using foreign keys,but by using " for all entries" in select statements.
syntax: for all entries.
TYPES: BEGIN OF ftab_type,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
END OF ftab_type.
DATA: ftab TYPE STANDARD TABLE OF ftab_type WITH
NON-UNIQUE DEFAULT KEY INITIAL SIZE 10,
free TYPE I,
wa_sflight TYPE sflight.
Suppose FTAB is filled as follows:
CARRID CONNID
LH 2415
SQ 0026
LH 0400
SELECT * FROM sflight INTO wa_sflight
FOR ALL ENTRIES IN ftab
WHERE CARRID = ftab-carrid AND
CONNID = ftab-connid AND
fldate = '20010228'.
free = wa_sflight-seatsocc - wa_sflight-seatsmax.
WRITE: / wa_sflight-carrid, wa_sflight-connid, free.
ENDSELECT.
try it out.
reward if useful. -
Hi Everybody-
I am very new to SAP and i have question regarding internal tables. I have struture called "ZMI_VENDOR_TO_BW_GENERIC_V_TAB" which i get from another sap system thru SAP XI. Now i need to traverse thru this structure and add these values into custom database table. So i have declared an internal table like below
<b>data:itab_venkat type ZMI_VENDOR_TO_BW_GENERIC_V_TAB occurs 10.
data vendorid type c.
itab_venkat = Input-Generic_Vendor-Generic_Vendor_Record1.
LOOP AT itab_venkat.
vendorid = itab_venkat-generic_vendor_id1.
endloop.
</b>
i am getting an error saying occurs cannot be used and also getting an error at the loop statement, Can somebody please correct me, i am very new to SAP.in the loop i am getting the vendor id and then i should update the database table.
Please help me.
Thank you
Venkathi venkat,
check these links..
http://cma.zdnet.com/book/abap/index.htm
http://www.sapdevelopment.co.uk/
http://www.sap-img.com/
http://juliet.stfx.ca/people/fac/infosys/abap.htm
http://help.sap.com/saphelp_46c/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_46c/helpdata/en/d6/0db357494511d182b70000e829fbfe/frameset.htm
http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
http://www.sapgenie.com/abap/example_code.htm
http://www.geocities.com/SiliconValley/Campus/6345/abapindx.htm
http://help.sap.com/printdocu/core/Print46c/en/Data/Index_en.htm
http://help.sap.com/saphelp_40b/helpdata/en/4f/991f82446d11d189700000e8322d00/applet.htm
http://www.sap-img.com/abap-function.htm
http://www.sapgenie.com/abap/code/abap19.htm
http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
http://www.planetsap.com/Tips_and_Tricks.htm
http://help.sap.com/saphelp_40b/helpdata/ru/d6/0dc169494511d182b70000e829fbfe/applet.htm
http://www.henrikfrank.dk/abapexamples/SapScript/symbols.htm
http://www.henrikfrank.dk/abapexamples/index.html
http://sap.ittoolbox.com/documents/document.asp?i=752
http://members.aol.com/_ht_a/skarkada/sap/
http://sappoint.com/abap/
http://members.tripod.com/abap4/SAP_Functions.html
http://members.ozemail.com.au/~anmari/sap/index.html
http://www.planetsap.com/Userexit_List.htm
http://www.planetsap.com/Tips_and_Tricks.htm
http://www.kabai.com/abaps/q.htm
http://www.planetsap.com/Userexit_List.htm
http://help.sap.com/saphelp_bw21c/helpdata/en/c4/3a8090505211d189550000e829fbbd/frameset.htm
http://www.sapgenie.com/abap/bapi/example.htm
http://help.sap.com/saphelp_45b/helpdata/en/65/897415dc4ad111950d0060b03c6b76/content.htm
http://www.sap-basis-abap.com/index.htm
http://help.sap.com/saphelp_40b/helpdata/en/fc/eb2c46358411d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_46c/helpdata/en/aa/aeb23789e95378e10000009b38f8cf/frameset.htm
http://www.geocities.com/ResearchTriangle/1635/system.html
http://www.sapdesignguild.org/resources/MiniSG/3_Managing/3_Functions_Table_Control.htm
http://help.sap.com/saphelp_45b/helpdata/en/d1/801bdf454211d189710000e8322d00/content.htm
http://www.sapfans.com/sapfans/repos/saprep.htm
http://www.planetsap.com/howdo_a.htm
http://help.sap.com/saphelp_util464/helpdata/en/69/c2516e4ba111d189750000e8322d00/content.htm
http://www.sapgenie.com/abap/smartforms_detail.htm
http://www.sap-img.com/abap.htm
http://help.sap.com/saphelp_46c/helpdata/en/fc/eb2d67358411d1829f0000e829fbfe/content.htm
http://www.geocities.com/victorav15/sapr3/abap.html
http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
http://abap4.tripod.com/Other_Useful_Tips.html
http://help.sap.com/saphelp_45b/helpdata/en/cf/21ee2b446011d189700000e8322d00/content.htm
http://www.sap-basis-abap.com/sapmm.htm
http://sap.ittoolbox.com/nav/t.asp?t=303&p=448&h1=303&h2=322&h3=448
http://sapfans.com/
http://cma.zdnet.com/book/abap/ch03/ch03.htm
http://help.sap.com/saphelp_40b/helpdata/en/4f/991f82446d11d189700000e8322d00/applet.htm
http://sappoint.com/abap/
http://www.henrikfrank.dk/abapuk.html
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
http://www.sapgenie.com/abap/index.htm
http://www.sap-img.com/abap.htm
http://www.sapdevelopment.co.uk/tips/tipshome.htm
http://help.sap.com/printdocu/core/Print46c/en/Data/Index_en.htm
http://sap.ittoolbox.com/nav/t.asp?t=322&p=322&h1=322
http://sap.ittoolbox.com/nav/t.asp?t=448&p=448&h1=448
http://www.thespot4sap.com/
http://www.kabai.com/abaps/q.htm
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapgenie.com/abap/tips_and_tricks.htm
http://www.sapassist.com/code/d.asp?whichpage=1&pagesize=10&i=10&a=c&o=&t=&q=&qt=
For FAQ
http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
http://www.sapgenie.com/faq/abap.htm -
Regarding Exporting and Importing internal table
Hello Experts,
I have two programs:
1) Main program: It create batch jobs through open_job,submit and close job.Giving sub program as SUBMIT.
I am using Export IT to memory id 'MID' to export internal table data to sap memory in the subprogram.
The data will be processed in the subprogram and exporting data to sap memory.I need this data in the main program(And using import to get the data,but it is not working).
Importing IT1 from memory id 'MID' to import the table data in the main program after completing the job(SUBMIT SUBPROGRAM AND RETURN).
Importing is not getting data to internal table.
Can you please suggest something to solve this issue.
Thank you.
Regards,
Anand.Hi,
This is the code i am using.
DO g_f_packets TIMES.
* Start Immediately
IF NOT p_imm IS INITIAL .
g_flg_start = 'X'.
ENDIF.
g_f_jobname = 'KZDO_INHERIT'.
g_f_jobno = g_f_jobno + '001'.
CONCATENATE g_f_jobname g_f_strtdate g_f_jobno INTO g_f_jobname
SEPARATED BY '_'.
CONDENSE g_f_jobname NO-GAPS.
p_psize1 = p_psize1 + p_psize.
p_psize2 = p_psize1 - p_psize + 1.
IF p_psize2 IS INITIAL.
p_psize2 = 1.
ENDIF.
g_f_spname = 'MID'.
g_f_spid = g_f_spid + '001'.
CONDENSE g_f_spid NO-GAPS.
CONCATENATE g_f_spname g_f_spid INTO g_f_spname.
CONDENSE g_f_spname NO-GAPS.
* ... (1) Job creating...
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = g_f_jobname
IMPORTING
jobcount = g_f_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e469(9j) WITH g_f_jobname.
ENDIF.
* (2)Report start under job name
SUBMIT (g_c_prog_kzdo)
WITH p_lgreg EQ p_lgreg
WITH s_grvsy IN s_grvsy
WITH s_prvsy IN s_prvsy
WITH s_prdat IN s_prdat
WITH s_datab IN s_datab
WITH p1 EQ p1
WITH p3 EQ p3
WITH p4 EQ p4
WITH p_mailid EQ g_f_mailid
WITH p_psize EQ p_psize
WITH p_psize1 EQ p_psize1
WITH p_psize2 EQ p_psize2
WITH spid EQ g_f_spid
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
VIA JOB g_f_jobname NUMBER g_f_jobcount AND RETURN.
*(3)Job closed when starts Immediately
IF NOT p_imm IS INITIAL.
IF sy-index LE g_f_nojob.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = g_f_jobcount
jobname = g_f_jobname
strtimmed = g_flg_start
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
gs_jobsts-jobcount = g_f_jobcount.
gs_jobsts-jobname = g_f_jobname.
gs_jobsts-spname = g_f_spname.
APPEND gs_jobsts to gt_jobsts.
ELSEIF sy-index GT g_f_nojob.
CLEAR g_f_flg.
DO. " Wiating untill any job completion
LOOP AT gt_jobsts into gs_jobsts.
CLEAR g_f_status.
CALL FUNCTION 'BP_JOB_STATUS_GET'
EXPORTING
JOBCOUNT = gs_jobsts-jobcount
JOBNAME = gs_jobsts-jobname
IMPORTING
STATUS = g_f_status
* HAS_CHILD =
* EXCEPTIONS
* JOB_DOESNT_EXIST = 1
* UNKNOWN_ERROR = 2
* PARENT_CHILD_INCONSISTENCY = 3
* OTHERS = 4
g_f_mid = gs_jobsts-spname.
IF g_f_status = 'F'.
IMPORT gt_final FROM MEMORY ID g_f_mid .
FREE MEMORY ID gs_jobsts-spname.
APPEND LINES OF gt_final to gt_final1.
REFRESH gt_prlist.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = g_f_jobcount
jobname = g_f_jobname
strtimmed = g_flg_start
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc = 0.
g_f_flg = 'X'.
gs_jobsts1-jobcount = g_f_jobcount.
gs_jobsts1-jobname = g_f_jobname.
gs_jobsts1-spname = g_f_spname.
APPEND gs_jobsts1 TO gt_jobsts.
DELETE TABLE gt_jobsts FROM gs_jobsts.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
IF g_f_flg = 'X'.
CLEAR g_f_flg.
EXIT.
ENDIF.
ENDDO.
ENDIF.
ENDIF.
IF sy-subrc <> 0.
MESSAGE e539(scpr) WITH g_f_jobname.
ENDIF.
COMMIT WORK .
ENDDO. -
hi friends,
i want to find max ,min in internal table can any one help me on this..
thanks and regards,
shridevi.lHi,
Check the links
https://forums.sdn.sap.com/click.jspa?searchID=11972479&messageID=3541325
https://forums.sdn.sap.com/click.jspa?searchID=11972479&messageID=5320476
https://forums.sdn.sap.com/click.jspa?searchID=11972479&messageID=4297115
Reward for useful answers.
Regards,
Raj. -
Regarding read and compare of internal table.
HI,
i want to read internal table based on key pernr.
suppose if we load the dec month data we want the last record of that month.
if we load march 2008 data we want todays record.
for this there are two fields datefrom and dateto.
how to compare thesse two fields in read statement.
regards,
swami.Hi,
Check this code
loop at itab.
endloop.
if month = december
read table itab with key sy-tabix = sy-dbcnt.
"above stmt will fetch the last record
elseif month = march
read table itab with key sy-tabix = 1.
"above stmt will fetch the first record.
endif.
Reward if helpful.
Regards. -
Regarding fetching data into internal table from D.B Tables, D.B View
Hi All,
I Have following 5 tables in my Database.
LTAP
TABNAME
FIELDNAME
KEYFLAG
LTAP
MANDT
X
LTAP
LGNUM
X
LTAP
TANUM
X
LTAP
TAPOS
X
LTAP
VLPLA
Z0MNH
TABNAME
FIELDNAME
KEYFLAG
Z0MNH
MANDT
X
Z0MNH
WERKS
X
Z0MNH
ZMANNO
X
Z0MNH
LGNUM
X
Z0MNH
AENAM
Z0MNH
BUDAT
Z0MNH
CPUTM
Z0MNH
LAEDA
Z0MNH
STATUS
Z0MNH
USNAM
Z0MNH
ZARDAT
Z0MNH
ZARTIM
Z0MNH
ZCLDAT
Z0MNH
ZCLTIM
Z0MNH
ZDPDAT
Z0MNH
ZDPTIM
Z0MNH
ZDRIVR
Z0MNH
ZINDAT
Z0MNH
ZINTIM
Z0MNH
ZLOAD
Z0MNH
ZNOTES
Z0MNH
ZPRDAT
Z0MNH
ZPRTIM
Z0MNH
ZSUPR
Z0MNH
ZTRAILR
Z3MANBOXIDHDR
TABNAME
FIELDNAME
KEYFLAG
Z3MANBOXIDHDR
MANDT
X
Z3MANBOXIDHDR
WERKS
X
Z3MANBOXIDHDR
ZMANNO
X
Z3MANBOXIDHDR
EXIDV
X
Z3MANBOXIDHDR
NLPLA
Z3MANBOXIDHDR
NLTYP
Z3MANBOXIDHDR
VLTYP
Z3MANBOXIDHDR
Z0PAL
Z3MANBOXIDHDR
Z3COMENT
Z3MANBOXIDHDR
Z3RECPT_FLAG
Z3MANBOXIDITM
TABNAME
FIELDNAME
KEYFLAG
Z3MANBOXIDITM
MANDT
X
Z3MANBOXIDITM
WERKS
X
Z3MANBOXIDITM
ZMANNO
X
Z3MANBOXIDITM
EXIDV
X
Z3MANBOXIDITM
ITEM_NO
Z3MANBOXIDITM
MATNR
Z3MANBOXIDITM
VEMEH
Z3MANBOXIDITM
VEMNG
Z3MANBOXIDITM
Z_CARTON
Z3MANBOXIDSERIAL
TABNAME
FIELDNAME
KEYFLAG
Z3MANBOXIDSERIAL
MANDT
X
Z3MANBOXIDSERIAL
WERKS
X
Z3MANBOXIDSERIAL
EXIDV
X
Z3MANBOXIDSERIAL
ZMANNO
X
Z3MANBOXIDSERIAL
ITEM_NO
Z3MANBOXIDSERIAL
SERNR
Based on all the above tables i need to fill in below internal table field as given below:
<b>Internal Table I_TAB
ZMANNO
LGNUM
WERKS
EXIDV
ITEM_NO
MATNR
SERNR
VEMNG
VEMEH
VLTYP
NLTYP
VLPLA
NLPLA
ZLOAD
USNAM
STATUS
BUDAT
CPUTM
ZINDAT
ZINTIM
ZARDAT
ZARTIM
ZCLDAT
ZCLTIM</b>
Extract data from Manifest header <b>Z0MNH, Z3MANBOXIDHDR,
Z3MANBOXIDITM, Z3MANBOXIDSER and LTAP</b> tables based on selection parameter.
Selection Screen will have folowing Select-option fields-
<b>LGNUM
WERKS
ZMANNO
USNAM
ZLOAD
EXIDV
MATNR
SERNR
VLTYP
NLTYP
VLPLA
NLPLA
BUDAT
ZINDAT
ZARDAT
ZCLDAT</b>
Based on above selection criteria i need to fetch above internal table fields data.
Then need to Move corresponding header and item data in ITAB_RESULT internal table.
I need to fetch above fields based on above 5 tables and put in final Internal Table.
Can anybody tell me the logic how can i write the same.
Also can anybody tell me i am trying to create a DataBaseView for
Z0MNH, Z3MANBOXIDHDR, Z3MANBOXIDITM, Z3MANBOXIDSERIAL and LTAP tables.
<b>Note:
1. Z3MANBOXIDITM table may contain multiple material[MATNR] for same box-id[EXIDV] (with another line item).
2. Z3MANBOXIDSERIAL table may contain multiple record for one box id[EXIDV]+item_no[ITEM_NO].</b>
But what are the <b>TABLE/JOIN Conditions</b> i need to write while creating <b>DB View</b> for above <b>5</b> tables.
Can anybody solve above 2 issues!
Thanks in advance.
Thanks,
Deep.Hi Deep,
While creation of DB view just make sure abt the key relation between the tables. Based on that u can join the tables...First fetch the data from header table then by using for all entries u can fetch the line items data.
Hope this helps you. Reply for queries, shall post the updates.
Regards.
Kumar.
Maybe you are looking for
-
I have this server running for almost 3 years. Never a problem. It's a Proliant ML370 G5. Now I had the following abend twice in a week: Wednesday, 3-27-2013 7:37 pm File reset by user: admin Novell Open Enterprise Server, NetWare 6.5 PVER: 6.50.08 S
-
ITunes Won't Install On Windows Vista
Hi, About a year ago, I had iTunes on my Windows Vista 32-bit SP2 computer and then I switched to Mac, so I uninstalled iTunes on my Windows Vista computer thinking I wouldn't need it anymore. Now I want to install iTunes again on it but, I keep gett
-
Hello, My PC broke down. So my old Itunes (mp3s) and what not are now only on my phone and not my pc. Im affraid that if i try to upgrade my phone i will losse everything on the phone, music,photos and all that. Is there some way to "restore" itunes
-
Did an install of Flash Player for FF
... and much to my surprise it installed a 'Macaffee, screw your computer app'. I hate anything they provide because they assume everyone is stupid and try to control your system, ultimately leading to system instability. I hope Adobe stops this stup
-
Portfolios, bad links & splash screens
(using acrobat 9 pro, XP, firefox) A bad internal link (page, document or folder) within a portfolio often results in the splash screen "For the best experience update your Acrobat Reader..." or words to that effect. I need to prevent this and provi