cancel
Showing results for 
Search instead for 
Did you mean: 

Write FORM doesn't work IN SAPSCRIPT

Former Member
0 Kudos

i'm Sure my internal table contain wealth of Data (multiline)

DATA : begin of d_append occurs 100,

STAWN type EIPO-STAWN,

TEXT1 type T604T-TEXT1,

SUM type EKPO-NETWR,

SUM1 type EKPO-NETWR,

end of d_append.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

FORM = 'ZMEDRUCK2'

language = sy-langu

EXCEPTIONS

others = 1.

" CALL FUNCTION 'WRITE_FORM'

" EXPORTING

" element = 'ITEM_HEADER_F'

" window = 'MAIN'.

CALL FUNCTION 'CLOSE_FORM' .

and i must to pass this internal table in TEXT element in sapscript

in sapscript

/: PERFORM NGPGROUP IN PROGRAM Z_GROUP_NGP

/: USING &EKKO-EXNUM&

/: USING &EKKO-EBELN&

/: CHANGING &D_APPEND-STAWN&

/: CHANGING &D_APPEND-TEXT1&

/: CHANGING &D_APPEND-SUM&

/: CHANGING &D_APPEND-SUM1&

/: ENDPERFORM

but the result in me9f is empty

please somebody have an idea ??

KHABLACHI BESSEM

Accepted Solutions (0)

Answers (1)

Answers (1)

naresh_bammidi
Contributor
0 Kudos

Hey you can not pass internal table data to script using perform in script.so here looping the internal table will not work .i guess you are using subroutine pool.am i right?if any help revert me.

with regards

Naresh

Edited by: naresh bammidi on Jan 23, 2012 12:34 PM

Former Member
0 Kudos

i PASS TWO PARAMETERS FROM THE SAPSCRIPT CHECK MY SELECT WITH INNER JOIN ...

and

pass the result in intenal tables

REPORT Z_GROUP_NGP.

&----


*& Form NGPGROUP

&----


  • text

----


  • -->IN_TAB text

  • -->OUT_TAB text

----


FORM NGPGROUP TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.

  • Get first parameter in input table.

READ TABLE in_tab INDEX 1.

WRITE in_tab-value TO l_EXNUM .

READ TABLE in_tab INDEX 2.

MOVE in_tab-value TO l_EBELN.

DATA : begin of d_append occurs 100,

STAWN type EIPO-STAWN,

TEXT1 type T604T-TEXT1,

SUM type EKPO-NETWR,

SUM1 type EKPO-NETWR,

end of d_append.

my internal table with full and multiline data is d_append

my test element in sapscript is "

/E ITEM_HEADER_F

So how to pass the result of my query to sapscript ???

naresh_bammidi
Contributor
0 Kudos

From your sap script pass only two parameters to report.

/: PERFORM NGPGROUP IN PROGRAM Z_GROUP_NGP
/: USING &EKKO-EXNUM&
/: USING &EKKO-EBELN&

Fetch the details based on the parameters.Now you have the data in internal table.

in script under this perform create one more element

For eg:

/e 100
*    wa_value1,,wa_value2,wa_value3

Now loop this element from your report.(this element should be in MAIN window).

Former Member
0 Kudos

********************************************IN program report*******************************************

loop at d_append .

"WRITE 😕 d_append-STAWN , d_append-SUM , d_append-SUM1 , d_append-TEXT1 . " my table is full data

CALL FUNCTION 'START_FORM'

EXPORTING

Form = 'ZMEDRUCK2'

program = 'Z_GROUP_NGP'.

  • Call WRITE FORM

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '100'

window = 'MAIN'.

  • Call END FORM

CALL FUNCTION 'END_FORM'.

  • Call CLOSE FORM

endloop.

**************************************************************IN SAPSCRIPT****************************

i create new text element '100'

/E 100

/: PERFORM NGPGROUP IN PROGRAM Z_GROUP_NGP

/: USING &EKKO-EXNUM&

/: USING &EKKO-EBELN&

/: ENDPERFORM

  • &D_APPEND-STAWN&

result in sapscript still empty data

Edited by: Bassem KHABLACHI on Jan 23, 2012 2:35 PM

naresh_bammidi
Contributor
0 Kudos

Give a try by changing the code as below

********************************************IN program report*******************************************

"WRITE 😕 d_append-STAWN , d_append-SUM , d_append-SUM1 , d_append-TEXT1 . " my table is full data

CALL FUNCTION 'open_FORM'     " changed start_form to Open_form
EXPORTING
Form = 'ZMEDRUCK2'
program = 'Z_GROUP_NGP'.
* Call WRITE FORM

loop at d_append .                       " changed here

CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = '200'                             " changed here
window = 'MAIN'.
* Call END FORM
CALL FUNCTION 'END_FORM'.
* Call CLOSE FORM

endloop.

**************************************************************IN SAPSCRIPT****************************

i create new text element '100'

/E 100 
/: PERFORM NGPGROUP IN PROGRAM Z_GROUP_NGP
/: USING &EKKO-EXNUM&
/: USING &EKKO-EBELN&
/: ENDPERFORM

/e  200                                     " changed here
* &D_APPEND-STAWN&

Put break point to script and see the values in the internal table d_append and see whether all values are passing to script or not.

Former Member
0 Kudos

Good morning ,

when i put a break point to script and i see the values in the internal table d_append and see whether all values are passing to script or not. i found that the debugguer can't see ELEMENT /E 200 or /E 100 and continue execution ,

So when i put in Standart element like 'ITEM_HEADER_F' ,the debugguer can acces to write form

then he can't see the values passed with loop in the internal table

So please if you have a sample code report and sapscritpt

just to have a look and i will do the same with my query .

Thanks a lot for your time man ,i hope that idea work ,i need to know this functionality to solve problem

KHABLACHI BESSEM

nabheetscn
Active Contributor
0 Kudos

have you passed corresponding text element in write_form..?

nabheet

Former Member
0 Kudos

no where i can use this line 'corresponding text element in write_form.' ??

nabheetscn
Active Contributor
0 Kudos

In write_form importing parameter is there by name of ELEMENT pass this element.Make sure all the variables are global that is a comon mistake which we always do.

Nabheet

Former Member
0 Kudos

in sapsript -


/E 200

/: PERFORM NGPGROUP IN PROGRAM Z_GROUP_NGP

/: USING &EKKO-EXNUM&

/: USING &EKKO-EBELN&

/: ENDPERFORM

  • &D_APPEND-STAWN&

-


in report----


form REPORT Z_GROUP_NGP

...

.....

DATA : begin of d_append occurs 100,

STAWN type EIPO-STAWN,

TEXT1 type T604T-TEXT1,

SUM type EKPO-NETWR,

SUM1 type EKPO-NETWR,

end of d_append.

select from inner join .... ""d_append have a data

loop at d_append

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '200' " changed here

window = 'MAIN'.

....

.....

endloop

i want to know if we have other way to decalre a global variable ...

an example will be great to understand the problem

nabheetscn
Active Contributor
0 Kudos

Global declaration is something which is available everywhere..Declare these parameters just after the report statement not in your sub routines.

Nabheet

Former Member
0 Kudos

you have an exemple how to pass table to sapcript !!??

nabheetscn
Active Contributor
0 Kudos

What do you intend to achieve can you please specify ind etail

Nabheet

Former Member
0 Kudos

in the debugguer after i put ths internal table in global définition

in the funtion write form we have this line :

check co_perform-active <> true. ==> the value passed is 'X'

i change this value in the debbuguer => value ' ' /*empty

internal Erreur SAPscript LSTXCFEV(4)

i found my result query in sapscript with only two line in 8 page

this is a problem

Former Member
0 Kudos

juste have you an idea how to set element '100' in table element because when i debug

i found ELEMENT [] contain all element declared in standard report

but element 100 doesn't exist

/e 100

write from

..

element = '100'

window = main

Former Member
0 Kudos

Hello Bassem KHABLACHI.... I wanted to ask you.. did you find a solution for your problem? I have the same problem