cancel
Showing results for 
Search instead for 
Did you mean: 

How to fetch data into my custom script configured in qc02 transaction

SatyaGade
Explorer
0 Kudos

Hi All,

I configured the custom SAP-Script in place of standard script name in QC02 tcode.In my requirement when I execute QC22

transaction the custom script will be triggered along with some data based on material number,batch number and plant.I need to fetch QALS-KTEXTMAT , QALS-CHARG, MCH1-HSDAT and MCH1-VFDAT.Please help me how to fetch this data.Any Enahancement need to use or any spot is there Please specify.

Thanks in advance.

Regards,

Satya.

Edited by: satyareddygade on Sep 8, 2011 2:13 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186055
Active Participant
0 Kudos

Hi Satya,

Write Subroutine Pool program to get those details.

In that program Fetch KTEXTMAT CHARG from QALS based on the material number and plant where SELMATNR EQ <workarea>-matnr SELWERK EQ workarea-werks.

Fetch HSDAT and VFDAT from MCH1 table Where MATNR EQ <workarea>-matnr and CHARG EQ <workarea>-CHARG.

Regards,

Surya.

SatyaGade
Explorer
0 Kudos

Hi Surya,

thanks for your reply.

But in my script how can I use those variables like matnr ,charg and werks from work area.Is work area need to find from the pogram?When I execute qc22 tcode some program will trigger,So there I have to find these values and need to change the variables ? how?Please help me in solving this.send me the variables what i have to use in subroutine syntax and i have to change ?

Regards,

Satya.

former_member186055
Active Participant
0 Kudos

Hi Satya,

Try like this in your Script window text element.

/: PERFORM FETCH_KTEXTMAT IN PROGRAM <Z Subroutine Pool program>

/: USING &QALS-PRUEFLOS&

/: CHANGING &GV_KTEXTMAT&

/: ENDPERFORM

in Z Subroutine Pool program

FORM fetch_ktextmat TABLES intab STRUCTURE itcsy

outtab STRUCTURE itcsy.

DATA:

lv_prueflos TYPE qals-prueflos,

lv_ktextmat TYPE qals-ktextmat.

*---Get Inspection Lot Number

READ TABLE intab WITH KEY 'QALS-PRUEFLOS'.

CHECK sy-subrc = 0.

lv_prueflos = intab-value.

SELECT SINGLE ktextmat FROM qals INTO lv_ktextmat WHERE prueflos EQ lv_prueflos.

outtab-value = lv_ktextmat.

MODIFY outtab FROM outtab TRANSPORTING value WHERE

name = 'GV_KTEXTMAT'.

CLEAR : intab,outtab.

ENDFORM. "FETCH_KTEXTMAT

/: PERFORM FETCH_HSDAT IN PROGRAM <Z Subroutine Pool program>

/: USING &*VBDPL-MATNR&

/: USING &VBDPL-CHARG&

/: CHANGING &GV_HSDAT&

FORM fetch_hsdat TABLES intab STRUCTURE itcsy

outtab STRUCTURE itcsy.

DATA:

lv_matnr TYPE vbdpl-matnr,

lv_charg TYPE vbdpl-charg,

lv_hsdat TYPE mch1-hsdat.

*---Get Material Number

READ TABLE intab WITH KEY '*VBDPL-MATNR'.

CHECK sy-subrc = 0.

lv_matnr = intab-value.

*---Get Batch Number

READ TABLE intab WITH KEY 'VBDPL-CHARG'.

CHECK sy-subrc = 0.

lv_charg = intab-value.

SELECT SINGLE hsdat FROM mch1 INTO lv_hsdat WHERE matnr EQ lv_matnr

AND charg EQ lv_charg.

outtab-value = lv_hsdat.

MODIFY outtab FROM outtab TRANSPORTING value WHERE

name = 'GV_HSDAT'.

CLEAR : intab,outtab.

ENDFORM. "FETCH_HSDAT

Use the following program symbols where you want to print.

&GV_KTEXTMAT& &QALS-CHARG& &GV_HSDAT& and &MCH1-VFDAT&

Regards,

Surya.

SatyaGade
Explorer
0 Kudos

Hi Surya,

I will explain you the scenario.When I save a custom or standard script(QM_QCERT_01) in QC02 and when I execute QC22

that script will be triggered.But my problem is the layout of standard is different for my requirement,so can I go for a new design or else can I copy the standard one?IBecause I dont know the standard print program for that.

Regards,

satya.