Application Development and Automation 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: 
Read only

sapscript problem

Former Member
0 Likes
886

Hi,

I have creted a simple sapscript example which contains 3 windows: main, data and header. Data window displays current date, header some information like address,etc and in main I have declared an element called MAIN_ELEMENT.

I want to output BNAME,ANAME,ERDAT,LOCNT columns from USR02 table in main window.

How to do that??

Please someone help me.

Helpfull answers will be fully rewarded.

Thank you!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
869

in your driver program

select BNAME,ANAME,ERDAT,LOCNT from usr02 into corresponding fields of table t_usr02 where

<your select condition>

loop at usr02.

call function write_form

element = MAIN_ELEMENT.

endloop.

in sapscript, under MAIN_ELEMENT.

&T_USR02-BNAME& &T_USR02-ANAME& &T_USR02-ERDAT& &T_USR02-LOCNT&

let me know if you need further clarification

7 REPLIES 7
Read only

Former Member
0 Likes
869

well you got a driver-program for your script already?

shall the information in main window be of position type, means will there be more records to be displayed or just the data of a specific user?

Read only

Former Member
0 Likes
870

in your driver program

select BNAME,ANAME,ERDAT,LOCNT from usr02 into corresponding fields of table t_usr02 where

<your select condition>

loop at usr02.

call function write_form

element = MAIN_ELEMENT.

endloop.

in sapscript, under MAIN_ELEMENT.

&T_USR02-BNAME& &T_USR02-ANAME& &T_USR02-ERDAT& &T_USR02-LOCNT&

let me know if you need further clarification

Read only

0 Likes
869

OK ... but is another solution ... with 2 internal tables(IN and OUT) type of ITCSY structure. ??? How to do in this way?

Read only

0 Likes
869

in ur sapscript...

PERFORM GET_userdate IN PROGRAM Z_<ur driverprogram>

USING &<if u have to send some variable to get data>&

CHANGING &BNAME&

CHANGING &var2&

ENDPERFORM

in ur program

FORM GET_USERDATA TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

READ TABLE IN_PAR WITH KEY <ur using variable>.

select data from usr02.

. READ TABLE OUT_PAR WITH KEY 'BNAME'.

IF SY-SUBRC EQ 0.

OUT_PAR-VALUE = ur bname value.

MODIFY OUT_PAR INDEX sy-tabix..

endif.

READ TABLE OUT_PAR WITH KEY 'var2'.

IF SY-SUBRC EQ 0.

OUT_PAR-VALUE = ur var2 value.

MODIFY OUT_PAR INDEX sy-tabix..

endif.

Read only

0 Likes
869

many thanx my friends...

Regards,

Dan

Read only

Former Member
0 Likes
869

Hi,

Get all those values in different variables e.g. Say A , B , C etc

print those thru SAP Script by mentioning them under MAIN_ELEMENT &A& &B& , &C& etc.

I hope this helps,

Regards,

Raju Chitale

Read only

Former Member
0 Likes
869

Hi,

Is your question relating to the layout or the provision of data?

The layout can be achieved by defining tabs in the paragraph format of your SAPscript and sperating the fields in the text elements with ,, (that's two commas).

Regards,

Nick