Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to write code for this logic, plz help me very urgent

Hi All,

i am new to sap-abap, i got this work and i m working on this can any body help me in writing code, plz help me, this is very very urgent.

here i m giving my logic, can anybody send me the code related to this logic.

this is very urgent .

this program o/p should be in ALV format and need to create one commond 'SAVE" on this o/t list if user clicks save processedon and processedby fields in ZFIBUE should be updated automatically.

i am creating one custom table zfibue having fields: (serialno, bukrs, matnr,prdha,hkont,gsber,wrbtr,budat, credate, cretime,processed, processedon, processedby,mapped)

fields of zfibue:

serailno = numc

bukrs = char

matnr = char

prdha = char

hkont = char

gsber = char

wrbtr = char

budat = date

credate = date

cretime = time

processed= char

processedon = date

processedby = char

mapped = char are belongs to above type data types

and seelct-optionfields: s_bukrs for bseg-bukrs

s_hkont for bseg-hkont,

s_budat for bkpf-budat,

s_processed for zfibue-processed,

s_processedon for zfibue-processedon,

s_mapped. for zfibue-mapped

parameters: p_chk1 as checkbox,

p_chk2 as checkbox.

p_filepath type rlgrap-filename.

1.1 Validate the user inputs (S_BUKRS and S_HKONT) against respective check tables (T001 and SKB1). If the validation fails, provide respective error message. Eg: “Invalid input for Company Code”.

1.2 Fetch SERIALNO, BUKRS, MATNR, PRDHA, HKONT, GSBER, WRBTR, BUDAT, CREDATE, CRETIME, PROCESSED, PROCESSEDON, PROCESSEDBY, MAPPED from table ZFIBUE into internal table GT_ZFIBUE where BUKRS IN S_BUKRS, HKONT IN S_HKONT, BUDAT IN S_BUDAT, PROCESSED IN S_PROCESSED, PROCESSEDON IN S_PROCESSEDON, and MAPPED IN S_MAPPED.

1.3 If P_CHK2 = ‘X’, go to step 1.11. Else continue.

1.4 If P_CHK1 = ‘X’, continue. Else go to step 1.9

1.5 Fetch MATNR, PRDHA from MARA into GT_MARA for all entries in GT_ZFIBUE where MATNR = GT_ZFIBUE-MATNR.

1.6 Sort and delete adjacent duplicates from GT_MARA based on MATNR.

1.7 Loop through GT_ZFIBUE where PRDHA = blank.

Read Table GT_MARA based on MATNR = GT_ZFIBUE-MATNR.

IF sy-subrc = 0.

Move GT_MARA-PRDHA to GT_ZFIBUE-PRDHA.

Modify Table GT_ZFIBUE. “Update Product Hierarchy

Endif.

Fetch PRDHA, GSBER from ZFIBU into GT_ZFIBU for all entries in GT_ZFIBUE where PRDHA = GT_ZFIBUE-PRDHA.

Read Table GT_ZFIBU based on PRDHA = GT_ZFIBUE-PRDHA.

IF sy-subrc = 0.

Move GT_ZFIBU-GSBER to GT_ZFIBUE-GSBER.

Move “X” to GT_ZFIBUE-MAPPED.

Modify Table GT_ZFIBUE.

Endif.

Endloop.

1.8 Modify database table ZFIBUE from GT_ZFIBUE.

1.9 Fill the field catalog table GT_FIELDCAT using the details of output fields listed in section “Inputs/Outputs” (above).

Eg: LWA_ FIELDCAT -SELTEXT_L = 'Serial Number’.

LWA_ FIELDCAT -DATATYPE = ‘NUMC’.

LWA_ FIELDCAT -OUTPUTLEN = 9.

LWA_ FIELDCAT -TABNAME = 'GT_ZFIBUE'.

LWA_ FIELDCAT-FIELDNAME = 'SERIALNO'.

Append LWA_FIELDCAT to GT_FIELDCAT

Note: a) The output field GT_ZFIBUE-PROCESSED will be editable marking INPUT = “X” in field catalog (GT_FIELDCAT).

b) The standard ALV functionality will be used to give the user option for selecting all or blocks of entries at a time.

c) The PF-STATUS STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN will be copied to the program and modified to include a “SAVE” button.

1.10 Call the function module REUSE_ALV_GRID_DISPLAY passing output table GT_ZFIBUE and field catalog GT_FIELDCAT. Additional parameters like I_CALLBACK_PF_STATUS_SET (= ‘ZFIBUESTAT’) and I_CALLBACK_USER_COMMAND (=’HANDLE_USER_ACTION’) will also be passed to handle user events. Go to 2.14.

1.11 Download the file to P_FILEPATH using function module GUI_DOWNLOAD passing GT_ZFIBUE.

1.12 Exit Program.

Logic to be implemented in routine “Handle_User_Action”

This routine will have the following interface:

FORM Handle_User_Action USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

ENDFORM.

Following logic will be implemented in this routine:

1. If r_ucomm = ‘SAVE’, continue. Else exit.

2. Loop through GT_ZFIBUE where SEL_ROW = ‘X’. “Row is selected

a. IF GT_ZFIBUE-PROCESSED = ‘X’.

i. GT_ZFIBUE-PROCESSEDON = SY-DATUM.

ii. GT_ZFIBUE-PROCESSEDBY = SY-UNAME.

iii. MODIFY ZFIBUE FROM work area GT_ZFIBUE.

Endif.

Endloop.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question