Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Scripts

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member196079
Active Contributor
0 Kudos

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

9 REPLIES 9

former_member196079
Active Contributor
0 Kudos

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

0 Kudos

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.

0 Kudos

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..

0 Kudos

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

0 Kudos

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.

jayesh_gupta
Active Participant
0 Kudos

Hi,

To add a line to the internal table, use APPEND statement. MODIFY will change the existing record of the internal table.

Regards,

Jayesh

Former Member
0 Kudos

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.

former_member585060
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi

Bala , marco ,breakpoint.

thanks for helpfull answer.