06-07-2010 2:21 PM
Hi,
I am adding two condition price in scripts forms.
in my driver program there is routine..
FORM get_objid TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
In the out_tab there r 3 rows,
i want to add one more line in out_tab.
eg.
READ TABLE out_tab WITH KEY name = text-T71. "NETPR2
CHECK sy-subrc = c_zero.
if sy-subrc is initial.
out_tab-value = lv_kwert1.
MODIFY out_tab INDEX sy-tabix.
clear lv_kwert1.
But not able to any one..
Moderator message: please use more descriptive subject lines from now on.
Edited by: Thomas Zloch on Jun 7, 2010 4:22 PM
06-07-2010 2:32 PM
Hi
you must use append statement....
if sy-subrc is initial.
out_tab-value = lv_kwert1.
MODIFY out_tab INDEX sy-tabix. ------>you cannot use sy-tabix....if is 1????
you replace the 1st position
and not append.
replace with
if sy-subrc is initial.
out_tab-value = lv_kwert1.
APPEND out_tab.
Best regards
Marco
Edited by: Menegazzo Marco on Jun 7, 2010 3:36 PM
06-07-2010 2:32 PM
Hi
you must use append statement....
if sy-subrc is initial.
out_tab-value = lv_kwert1.
MODIFY out_tab INDEX sy-tabix. ------>you cannot use sy-tabix....if is 1????
you replace the 1st position
and not append.
replace with
if sy-subrc is initial.
out_tab-value = lv_kwert1.
APPEND out_tab.
Best regards
Marco
Edited by: Menegazzo Marco on Jun 7, 2010 3:36 PM
06-07-2010 2:44 PM
Hi marco
out_tab has name & value field.
I want know how can we add one more name for eg :NETPR2
if the NETPR2 is there in out_tab then only we can read it & append or modify its value.
06-07-2010 2:50 PM
Hi jayesh,
Do u means to say that we use it like this.
out_tab-name = 'NETPR2'.
append out_tab.
READ TABLE out_tab WITH KEY name = text-T71. "NETPR2
CHECK sy-subrc = c_zero.
if sy-subrc is initial.
out_tab-value = lv_kwert1.
MODIFY out_tab INDEX sy-tabix.
clear lv_kwert1.
endif.
is it correct way..
06-07-2010 2:53 PM
Hi
READ TABLE out_tab WITH KEY name = text-T71. "NETPR2
you check if on out_tab there's the name NETPR2
if sy-subrc is initial.
if you find
out_tab-value = lv_kwert1.
change the value
APPEND out_tab
and add the the record with the the same name but a different value.....
is this what you want??or you want simply change the value of the record read?
couse if wonna change the value you just use
MODIFY out_tab.
without sy-tabix...cose you have a itable with header line...
and sy-tabix in this moment not have the correct index
regards
Marco
06-07-2010 3:07 PM
Hi,
this is not the correct way.
when you creating (using append staement) why don't you fill the value at same time.
no need to do modify .
Ashutosh.
06-07-2010 2:39 PM
Hi,
To add a line to the internal table, use APPEND statement. MODIFY will change the existing record of the internal table.
Regards,
Jayesh
06-07-2010 5:21 PM
Add a line in the SAPScript PERFORM routine (you need one more CHANGING parameter). The changing names are positional, so if you have 2 CHANGING parameters, you put them in the OUT_TAB in the same sequence (index no.) as they appear in your PERFORM routine in the SAPScript.
In your performed subroutine, you will receive one row in OUT_TAB for each CHANGING parameter named in the PERFORM routine, and one row in IN_TAB for each USING parameter.
06-07-2010 5:58 PM
Hi,
Open your Sapscript and look for the PERFORM statement in the Main window.
Search for PERFORM get_objid in the MAIN window, then add the NETPR2 in CHANGING, then you can use that in the FORM statement as third line.
Sample
/: PERFORM get_objid IN PROGRAM ZABC
/: USING &AAA&
/: USING &BBB&
/: CHANGING &NETPR0&
/: CHANGING &NETPR1&
/: CHANGING &NETPR2& " Add this statement in the Sapscript Main window
/: ENDPERFORM
Regards
Bala Krishna
06-08-2010 6:26 AM