cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying line items in SAP script layout using subroutine pool

Former Member
0 Kudos

Hi All,

I am working on SAP script in which there is a requirement wherein, I have to fetch values from tables for line items in the Main Window. As per my coding, right now it will fetch only the first value from the table. It is fine if there is only one line item. But if there are more than one line items I need to fetch all the values and display them.

Could anyone suggest any way this can be done.

Thanks

Neha

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

The correct solution would be to modify the print program to loop through the table and call a text element to print the line.

If you can't modify the print program you could use a series of PERFORMs in the SAPScript, each retrieving a different specific line. This is a bad solution, since you need to create as many PERFORMs as the maximum possible lines in the table for the item.

Former Member
0 Kudos

IN sapscript

/: PERFORM GET_BILL_PARTNER IN PROGRAM XYZ

/: USING &VBDKL-VBELN&

/: CHANGING &BILL_TO_PART&

/: ENDPERFORM

IN Subroutine program >> XYZ(in SE38)

FORM get_bill_partner TABLES input_table STRUCTURE itcsy

output_table STRUCTURE itcsy.

DATA: lws_vbeln LIKE vbak-vbeln, "Sales Number

lws_kunnr LIKE vbpa-kunnr,

lws_parvw LIKE vbpa-parvw.

  • Read the input variables.

LOOP AT input_table.

lws_vbeln = input_table-value.

ENDLOOP.

*Add leading zero's to delivery number

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lws_vbeln

IMPORTING

output = lws_vbeln.

CALL FUNCTION 'CONVERSION_EXIT_PARVW_INPUT'

EXPORTING

input = 'BP'

IMPORTING

output = lws_parvw.

SELECT SINGLE kunnr INTO lws_kunnr

FROM vbpa

WHERE vbeln = lws_vbeln

AND parvw = lws_parvw.

*Pass Ship-To Party value

LOOP AT output_table.

IF output_table-name = 'BILL_TO_PART'. "Description of Shipment

output_table-value = lws_kunnr.

ENDIF.

MODIFY output_table.

ENDLOOP.

I guess this will resolve your question

Former Member
0 Kudos

I gues it can't bepossible

try to use static keyword and built your logic