How to paas internal table value
how to pass internal table first value to a variable plz help me
Hi dulla anjan prasad
You can use the LOOP statement to process special loops for any internal table.
LOOP AT itab result condition.
statement block
ENDLOOP.
This reads the lines of the table one by one as specified in the result part of the LOOP statement. You can then process them in the statements within the LOOP - ENDLOOP control structure. You can either run the loop for all entries in the internal table, or restrict the number of lines read by specifying a condition. Control level processing is allowed within the loop.
The sequence in which the lines are processed depends on the table type:
· Standard tables and sorted tables
The lines are processed according to the linear index. Within the processing block, the system field sy-tabix contains the index of the current line.
· Hashed tables
As long as the table has not been sorted, the lines are processed in the order in which you added them to the table. Within the processing block, the system field sy-tabix is always 0.
You can nest LOOP blocks. When you leave the loop, sy-tabix has the same value as when you entered it. After the ENDLOOP statement, sy-subrc is zero if at least one table entry was processed. Otherwise, it is 4.
The loop may not contain any operations on entire internal tables that change the table. However, you should remember that even saving a global internal table with the LOCAL statement in a procedure is a change operation on the entire table, since it exchanges the table contents. When you call procedures within loops, you should therefore check that it does not change the entire internal table. If you change the table, the loop can no longer work properly.
If you insert or delete a table entry within a loop pass, it is taken into account in subsequent loop passes as follows:
· If you insert a line after the current line, it will be processed in a subsequent loop pass.
· If you delete a line after the current line, it will not be processed in a subsequent loop pass.
· If you insert a line before or at the current line, the internal loop counter will be increased accordingly.
· If you delete a line before or at the current line, the internal loop counter will be decreased accordingly.
If this information is usefull plz do reward points....
Message was edited by:
ARUN
Similar Messages
-
How to pass internal table values to parameter
hi,
how to pass internal table values to parameter in selection screen.if is it possible means please sent codeings.
thanks.
stalin.hi,
tables : mara.
data : begin of itab_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
end of itab_mara.
selection-screen : begin of block blk1 with frame title text-001.
parameters : p_matnr like mara-matnr.
selection-screen : end of block blk1.
select matnr ernam from mara into corresponding fields of itab_mara
where matnr = p_matnr.
loop at itab_mara.
write :/ itab_mara-matnr,
itab_mara-ernam.
endloop.
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada Galindo -
How to Refresh "Internal table values" in User EXIT.
Dear All,
My requirement is to place some checks in exit ZXQQMU20 in different tabs from the TCODE IW21 . IW22 etc.
Now after placeing the checks towards the different tabs while doing "NOCO" from IW21 the conditions are fullfilled but
when i go ahead to modify the created "NOCO " from the TCODE IW22 by deleting the created values and saving in IW22 , the conditions written in the exit are still satisfied eventhough i have deleted the values in IW22.
The reason for this is that the tables which are there in the exit ZXQQMU20 T_VIQMFE , T_VIQMUR , T_VIQMMA
still contains the old values which were there at the time of creation of "NOCO" in IW21 .
How to refresh my " internal tables values" used in such that even at the time of modification of the NOCO through IW22 my table values should pick the current screen values and not the values which were there at the time of creation.
Please help.
The code i have written in the exit is as below:-
********************* Changed vide ******START
*****IW21 IW22 also added in filter criteria of notification *************
******The purpose of this modification is that in the execution of IW21 or IW22 or IW24 or IW25 we have to give a check that if the
******notification type is M2 than inside the Transaction screen , if the Breakdown duration comes less than 15 min than there are
******no issues but if the breakdown duration is more than 15 min than the mandatory fields needs to be entered in the analysis tab.
** The user has to fill up either following mandatory fields in Analysis Data tab.
** A. Object Parts & Damages sub tab
** Code Group - Object Parts (OTGRP, VIQMFE)
** AND
** Code Group - Problem / Damage (FEGRP, VIQMFE)
** Or
** Notification Item Short Text (FETXT, VIQMFE)
** B. Cause sub tab
** Code Group # Causes (URGRP, VIQMUR)
** Or
** Cause Text (URTXT, VIQMUR)
** C. Action Taken sub tab
** Code Group # Activities (MNGRP, VIQMMA)
** Or
** Activity Text (MATXT, VIQMMA)
** Then, allow user to complete notification (NOCO).
CLEAR : L_VAR , L_COMP_TIME.
IF ( SY-TCODE EQ 'IW21' OR SY-TCODE EQ 'IW22' OR SY-TCODE EQ 'IW24' OR
SY-TCODE EQ 'IW25' ).
IF ( E_VIQMEL-IWERK = '061' ) OR ( E_VIQMEL-IWERK = '062' ).
IF E_VIQMEL-QMART = 'M2'.
L_VAR = E_VIQMEL-AUSZT.
L_COMP_TIME = L_VAR / 60.
IF L_COMP_TIME < 15.
EXIT.
ELSEIF L_COMP_TIME > 15..
* IF ( T_VIQMFE-OTGRP IS INITIAL AND T_VIQMFE-FEGRP IS INITIAL ) OR ( T_VIQMFE-FETXT IS INITIAL ) .
* MESSAGE 'Please fill the mandatory analysis data in Object Parts' TYPE 'E'.
* ENDIF.
IF T_VIQMFE-OTGRP EQ '' OR T_VIQMFE-FEGRP EQ ''.
IF T_VIQMFE-FETXT EQ ''.
MESSAGE 'Please fill the mandatory analysis data in Object Parts' TYPE 'E'.
ENDIF.
ENDIF.
CLEAR L_TAG.
IF T_VIQMUR[] IS INITIAL.
MESSAGE 'Please fill the mandatory analysis data in Cause tab' TYPE 'E'.
ELSE.
LOOP AT T_VIQMUR.
IF T_VIQMUR-URGRP IS INITIAL .
IF T_VIQMUR-URTXT IS INITIAL.
L_TAG = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
IF L_TAG = 'X'.
MESSAGE 'Please fill the mandatory analysis data in Cause tab' TYPE 'E'.
ENDIF.
ENDIF.
CLEAR L_TAG.
IF T_VIQMMA[] IS INITIAL.
MESSAGE 'Please fill the mandatory analysis data in Action' TYPE 'E'.
ELSE.
LOOP AT T_VIQMMA.
IF T_VIQMMA-MNGRP IS INITIAL .
IF T_VIQMMA-MATXT IS INITIAL.
L_TAG = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
IF L_TAG = 'X'.
MESSAGE 'Please fill the mandatory analysis data in Action' TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
<Added code tags>
Thank you so much in advance..
-Sudhish
Please use the code tags when you're posting any code snippet
Edited by: Suhas Saha on Jul 13, 2011 12:39 PMHi, I was thinking just like XVBAP and YVBAP values in the USEREXIT_SAVE_DOCUMENT.
Plz check u have x /y versions or tables like _old/ _new suffixes and then move the value accordingly.
otherwise there may be inconsistency.
Edited by: Prasenjit S. Bist on Jul 13, 2011 3:03 PM -
How to bind internal table values with RootUIElement(Table) from select Que
Hello Friends,
In my view Layout,there r two Input fields ,Submit button and Table... My concept is when user posting values in two input fields and clicking submit button means the result(more than one values) should be displayed in Table...
I written coding also but i dont know to bind internal table values with Table... My code as follows,
method onactionsearch .
data:
Node_Node_Flight type ref to If_Wd_Context_Node,
Elem_Node_Flight type ref to If_Wd_Context_Element,
Stru_Node_Flight type If_View1=>Element_Node_Flight ,
itab TYPE STANDARD TABLE OF sflight.
navigate from <CONTEXT> to <NODE_FLIGHT> via lead selection
Node_Node_Flight = wd_Context->get_Child_Node( Name = IF_VIEW1=>wdctx_Node_Flight ).
@TODO handle not set lead selection
if ( Node_Node_Flight is initial ).
endif.
get element via lead selection
Elem_Node_Flight = Node_Node_Flight->get_Element( ).
@TODO handle not set lead selection
if ( Elem_Node_Flight is initial ).
endif.
alternative access via index
Elem_Node_Flight = Node_Node_Flight->get_Element( Index = 1 ).
@TODO handle non existant child
if ( Elem_Node_Flight is initial ).
endif.
get all declared attributes
Elem_Node_Flight->get_Static_Attributes(
importing
Static_Attributes = Stru_Node_Flight ).
select * from sflight into CORRESPONDING FIELDS OF TABLE itab
WHERE carrid = Stru_Node_Flight-carrid and connid = Stru_Node_Flight-connid.
Node_Node_Flight->bind_table( new_items = itab ).
endmethod.
Plz reply me asap...!Hi,
What I understood from your coding is...
* navigate from <CONTEXT> to <NODE_FLIGHT> via lead selection
Node_Node_Flight = wd_Context->get_Child_Node( Name = IF_VIEW1=>wdctx_Node_Flight ).
You are reading values from the above node and binding the values to the same node.Am i right?
Did you take seperate context node for your input fields or binded the above context to the fields.If not then read the context attribute values which are binded to the carrid and connid then pass these values to select query.
One more thing is select cardinality 1..n for node NODE_FLIGHT since you are displaying more than one record.
Go through the some basic tutorials.Search in sdn you will it get.Already there is a tutorial in sdn which explains exactly what do you require.
Go throgh this link
Web Dynpro for ABAP: Tutorials for Beginners
Web Dynpro for ABAP: Tutorials for Beginners [original link is broken]
Edited by: suman kumar chinnam on Mar 26, 2009 10:50 AM -
How to convert Internal table values to excel file
Hi Experts!!!
I have requirement to generate a Excel(.xls) file for a requirement. For this the final internal table values has to be moved to excel file. I have used function module "SAP_CONVERT_TO_XLS_FORMAT" to generate it to my local machine. But when i tried to generate the file in "AL11" folder its giving a dump. Ex(/sapia/iface/out/comm/saphr/test.xls). Can anyone please tell me is there anyother function modules or program to generate in sapia folder.
Thanks.
Ganesh R Ktry to save as a tab delimited.
-
How to store internal table value in single variable
hi gurus,
i have 3 value in int table , so want to store the value of int table into single variable of type string.
how it is possiblehmmm, your requirement is kinda weird and you could have given us a bit more info, but well lets start.
Why is your requirement weird?
Well an internal table kinda is a variable itself, or rather a set of variables which together make up for a line type of your table.
So you have a value you already have in a variable and now want to store it in anotherone? Seems weird.
What type is your internal table?
Do you have those three values in one record or in three records which only hold one value each?
Which of your values do you want to store in another variable?
Anyway, make a F1 on the "READ TABLE" statement, this should definiteley help you.
The "LOOP AT WHERE" statement could as well help if there should occur probrlem using READ TABLE.
/edit DAMn i was posting this while you gave us more info.
So still the question stays if you got your three values in one record or in three records.
DATA: lv_variabl_containing_all type char100.
loop at itab into wa.
concatenate lv_variabl_containing_all wa-value into lv_variabl_containing_all seperated by space.
endloop.
after the loop you now got all your values in lv_variabl_containing_all.
That is for the case you got three records.
other case would be
Read table itab into wa index 1.
concatenate wa-value1 wa-value2 wa-value3 into lv_variabl_containing_all.
Edited by: Florian Kemmer on Apr 16, 2010 12:59 PM -
How to Send Internal table to SAP Spool using Function Modules or Methods?
Hi Experts,
How to Send Internal table to SAP Spool using Function Modules or Methods?
Thanks ,
KiranThis is my code.
I still get the no ABAP list data for the spool, even tho I can see it sp01?
REPORT Z_MAIL_PAYSLIP.
* Declaration Part *
tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
infotypes: 0000, 0001, 0105, 0655.
data: begin of ITAB occurs 0,
MTEXT(25) type C,
PERNR like PA0001-PERNR,
ABKRS like PA0001-ABKRS,
ENAME like PA0001-ENAME,
USRID_LONG like PA0105-USRID_LONG,
end of ITAB.
data: W_BEGDA like HRPY_RGDIR-FPBEG,
W_ENDDA like HRPY_RGDIR-FPEND.
data: RETURN like BAPIRETURN1 occurs 0 with header line.
data: P_INFO like PC407,
P_FORM like PC408 occurs 0 with header line.
data: P_IDX type I,
MY_MONTH type T549Q-PABRP,
STR_MY_MONTH(2) type C,
MY_YEAR type T549Q-PABRJ,
STR_MY_YEAR(4) type C,
CRLF(2) type x value '0D0A'.
data: W_CMONTH(10) type C.
data: TAB_LINES type I,
ATT_TYPE like SOODK-OBJTP.
data: begin of P_INDEX occurs 0,
INDEX type I,
end of P_INDEX.
constants: begin of F__LTYPE, "type of line
CMD like PC408-LTYPE value '/:', "command
TXT like PC408-LTYPE value 's', "textline
end of F__LTYPE.
constants: begin of F__CMD, "commands
NEWPAGE like PC408-LINDA value '',
end of F__CMD.
data: P_LIST like ABAPLIST occurs 1 with header line.
*data: OBJBIN like SOLISTI1 occurs 10 with header line,
data: OBJBIN like LVC_S_1022 occurs 10 with header line,
DOCDATA like SODOCCHGI1,
OBJTXT like SOLISTI1 occurs 10 with header line,
OBJPACK like SOPCKLSTI1 occurs 1 with header line,
RECLIST like SOMLRECI1 occurs 1 with header line,
OBJHEAD like SOLISTI1 occurs 1 with header line,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_buffer type string,
l_no_of_bytes TYPE i,
l_pdf_spoolid LIKE tsp01-rqident,
l_jobname LIKE tbtcjob-jobname.
data: file_length type int4,
spool_id type rspoid,
line_cnt type i.
*-------------------------------------------------------------------* * INITIALIZATION *
OBJBIN = ' | '.
append OBJBIN.
OBJPACK-HEAD_START = 1.
data: S_ABKRS like PV000-ABKRS.
data: S_PABRP like T549Q-PABRP.
data: S_PABRJ like T549Q-PABRJ.
* SELECTION SCREEN *
selection-screen begin of block BL1.
parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
selection-screen end of block BL1.
START-OF-SELECTION.
s_ABKRS = PNPXABKR.
S_PABRP = PNPPABRP.
s_pabrj = PNPPABRJ.
w_begda = PN-BEGDA.
w_endda = PN-ENDDA.
get pernr.
* "Check active employees
rp-provide-from-last p0000 space pn-begda pn-endda.
CHECK P0000-STAT2 IN PNPSTAT2.
* "Check Payslip Mail flag
rp-provide-from-last p0655 space pn-begda pn-endda.
CHECK P0655-ESSONLY = 'X'.
rp-provide-from-last p0001 space pn-begda pn-endda.
* "Find email address
RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
if p0105-usrid_LONG ne ''.
ITAB-PERNR = P0001-PERNR.
ITAB-ABKRS = P0001-ABKRS.
ITAB-ENAME = P0001-ENAME.
ITAB-USRID_LONG = P0105-USRID_LONG.
append itab.
clear itab.
endif.
"SY-UCOMM ='ONLI'
END-OF-SELECTION.
*------------------------------------------------------------------* start-of-selection.
write : / 'Payroll Area : ', S_ABKRS.
write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
write : / 'System Time : ', SY-UZEIT.
write : / 'User Name : ', SY-UNAME.
write : / SY-ULINE.
sort ITAB by PERNR.
loop at ITAB.
clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
* Retrieve Payroll results sequence number for this run
select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
and FPBEG ge W_BEGDA
and FPEND le W_ENDDA
and SRTZA eq 'A'.
* Produce payslip for those payroll results
if SY-SUBRC = 0.
call function 'GET_PAYSLIP'
EXPORTING
EMPLOYEE_NUMBER = ITAB-PERNR
SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
PAYSLIP_VARIANT = PAY_VAR
IMPORTING
RETURN = RETURN
P_INFO = P_INFO
TABLES
P_FORM = P_FORM.
check RETURN is initial.
* remove linetype from generated payslip
loop at p_form.
objbin = p_form-linda.
append objbin.
line_cnt = line_cnt + 1.
endloop.
file_length = line_cnt * 1022.
* create spool file of paylsip
CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
EXPORTING
i_file_length = file_length
IMPORTING
e_spoolid = spool_id
TABLES
it_textdata = objbin.
IF sy-subrc EQ 0.
WRITE spool_id.
ENDIF.
DESCRIBE table objbin.
DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = spool_id
NO_DIALOG = ' '
DST_DEVICE = 'MAIL'
* PDF_DESTINATION =
* IMPORTING
* PDF_BYTECOUNT = l_no_of_bytes
* PDF_SPOOLID = l_pdf_spoolid
* LIST_PAGECOUNT =
* BTC_JOBNAME =
* BTC_JOBCOUNT =
TABLES
PDF = pdf
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Download PDF file C Drive
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\itab_to_pdf.pdf'
filetype = 'BIN'
TABLES
data_tab = pdf.
* Transfer the 132-long strings to 255-long strings
* LOOP AT pdf.
* TRANSLATE pdf USING ' ~'.
* CONCATENATE gd_buffer pdf INTO gd_buffer.
* ENDLOOP.
* TRANSLATE gd_buffer USING '~ '.
* DO.
* it_mess_att = gd_buffer.
* APPEND it_mess_att.
* SHIFT gd_buffer LEFT BY 255 PLACES.
* IF gd_buffer IS INITIAL.
* EXIT.
* ENDIF.
* ENDDO.
OBJHEAD = 'Objhead'.
append OBJHEAD.
* preparing email subject
concatenate W_ENDDA(6)
' Payslip-'
ITAB-ENAME+0(28)
ITAB-PERNR+4(4) ')'
into DOCDATA-OBJ_DESCR.
DOCDATA-OBJ_NAME = 'Pay Slip'.
DOCDATA-OBJ_LANGU = SY-LANGU.
OBJTXT = 'Pay Slip.'.
append OBJTXT.
*prepare email lines
OBJTXT = DOCDATA-OBJ_DESCR.
append OBJTXT.
OBJTXT = 'Please find enclosed your current payslip.'.
append OBJTXT.
* Write Attachment(Main)
* 3 has been fixed because OBJTXT has fix three lines
read table OBJTXT index 3.
* DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
clear OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = 3.
OBJPACK-DOC_TYPE = 'RAW'.
append OBJPACK.
* Create Message Attachment
ATT_TYPE = 'PDF'.
describe table OBJBIN lines TAB_LINES.
read table OBJBIN index TAB_LINES.
* OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = ATT_TYPE.
OBJPACK-OBJ_NAME = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Payslip'.
append OBJPACK.
* Create receiver list refresh RECLIST.
clear RECLIST.
RECLIST-RECEIVER = itab-USRID_long.
translate RECLIST-RECEIVER to lower case.
RECLIST-REC_TYPE = 'U'.
append RECLIST.
* Send the document
*SO_NEW_DOCUMENT_ATT_SEND_API1
call function 'SO_DOCUMENT_SEND_API1'
exporting
DOCUMENT_DATA = DOCDATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
tables
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = pdf
CONTENTS_TXT = OBJTXT
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
RECEIVERS = RECLIST
exceptions
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
others = 8.
if SY-SUBRC NE 0.
ITAB-MTEXT = 'Message Not Sent to : '.
else.
ITAB-MTEXT = 'Message Sent to : '.
endif.
* else.
* ITAB-MTEXT = 'Message Not Sent to : '.
* endif.
else.
"SY-SUBRC Not = 0
ITAB-MTEXT = 'Payroll data not found : '.
endif.
"end of SY-SUBRC = 0.
modify ITAB.
endloop. "end loop at ITAB
sort ITAB by MTEXT PERNR.
loop at ITAB.
at new MTEXT.
uline.
write : / ITAB-MTEXT color 4 intensified on.
write : / 'Emp. Code' color 2 intensified on,
12 'Emp. Name' color 2 intensified on,
54 'Email ID' color 2 intensified on.
endat.
write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
endloop. -
How to access internal table data from webdynpro to Flex application.
Hi Connoisseur
The data transfer from Abap WebDeypro to flex island works well. I followed , there is an example from Thomas Jung (by the way as always Great Work) and Karthikeyan Venkatesan (Infosys) but this example covers simple type only.
There is no example with complex types like arrayCollection which handle the transfer of data from flex to WebDynpro.
i tried to do pass internal table value to flex-datagrid.but its not work.
i would like to know
1.how to access internal table data from webdynpro to Flex application.
2.how to pass the internal table to flex-datagrid.
2.how to pass dynamically in ADOBE flex.
3. how to do Flex is receiving the wd context data?
4. how can we update WD context with FLEX data.
Ple give me sample example and step by step procedure.
Regards
laxmikanthHi Laxmikanth,
Please refer this...
Flash island: update complex type from flex
Cheers..
kris. -
Submititng the program to another program using internal table values
Hi All,
How to Submit from one program to another program using internal table values minimum 7 int tables without using the seletion screen
thanks
rajHi All,
Thank you very much for your inputs.
i am facing another issue:
For each 10,000 records it should trigger a job (we are trying to call a program) were the validation will be done only through the other program.
please find the code mentioned below :
TABLES : but000.
DATA: int_bp LIKE but000 OCCURS 0 WITH HEADER LINE.
data released like BTCH0000-CHAR1.
DATA: jobnumber LIKE tbtcjob-jobcount, " Job ID and
jobname LIKE tbtcjob-jobname, " job name.
startdate LIKE tbtcjob-sdlstrtdt, " Start-time
starttime LIKE tbtcjob-sdlstrttm, " window specs.
laststartdate LIKE tbtcjob-laststrtdt,
laststarttime LIKE tbtcjob-laststrttm,
job_released LIKE btch0000-char1. " JOB_CLOSE: Was job released?
DATA : l1 TYPE i,
b_size TYPE i,
b_cursor TYPE cursor.
INITIALIZATION.
b_size = 5000.
START-OF-SELECTION.
OPEN CURSOR WITH HOLD b_cursor
FOR
SELECT *
FROM but000
WHERE bpkind = 'AA'.
IF sy-subrc = 0.
DO.
FETCH NEXT CURSOR b_cursor INTO TABLE int_bp
PACKAGE SIZE b_size.
Note : here in this point we are getting a dump for the second job trigger.
IF sy-subrc = 0.
CLEAR jobname.
CONCATENATE sy-repid sy-datum sy-uzeit INTO jobname.
export int_bp to memory id 'ABC'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobnumber.
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
authcknam = sy-uname
jobname = jobname
jobcount = jobnumber
report = 'YTEST_RRR'.
variant = lv_variant.
SUBMIT ytest_rrr
VIA JOB jobname NUMBER jobnumber
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
event_periodic = 'X'
jobcount = jobnumber
jobname = jobname
strtimmed = 'X'
IMPORTING
job_was_released = released
else.
EXIT.
ENDIF.
ENDDO.
calling program :
REPORT YTEST_RRR .
data itab1 like but000 occurs 0 with header line.
data l type i.
import itab1 from memory id 'ABC' .
describe table itab1 lines l.
free memory id 'ABC'.
write:/ 'total records are:', l.
Please give your suggestion why its going for dump in the second iteration.
thanks in advance. -
How to write internal table data vertically . Records vertically.
Hi pals,
How to write internal table records vertically .
suppose the records are
a1 a2 a3
b1 b2 b3
we need to display
a1 b1
a2 b2
a3 b3
Thanks in advance.
balaji.TJust check the code
DATA: BEGIN OF itab OCCURS 0,
f1 TYPE i,
f2 TYPE i,
f3 TYPE i,
END OF itab.
DATA pos TYPE i.
"Define your lines where you want to print here...
DATA line1 TYPE i VALUE 10.
DATA line2 TYPE i VALUE 12.
DATA line3 TYPE i VALUE 14.
itab-f1 = '1'.
itab-f2 = '10'.
itab-f3 = '100'.
APPEND itab.
itab-f1 = '2'.
itab-f2 = '20'.
itab-f3 = '200'.
APPEND itab.
itab-f1 = '3'.
itab-f2 = '30'.
itab-f3 = '300'.
APPEND itab.
itab-f1 = '4'.
itab-f2 = '40'.
itab-f3 = '400'.
APPEND itab.
loop at itab.
write : / itab-f1,itab-f2,itab-f3.
endloop.
LOOP AT itab.
pos = pos + 10.
SKIP TO LINE line1.
POSITION pos.
WRITE itab-f1.
SKIP TO LINE line2.
POSITION pos.
WRITE itab-f2.
SKIP TO LINE line3.
POSITION pos.
WRITE itab-f3.
ENDLOOP. -
How to download internal table data into xml file?
Hi,
Experts,
I have downloaded internal table data into XLS format using GUI_DOWNLOAD Function module, But i didn't Know how to download internal table data into XML format please post some ideas/inputs on this issue.
Thank you,
Shabeer ahmed.check this
data : gd_repid type sy-repid.
GD_REPID = SY-REPID.
DATA : L_DOM TYPE REF TO IF_IXML_ELEMENT,
M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
G_IXML TYPE REF TO IF_IXML,
W_STRING TYPE XSTRING,
W_SIZE TYPE I,
W_RESULT TYPE I,
W_LINE TYPE STRING,
IT_XML TYPE DCXMLLINES,
S_XML LIKE LINE OF IT_XML,
W_RC LIKE SY-SUBRC.
DATA: XML TYPE DCXMLLINES.
DATA: RC TYPE SY-SUBRC,
BEGIN OF XML_TAB OCCURS 0,
D LIKE LINE OF XML,
END OF XML_TAB.
data : l_element type ref to if_ixml_element,
xml_ns_prefix_sf type string,
xml_ns_uri_sf type string.
CLASS CL_IXML DEFINITION LOAD.
G_IXML = CL_IXML=>CREATE( ).
CHECK NOT G_IXML IS INITIAL.
M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
CHECK NOT M_DOCUMENT IS INITIAL.
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
NAME = 'REPAIRDATA'
DATAOBJECT = IT_FINAL_LAST1[]
IMPORTING
DATA_AS_DOM = L_DOM
CHANGING
DOCUMENT = M_DOCUMENT
EXCEPTIONS
ILLEGAL_NAME = 1
OTHERS = 2.
CHECK NOT L_DOM IS INITIAL.
W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
*Start of code for Header
* namespace
t_mnr = sy-datum+4(2).
CALL FUNCTION 'IDWT_READ_MONTH_TEXT'
EXPORTING
LANGU = 'E'
MONTH = t_mnr
IMPORTING
T247 = wa_t247
concatenate sy-datum+6(2)
wa_t247-ktx
sy-datum(4) into t_var1.
concatenate sy-uzeit(2)
sy-uzeit+2(2)
sy-uzeit+4(2) into t_var2.
clear : xml_ns_prefix_sf,
xml_ns_uri_sf.
l_element = m_document->get_root_element( ).
xml_ns_prefix_sf = 'TIMESTAMP'.
concatenate t_var1 t_var2 into xml_ns_uri_sf separated by space.
clear : t_var1,
t_var2,
t_mnr,
wa_t247.
l_element->set_attribute( name = xml_ns_prefix_sf
namespace = ' '
value = xml_ns_uri_sf ).
clear : xml_ns_prefix_sf,
xml_ns_uri_sf.
xml_ns_prefix_sf = 'FILECREATOR'.
xml_ns_uri_sf = 'SAP'.
l_element->set_attribute( name = xml_ns_prefix_sf
namespace = ' '
value = xml_ns_uri_sf ).
clear : xml_ns_prefix_sf,
xml_ns_uri_sf.
xml_ns_prefix_sf = 'CLAIMGROUP'.
xml_ns_uri_sf = '1'.
l_element->set_attribute( name = xml_ns_prefix_sf
namespace = ' '
value = xml_ns_uri_sf ).
clear : xml_ns_prefix_sf,
xml_ns_uri_sf.
xml_ns_prefix_sf = 'CLAIMTYPES'.
xml_ns_uri_sf = 'W'.
l_element->set_attribute( name = xml_ns_prefix_sf
namespace = ' '
value = xml_ns_uri_sf ).
*End of Code for Header
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
DOCUMENT = M_DOCUMENT
IMPORTING
XML_AS_STRING = W_STRING
SIZE = W_SIZE
TABLES
XML_AS_TABLE = IT_XML
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
LOOP AT IT_XML INTO XML_TAB-D.
APPEND XML_TAB.
ENDLOOP.
*Start of Code for File name
concatenate p_file
'\R'
'000_119481'
sy-datum+6(2) sy-datum+4(2) sy-datum+2(2)
sy-uzeit(2) sy-uzeit+2(2) sy-uzeit(2) '.xml' into p_file.
*End of Code for File name
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_SIZE
FILENAME = p_file
FILETYPE = 'BIN'
TABLES
DATA_TAB = XML_TAB
EXCEPTIONS
OTHERS = 10.
IF SY-SUBRC = 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
How to fill internal table with selection screen field.
Hi all,
i am new to sap . pls tell me how to fill internal table with selection screen field.Hi,
Please see the example below:-
I have used both select-options and parameter on the selection-screen.
Understand the same.
* type declaration
TYPES: BEGIN OF t_matnr,
matnr TYPE matnr,
END OF t_matnr,
BEGIN OF t_vbeln,
vbeln TYPE vbeln,
END OF t_vbeln.
* internal table declaration
DATA : it_mara TYPE STANDARD TABLE OF t_matnr,
it_vbeln TYPE STANDARD TABLE OF t_vbeln.
* workarea declaration
DATA : wa_mara TYPE t_matnr,
wa_vbeln TYPE t_vbeln.
* selection-screen field
SELECTION-SCREEN: BEGIN OF BLOCK b1.
PARAMETERS : p_matnr TYPE matnr.
SELECT-OPTIONS : s_vbeln FOR wa_vbeln-vbeln.
SELECTION-SCREEN: END OF BLOCK b1.
START-OF-SELECTION.
* I am adding parameter value to my internal table
wa_mara-matnr = p_matnr.
APPEND wa_mara TO it_mara.
* I am adding select-options value to an internal table
LOOP AT s_vbeln.
wa_vbeln-vbeln = s_vbeln-low.
APPEND wa_vbeln TO it_vbeln.
ENDLOOP.
Regards,
Ankur Parab -
How to create internal table storing instances of ABAP class
Hi experts, any one knows how to create internal table storing instances of ABAP class or alternative to implement such function?
Hi
Please see below example from ABAPDOCU, this might help you.
Internal Table cnt_tab is used to store class objects.
Regards,
Vishal
REPORT demo_objects_references.
CLASS counter DEFINITION.
PUBLIC SECTION.
METHODS: set IMPORTING value(set_value) TYPE i,
increment,
get EXPORTING value(get_value) TYPE i.
PRIVATE SECTION.
DATA count TYPE i.
ENDCLASS.
CLASS counter IMPLEMENTATION.
METHOD set.
count = set_value.
ENDMETHOD.
METHOD increment.
ADD 1 TO count.
ENDMETHOD.
METHOD get.
get_value = count.
ENDMETHOD.
ENDCLASS.
DATA: cnt_1 TYPE REF TO counter,
cnt_2 TYPE REF TO counter,
cnt_3 TYPE REF TO counter,
cnt_tab TYPE TABLE OF REF TO counter.
DATA number TYPE i.
START-OF-SELECTION.
CREATE OBJECT: cnt_1,
cnt_2.
MOVE cnt_2 TO cnt_3.
CLEAR cnt_2.
cnt_3 = cnt_1.
CLEAR cnt_3.
APPEND cnt_1 TO cnt_tab.
CREATE OBJECT: cnt_2,
cnt_3.
APPEND: cnt_2 TO cnt_tab,
cnt_3 TO cnt_tab.
CALL METHOD cnt_1->set EXPORTING set_value = 1.
CALL METHOD cnt_2->set EXPORTING set_value = 10.
CALL METHOD cnt_3->set EXPORTING set_value = 100.
DO 3 TIMES.
CALL METHOD: cnt_1->increment,
cnt_2->increment,
cnt_3->increment.
ENDDO.
LOOP AT cnt_tab INTO cnt_1.
CALL METHOD cnt_1->get IMPORTING get_value = number.
WRITE / number.
ENDLOOP. -
How to convert Internal Table to Cluster Table ?
How to convert Internal Table to Cluster Table ?
Use :
EXPORT itab TO DATABASE dbtab(ar) ID key.
<i>EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key.
Additions:
1. ... = f (for each field you want to export)
2. ... FROM f (for each field you want to export)
3. ... CLIENT g before ID key )
4. ... USING form
5. ... FROM wa (as last addition or after dbtab(ar))
In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See Implicit field names not allowed with clusters and Table work areas not allowed.
Effect
Stores a data cluster in database table dbtab. The specified objects obj1 ... objn (fields, structures, or tables) are stored as a single cluster in the database table dbtab.
The specified database table dbtab must have a standard structure.
The database table dbtab is divided into various logically-related sections (ar, two-character name).
You can export a collection of data objects (a data cluster) to a part of the database using a key (field key).
You can import individual data objects from this collection using the IMPORT statement.
Notes
In classes, you must always assign explicit names to the data objects you want to export, that is, you must use either addition 1 or addition 2.
In classes, you must always specify the work area explicitly, that is, addition 5 is obligatory.
The table dbtab that appears after DATABAE must be declared under TABLES (except in addition 5).
You cannot export the header lines of internal tables. If you specify the name of an internal table with header line, the system always exports the body of the table.
You cannot export data, object, or interface references.
The data is stored in the database, and is consequently not actually stored until a database commit occurs (see LUW). Until this point, you can undo all of your changes using a database rollback (see Programming Transactions).
Example
Exporting two fields and an internal table to the database table INDX:
TABLES INDX.
TYPES: BEGIN OF ITAB3_TYPE,
CONT(4),
END OF ITAB3_TYPE.
DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',
F1(4), F2 TYPE P,
ITAB3 TYPE STANDARD TABLE OF ITAB3_TYPE WITH NON-UNIQUE
DEFAULT KEY INITIAL SIZE 2,
WA_INDX TYPE INDX.
Fill the data fields before CLUSTR
before the actual export
INDX-AEDAT = SY-DATUM.
INDX-USERA = SY-UNAME.
Export der Daten.
EXPORT F1 FROM F1
F2 FROM F2
ITAB3 FROM ITAB3
TO DATABASE INDX(ST) FROM WA_INDX ID INDXKEY.
</i>
Regards -
How to get updated table values from objectlistdataproviders
how to get updated table values from objectlistdataproviders
Hi,
Here is a sample code
start-of-selection.
*Select the data you need into an internal table
loop at it_mara into wa_mara.
data that needs to be displayed in the output list
write:/ box as checkbox,
wa_mara-matnr under text-001,
wa_mara-maktx under text-002,
wa_mara-lgort under text-003.
Hide the data that needs to moved to internal table
hide:wa_mara-matnr, wa_mara-maktx, wa_mara-lgort.
endloop.
clear wa_mara.
end-of-selection.
lines = sy-linno.
at line-selection.
clear:it_matnr.
do lines times.
check sy-index > 1.
box = space.
read line sy-index field value box.
if box = 'X'.
*data selected using check box is moved to internal table
append wa_mara to it_matnr.
endif.
enddo.
Regards,
Jisha.
Maybe you are looking for
-
How to find a particular cookie?
I'm having an issue with the LA Times website. I don't normally use it that often, but during March I kept getting directed there via Google for news updates, and I apparently overstayed my welcome, as it started displaying a popup saying my "monthly
-
BLOG SUMMARY PAGE - is it possible to change?
Is it possible to create a rolling blog (i.e. no "READ MORE") and have all the entries one after another?
-
Oracle 8 on Linux, web server access
I've installed Oracle 8.0.5 on Linux and would like to know the best way to access it using CGI. I have a reasonable knowledge of C and would prefer not to have to switch to Java/JDBC. Do I have to use Pro*C? Where can I learn more about CGI scripts
-
Photo titles in Apple TV 2?
Am I missing a setting somewhere? How can I get my photo titles to show up on my Apple TV2? It seems only logical that I should be able to somehow see them when I see them either via the web (Mobile Me) or on my iPhone (Gallery) when synched from iPh
-
After restoring my G4 iphone its stuck on the apple and white bar.
I'v already restored it and restarted it 4 times. Still can't turn it on. PLEASE Help