cancel
Showing results for 
Search instead for 
Did you mean: 

prob;em with perform

Former Member
0 Kudos

Hi I am using perform to get the data .So for that i am using perform in sap script as follows.

/: PERFORM GET_TEXT IN PROGRAM ZSGTEXT_FORM.

/: USING &RFDUZI01-BELNR&

/: CHANGING &RFDUZI01-SGTXT&.

/: ENDPERFORM

After that in abap program i am writing the code as follows.

REPORT ZSGTEXT_FORM .

tables:bseg.

FORM GET_TEXT TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

data: i_BELNR like bsid-XBLNR,

  • i_xblnr like bsid-xblnr,

  • ,

i_sgtxt type sgtxt.

data: begin of lt_belnr occurs 0,

lv_belnr type BELNR_D,

lv_sgtxt type sgtxt,

end of lt_belnr.

data: v_belnr type belnr_d.

READ TABLE IN_TAB INDEX 1.

WRITE IN_TAB-VALUE TO i_belnr .

READ TABLE out_tab INDEX 1.

select belnr sgtxt from bsid into table lt_belnr where xblnr = i_belnr.

loop at lt_belnr.

*read table lt_belnr index sy-tabix.

move lt_belnr-lv_belnr to v_belnr.

move lt_belnr-lv_sgtxt to out_tab-value.

*

modify out_tab index sy-tabix.

*append out_tab.

endloop.

*read table

endform.

But from the above code i am facing one problem.

If there is only one line item it is working fine,but if there is more than one line item then it is over writing the first vaue with second one how to handle this.

Thanks.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

As per my knowledge it is not possible to pass the entire table at a time using PERFORM in PROGRAM ,,, USING and CHANGING.

Solutions:

1) If possible do the same thing in the Print Program:

using CONTROL_FORM call element and print in the script

2) if you know the all table entries.: Pass all records at time:

Ex: PERFORM Pxxxx in PROGRAM PROGXXXX

USING <MATNR1>

<MATNR2>

<MATNR3>..............

CHANGING < MAKTX1>

<MAKTX2>

<MAKTX3>............

ENDPERFORM

in program program:

loop at IN_TAB .

case in_tab-name = MATNR1

write the code

case in_tab-name = MATNR1

ENDCASE.

endloop.

Reward if helpful.

Bye

Former Member
0 Kudos

Hi,

U can only transport only one value from your subroutine back to the script. The mistake ur doing is that u are looping and then appending out_tab. when the control goes out of ur subroutine,only the last value would be taken in your script.

Thanks

Nayan

Former Member
0 Kudos

Hi ,

How to call element in SE38 program.

Append is also not working

former_member195383
Active Contributor
0 Kudos

declare a work area of the type similar to out_tab.

in the last loop do the following..

loop at lt_belnr.

move lt_belnr-lv_belnr to wa_out_tab-v_belnr.

move lt_belnr-lv_sgtxt to wa_out_tab-value.

*

append wa_out_tab to out_tab .

endloop.

former_member195383
Active Contributor
0 Kudos

instead of modify...use append...

instead of overwriting this will append the new record....

Reward points if the above ans is useful...

Edited by: Rudra Prasanna Mohapatra on Jun 19, 2008 12:13 PM

Former Member
0 Kudos

Hi Mohan,

In SE38 in LOOP ENDLOOP call the text element ELEMENT1.

so every time u pass the BELNR and get SGTEXT and write it down.

/E ELEMENT1
/: PERFORM GET_TEXT IN PROGRAM ZSGTEXT_FORM.
/: USING &RFDUZI01-BELNR&
/: CHANGING &RFDUZI01-SGTXT&.
/: ENDPERFORM
*&RFDUZI01-SGTXT&

Best regards,

raam