cancel
Showing results for 
Search instead for 
Did you mean: 

scripts line1

Former Member
0 Kudos

Hi,

Why they r using line1 line2 as key name can any one explain detailly?

*set address

read table out_tab with key name = 'LINE1'.

if sy-subrc = 0.

out_tab-value = lv_line1.

modify out_tab index sy-tabix.

endif.

Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

I think ur doubt might have already been clarified.

But this info will be useful, if u want to go deep into the subject....

Usually we pass the varibles from Script forms to the Subroutine pool for performing the operations using normal ABAP programming.

So the actual parameters sent from the PERFORM statement will be received in the subroutine pool using the table intab which is of type 'itcsy'.If u check this structure,it contains 2 fields,namely NAME & VALUE.

Similarly u can send the values to the form from the table outtab, which is of the same structure as intab.

For ex, we've sent 4 variables to the subroutine pool.Inoredr to identify them, we'll use the field NAME. Let us assume that we've sent material number value using the parameter v_matnr . Then in intab its value will be stored as follows:

intab-name = 'v_matnr'.

intab-value = 11111.

So, whenever we send more than one variable, we can fetch their values using their names.Thats y he has used that name field.

Instead u can use the index values to fetch the values set from the PERFORM statements.....

I m sending u the sample code, just go throgh that, if required.

PERFORM in script form:

/: PERFORM GET_MERCANTIL IN PROGRAM CUST_INVOICE

/: USING &RKWA-BUKRS&

/: USING &RKWA-LIFNR&

/: USING &BKPF-GJAHR&

/: CHANGING &V_MERCANTIL&

/: ENDPERFORM

GT Insc.Reg.Mercantil &V_MERCANTIL&

****Program CUST_INVOICE********

*Local Constants

CONSTANTS : l_c_bukrs TYPE fieldname VALUE 'RKWA-BUKRS', " Field name

l_c_lifnr TYPE fieldname VALUE 'RKWA-LIFNR', " Field name

l_c_gjahr TYPE fieldname VALUE 'BKPF-GJAHR', " Field name

l_c_pc TYPE fieldname VALUE 'PC'. " Field name

*Local Variables

DATA : l_v_bukrs TYPE bukrs, " Company code

l_v_lifnr TYPE lifnr, " Account Number of Vendor

l_v_gjahr TYPE gjahr, " Fiscal Year

l_v_mercantil TYPE /eur/fibfc_mercantil. " Reg. Mercantil (Text for footer Window)

*Field symbols

FIELD-SYMBOLS <l_fs_tab> TYPE itcsy. "Output table

  • Read the Company code from the input table

READ TABLE fp_i_input_table ASSIGNING <l_fs_tab>

WITH KEY name = l_c_bukrs.

IF sy-subrc EQ 0.

  • Copying the value to the local variable

l_v_bukrs = <l_fs_tab>-value.

ENDIF.

  • Read the Vendor Account Number from the input table

READ TABLE fp_i_input_table ASSIGNING <l_fs_tab>

WITH KEY name = l_c_lifnr.

IF sy-subrc EQ 0.

  • Copying the value to the local variable

l_v_lifnr = <l_fs_tab>-value.

ENDIF.

  • Read the Fiscal Year from the input table

READ TABLE fp_i_input_table ASSIGNING <l_fs_tab>

WITH KEY name = l_c_gjahr.

IF sy-subrc EQ 0.

  • Copying the value to the local variable

l_v_gjahr = <l_fs_tab>-value.

ENDIF.

  • Select Reg. Mercantil from Vendor Invoice number for consignment table

SELECT reg_mercantil " Reg. Mercantil (Text for footer Window)

FROM /eur/fibt_invnu1

INTO (l_v_mercantil)

UP TO 1 ROWS

WHERE bukrs EQ l_v_bukrs

AND blart EQ l_c_pc

AND lifnr EQ l_v_lifnr

AND gjahr EQ l_v_gjahr.

ENDSELECT.

IF sy-subrc EQ 0.

  • Read the output table

READ TABLE fp_i_output_table ASSIGNING <l_fs_tab>

INDEX 1.

IF sy-subrc EQ 0.

  • Populate the output table with the value of Reg. Mercantil

<l_fs_tab>-value = l_v_mercantil.

ENDIF.

ENDIF.

Former Member
0 Kudos

Hi,

The subroutine that is being called in the layout would have a changing field of line2. Hence they read the out_tab table with the key line2 as that will be stored in out_tab-name.

/: PERFORM XXX IN PROGRAM YYY

/: USING &AAA-BBB&

/: CHANGING &LINE2&

/: ENDPERFORM

Hope this clarifies.

Regards,

Narendra.

Former Member
0 Kudos

Hello,

This are the paramters passed in the SAP script, as in the line editor we can use the perform statement with using and changing parameters. Do check the same in the SAP script.