Application Development and Automation 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: 
Read only

reg sapscript

Former Member
0 Likes
502

hi

TABLES : LFA1,EKKO, EKPO.

DATA : BEGIN OF ITAB OCCURS 0,

LIFNR LIKE LFA1-LIFNR,

EBELN LIKE EKKO-EBELN,

END OF ITAB.

DATA : BEGIN OF JTAB OCCURS 0,

LIFNR LIKE LFA1-LIFNR,

NAME1 LIKE LFA1-NAME1,

LAND1 LIKE LFA1-LAND1,

END OF JTAB.

DATA :BEGIN OF KTAB OCCURS 0,

EBELN LIKE EKPO-EBELN,

MATNR LIKE EKPO-MATNR,

MENGE LIKE EKPO-MENGE,

NETWR LIKE EKPO-NETWR,

END OF KTAB.

DATA : BEGIN OF CTAB OCCURS 0,

EBELN LIKE EKKO-EBELN,

LIFNR LIKE LFA1-LIFNR,

NAME1 LIKE LFA1-NAME1,

LAND1 LIKE LFA1-LAND1,

MATNR LIKE EKPO-MATNR,

MENGE LIKE EKPO-MENGE,

NETWR LIKE EKPO-NETWR,

END OF CTAB.

PARAMETER : P_EBELN LIKE EKKO-EBELN.

SELECT LIFNR EBELN FROM EKKO INTO TABLE ITAB WHERE EBELN = P_EBELN.

SELECT lifnr NAME1 LAND1 FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE JTAB FOR ALL ENTRIES IN ITAB WHERE LIFNR = ITAB-LIFNR.

SELECT ebeln MATNR MENGE NETWR FROM EKPO INTO CORRESPONDING FIELDS OF TABLE KTAB FOR ALL ENTRIES IN ITAB WHERE EBELN = ITAB-EBELN.

i have to prepear sapscript.

in 1 window i should show name and land correponding to lifnr

in the main window i have to show matnr netpr menge correponding to doc no

in 2 window i have to show the doc no.

my question how to call the function module should i loop each itable.

one open_form then how to loop the internal tables or should i move to into the final itable.

pls explain.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
482

Hi Ali,

Pseudo code for driver program

<b>in 1 window i should show name and land correponding to lifnr</b>

READ TABLE JTAB WITH KEY LIFNR

Use WRITE_FORM with window name

In Scirpt: &JTAB-LIFNR& &JAB-LAND1&

<b>in the main window i have to show matnr netpr menge correponding to doc no</b>

LOOP AT KTAB.

Use WRITE_FORM with window name as 'MAIN'

In Scirpt: &KTAB-MATNR& &KAB-NETPR& &KTAB-MENGE&

ENDLOOP.

<b>in 2 window i have to show the doc no.</b>

READ TABLE ITAB WITH KEY EBELN

Use WRITE_FORM with window name

In Scirpt: &ITAB-EBELN&

Thanks,

Vinay

3 REPLIES 3
Read only

Former Member
0 Likes
482

HI,

PLS HELP ON THIS QUESTION

Read only

0 Likes
482

Hi,

If you want to print the script for different vendors you have to loop the internal table which has only vendor with out duplicate entries..

Use the following code,

LOOP AT G_T_VENDOR.

PERFORM START_FORM.

PERFORM PRINT_DOCUMENT.

PERFORM END_FORM.

ENDLOOP.

g_t_vendor should contain only the vendor details with out duplicate entry. So you will get your output for each vendor.

<b>Reward if helpful..</b>

Read only

Former Member
0 Likes
483

Hi Ali,

Pseudo code for driver program

<b>in 1 window i should show name and land correponding to lifnr</b>

READ TABLE JTAB WITH KEY LIFNR

Use WRITE_FORM with window name

In Scirpt: &JTAB-LIFNR& &JAB-LAND1&

<b>in the main window i have to show matnr netpr menge correponding to doc no</b>

LOOP AT KTAB.

Use WRITE_FORM with window name as 'MAIN'

In Scirpt: &KTAB-MATNR& &KAB-NETPR& &KTAB-MENGE&

ENDLOOP.

<b>in 2 window i have to show the doc no.</b>

READ TABLE ITAB WITH KEY EBELN

Use WRITE_FORM with window name

In Scirpt: &ITAB-EBELN&

Thanks,

Vinay