cancel
Showing results for 
Search instead for 
Did you mean: 

Link two tables in SAPscript

Former Member
0 Kudos

Hi all.

Can we link two tables in SAPscript like in abap coding?

I have a code from other table and I need to pull the txt of the code from its master table.

Is it possible to do this?

Thanks in advance.

Regards

az

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Yes you can.You need to code either in driver program of use a perform to call your own program in scripts. Use FM READ_TEXT to get the text if you want.

Reward if helpful.

Thanks,

Dishant

Former Member
0 Kudos

Hi Dishant.

Thanks for your reply.

Can you tell me how to use function module read_text, where to put the function, anything related in detail.

Im very new to SAPscript, hope that you can help.

Thanks

az

Former Member
0 Kudos

Hi,

If you are creating your own Z program. use like this:

Check below,

In the script window where you want to put the text write:

PERFORM get_address in program ZPR(ie your prog name) USING &var1&

CHANGING &var2&.

Now in your Z program.

FORM get_address TABLES pt_input STRUCTURE itcsy

pt_output STRUCTURE itcsy.

TABLES: ekko,t880,t024.

TYPES: BEGIN OF structadd,

name1 LIKE t880-name1,

stret LIKE t880-stret,

city LIKE t880-city,

cntry LIKE t880-cntry,

pstlc LIKE t880-pstlc,

END OF structadd.

DATA: address TYPE structadd,

ponumber LIKE ekko-ebeln,

countryname LIKE t005t-landx,

companycode LIKE t880-rcomp.

READ TABLE pt_input INDEX 1.

IF sy-subrc = 0.

ponumber = pt_input-value.

ENDIF.

SELECT SINGLE bukrs FROM ekko

INTO companycode WHERE ebeln = ponumber.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = companycode

IMPORTING

output = companycode.

SELECT SINGLE name1 stret city cntry pstlc FROM t880

INTO address WHERE rcomp = companycode.

SELECT SINGLE landx FROM t005t INTO countryname

WHERE land1 = address-cntry AND spras = 'EN'.

READ TABLE pt_output WITH KEY name = 'NAME1'.

pt_output-value = address-name1.

MODIFY pt_output TRANSPORTING value WHERE name = 'NAME1'.

READ TABLE pt_output WITH KEY name = 'STRET'.

pt_output-value = address-stret.

MODIFY pt_output TRANSPORTING value WHERE name = 'STRET'.

READ TABLE pt_output WITH KEY name = 'CITY'.

pt_output-value = address-city.

MODIFY pt_output TRANSPORTING value WHERE name = 'CITY'.

READ TABLE pt_output WITH KEY name = 'CNTRY'.

pt_output-value = countryname.

MODIFY pt_output TRANSPORTING value WHERE name = 'CNTRY'.

READ TABLE pt_output WITH KEY name = 'PSTLC'.

pt_output-value = address-pstlc.

MODIFY pt_output TRANSPORTING value WHERE name = 'PSTLC'.

ENDFORM. "get_address

Reward if helpful.

Thanks,

Dishant

Answers (0)