cancel
Showing results for 
Search instead for 
Did you mean: 

Purchase Order SAPscript - Looping problem.

Former Member
0 Kudos

Dear Friends,

I am using a PO Z-form which is a copy of MEDRUCK and print program is Standard SAPLMEDRUCK Program.

I have got a Scenario something like this.

I have to display some classification details of material ( from material master ) in PO.

A material will have 2 or 3 Classes, Each class has got some details.

I have to loop for each class and display the details.

Since I am using Standard Print Program, I Can't Change that.

Is there any workaround method for the above requirement.

Regards,

Hari.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Solved on my own.

Former Member
0 Kudos

Hello Hari,

In order to acheive ur requirement u need to write a routine inside the script .

Inside the text editor make the statment like


perform xxxx in program zzzzzz
using &fieldname1&
changing &fieldname2&
endperform.

Just make your using and changing parameters as per your details .

In the program u can retrive the values as per your requirement with out touching the standard driver program,

If u have any more issues kinfdly revert.

Cheers,

Joe

Former Member
0 Kudos

Hello Sarves,

I can take all the details by using a subroutine in Z program.

My Problem here is to Print.

Is it Possible to Call "WRITE_FORM" in that Subroutine.

Hari

Former Member
0 Kudos

hi

you should not call the WRITE_FORM inside the Subroutine , instead change the layout as per the requiremensts

i.e after you get the values from the Subroutine

surya

former_member585060
Active Contributor
0 Kudos

Hi Hari,

There is not need to use that WRITE_FORM FM,

Instead write the PERFORM statement in the window where you need to display the classification values and after immediately give the variables which holds the classification values.

Example

/:PERFORM GET_COMCODE IN PROGRAM ZM_RFQ_REJECTION
/:USING &EKKO-BUKRS&
/:USING &EKKO-SPRAS&
/:CHANGING &SADR-NAME1&
/:CHANGING &SADR-NAME2&
/:CHANGING &SADR-NAME3&
/:CHANGING &SADR-PSTLZ&
/:CHANGING &SADR-NAME4&
/:ENDPERFORM

B &SADR-NAME1&,, &SADR-NAME2&,,&SADR-NAME3&,, &SADR-PSTLZ&,, &SADR-NAME4&

as in above example you pass the Material no in USING field and in CHANGING fields DEFINE variables for classification and pass

Regards

Bala Krishna

Former Member
0 Kudos

Hi Hari,

You can't do any dynamic looping in the SAPscript, this can only be done in the print program. If you have no option to copy the print program you can only add static lines to the form.

Regards,

Nick

Former Member
0 Kudos

HI, Try like this just use a subroutine in the script, do the looping of the class in a zprogram and get the details back to the script. Just check for the Subroutines in scripts in SAP HELP [Calling ABAP Subroutines: PERFORM|http://help.sap.com/saphelp_40b/helpdata/en/d1/803279454211d189710000e8322d00/content.htm] Regards Sarves