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: 

script

Former Member
0 Kudos
88

hi all ,

i have two fields i.e land1 and spras i want to get the description for that field

(land1).both fields are stored in adrs table only.how to write the perform statemet

to fetch the description of the field.

4 REPLIES 4

Former Member
0 Kudos
40

Hello,

U need to make use of the table T005T, u get the desription of the land1and T002T for getting the language text.


/: PERFORM DATE IN PROGRAM ZLAND
/: USING &LAND1&
/: USING &SPRAS&
/: CHANGING &LAND1T&
/: CHANGING &SPRAS&
/: ENDPERFORM

In program ZLAND,


form Date tables intab structure itcsy
                 outab structure itcsy.
 
DATA: L_land1 TYPE land1,
      L_spras TYPE SPTXT.

 
read table intab with key name = 'LAND1'.
if sy-subrc = 0.
L_land11 = intab-value. " Select the country text ftom T005T
ENDIF.
 
read table intab with key name = 'SPRAS'.
if sy-subrc = 0.
L_SPRAS = intab-value. " Select the langaue text ftom T002T
ENDIF.

move the values to outtab.

If useful reward.

Vasanth

Former Member
0 Kudos
40

Hi,

In script write :

/:DEFINE &A1& = ' '

/:PERFORM GET_LANDX IN PROGRAM < Prog Name>

/:USING &Table/Structure -LAND1&

/:CHANGING &A1&

/:ENDPERFORM

  • &A1&

In the program write:

form get_landx tables in_par structure itcsy out_par structure itcsy.

data v_landx like t005t-landx, v_land1(3).

clear: v_land1, v_landx.

read table in_par with key <field of Land1).

if sy-subrc = 0.

v_land1 = in_par-value.

select landx from t005t

into v_landx

where land1= v_land1 and

spras = sy-langu.

if sy-subrc = 0.

out_par-name = 'A1'.

out_par-value = v_landx.

append out_par.

endif.

Regards,

Anji

Former Member
0 Kudos
40

Hi,

PERFORM commands, like all control commands, are executed when a document is formatted for display or printing. Communication between a subroutine that you call and the document is by way of symbols whose values are set in the subroutine.

Example:

Syntax in a form window:

/: PERFORM <test-form> IN PROGRAM <prog>

/: USING &land1&

/: USING &spras&

/: CHANGING &descpt&

/: ENDPERFORM

You can write a select statement within the subroutine of the program.

form test-form using p_land1 p_spras

changing p_desc.

select single descp into p_desc

from <table>

where land1 = p_land1

and spras = p_spras.

endform.

Regards,

Jayaram...

Former Member
0 Kudos
40

Hi,

If you still have doubts..just go thru this example.

Syntax in a form window:

/: PERFORM <form> IN PROGRAM <prog>

/: USING &INVAR1&

/: USING &INVAR2&

......

/: CHANGING &OUTVAR1&

/: CHANGING &OUTVAR2&

......

/: ENDPERFORM

INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.

OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.

The ABAP subroutine called via the command line stated above must be defined in the ABAP report prog as follows:

FORM <form> TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

...

ENDFORM.

The values of the SAPscript symbols passed with /: USING... are now stored in the internal table IN_TAB . Note that the system passes the values as character string to the subroutine, since the field Feld VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR 80). See the example below on how to access the variables.

The internal table OUT_TAB contains names and values of the CHANGING parameters in the PERFORM statement. These parameters are local text symbols, that is, character fields. See the example below on how to return the variables within the subroutine.

From within a SAPscript form, a subroutine GET_BARCODE in the ABAP program QCJPERFO is called. Then the simple barcode contained there (‘First page’, ‘Next page’, ‘Last page’) is printed as local variable symbol.

Definition in the SAPscript form:

/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO

/: USING &PAGE&

/: USING &NEXTPAGE&

/: CHANGING &BARCODE&

/: ENDPERFORM

/

/ &BARCODE&

Coding of the calling ABAP program:

REPORT QCJPERFO.

FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA: PAGNUM LIKE SY-TABIX, "page number

NEXTPAGE LIKE SY-TABIX. "number of next page

READ TABLE IN_PAR WITH KEY ‘PAGE’.

CHECK SY-SUBRC = 0.

PAGNUM = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY ‘NEXTPAGE’.

CHECK SY-SUBRC = 0.

NEXTPAGE = IN_PAR-VALUE.

READ TABLE OUT_PAR WITH KEY ‘BARCODE’.

CHECK SY-SUBRC = 0.

IF PAGNUM = 1.

OUT_PAR-VALUE = ‘|’. "First page

ELSE.

OUT_PAR-VALUE = ‘||’. "Next page

ENDIF.

IF NEXTPAGE = 0.

OUT_PAR-VALUE+2 = ‘L’. "Flag: last page

ENDIF.

MODIFY OUT_PAR INDEX SY-TABIX.

ENDFORM.

Regards,

Jayaram...