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: 

Sap Script / Abap transfer Values

Former Member
0 Kudos

Hey Everyone,

i am tasked with building a new Sap Script. When you print your Production Order (Not sure if its the correct word, its in the T-Code CO03) the Script should get printed.

If i understand correctly, you need to have a print program and a form, you can assign those in the OPK8.

But how do i get the AUFNR / other values of the current Production Order?

e.g. when i go into CO03 and enter AUFNR 1234 and hit print, how can i get the number 1234 inside of my abap code/form.

Any help would be appreciated!

Regards, Kevin

1 ACCEPTED SOLUTION

FredericGirod
Active Contributor

SAPScript in one word is the Form tool used in SE71.

The memory of the print program & the Form is shared.

In the print program, you will catch information of the CO03 (maybe just the key of the object). And you have to write Form routine to get all the data to be printed in the form. All these data needs to be global. And in the form you just have to used them.

What I really suggest, is to copy a standard print program of this transaction, and to rewrite or adapt the form. I know a lot of developer going made to try doing SAPScript from scratch.

Good luck

11 REPLIES 11

stefan_schnell
Active Contributor

Hello Kevin,

as far as I understand you correctly you want to execute an SAP GUI Script from ABAP. You can find here a possibility to realize that. On this way you can also use any GetProperty call.

Best regards
Stefan

Former Member

Hey st.schnell ,

thanks for your answer!

But i am not looking for VB Scripts, i want the Sap Scripts/Forms you can make in SE71.

Regards,

Kevin

FredericGirod
Active Contributor

SAPScript in one word is the Form tool used in SE71.

The memory of the print program & the Form is shared.

In the print program, you will catch information of the CO03 (maybe just the key of the object). And you have to write Form routine to get all the data to be printed in the form. All these data needs to be global. And in the form you just have to used them.

What I really suggest, is to copy a standard print program of this transaction, and to rewrite or adapt the form. I know a lot of developer going made to try doing SAPScript from scratch.

Good luck

0 Kudos

Hey frdric.girod ,

thanks for your answer!

There is a Z print Program which is currently used for printing something from the CO03, sadly the author does not work here anymore.

In that Program, "lcodrinc" gets includes, which uses

 IMPORT ITAB
 ITAB_TDR FROM MEMORY ID 'PPI'.

to get the data. But before i just blindly copy that, i would like to know what it means/how it works/why it works.

0 Kudos

In the standard transaction, or in a user-exit, there is a code that put the content of this internal table in the memory with the name PPI.

It's a way to put data in a global memory (at LUW level). Honestly it is little bit old school (as the SAPScript).

You could find the list of this memory, using the debugger.

If your Form is not different from the previous form. Copy the print program with specific includes & the form.

0 Kudos
Kevin Holtkamp The master piece of "The memory of the print program & the Form is shared", is the use of ABAP statement TABLES <structure/table name>. What you must look for is the name of this structure/table, look at the standard driver program (print program).It could be the TABLES indicated in INCLUDE PPCOINCL.About the print programs -> Transaction code OPK8 ->SAP Customizing Implementation Guide → Production → Shop Floor Control → Operations → Define Print Control -> HELP:
ID    List                            SAPscript Form       Print Program
LF01  PRT Overview                    PSFC_STD_LAYOUT      PSFCPRT
LG01  Object List                     PSFC_PRINT_LAY       PSFC_OBJECT_LIST
LG02  Operational Control Ticket      PSFC_STD_LAYOUT      PSFCOPCT
LG03  Job Ticket                      PSFC_STD_LAYOUT      PSFCJOBT
LG04  Kanban Card                     PSFC_KANBAN          PPPRKANB
LK01  Pull List                       PSFC_STD_LAYOUT      PSFCPICK
LK02  Goods Issue Slip                PSFC_STD_LAYOUT      PSFCGISS
LK03  Receipt List                    PSFC_STD_LAYOUT      PSFCGRCL
LV01  Time Ticket                     PSFC_STD_LAYOUT      PSFCTIME
LV02  Confirmation Slip               PSFC_STD_LAYOUT      PSFCCONF
LV03  Document Links                  PSFC_DOC_LINKS       PSFC_DOCLINK_LIST
LV04  Operation Splitting             PSFC_STD_LAYOUT      PSFCSPLT

0 Kudos

Thanks everyone for your help!
This is the solution that i ended up using:

1. Go to Transaction OPK8

2. Go to Forms/Print programs and enter your Form name and Program name respectively

3. In your Program, import ITAB from memory id 'PPI'

4. Now the data is in ITAB and you can use it inside your Print program or Form

stefan_schnell
Active Contributor
0 Kudos

Hello Kevin,

sorry for this misunderstanding 😉

Best regards
Stefan

Sandra_Rossi
Active Contributor

Kevin, the mistake you did is that you tagged your question with UI SAP GUI for Windows, which is for SAP GUI Scripting (not your question). For SAPScript, just tag it ABAP, it should be fine.

Former Member

Hey sandra.rossi , thanks for clarifying!

I removed the tag, sorry for the mistake.

Sandra_Rossi
Active Contributor
0 Kudos

No problem. As I guess your question is answered, don't hesitate to write a little feedback to the accepted answer, then close the question.